@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/native-libs.js
CHANGED
|
@@ -515,9 +515,9 @@ if (typeof window !== 'undefined' && window && window.Web3) {
|
|
|
515
515
|
var LibsWeb3 = Web3;
|
|
516
516
|
|
|
517
517
|
var name = "@audius/sdk";
|
|
518
|
-
var version = "1.0.
|
|
518
|
+
var version = "1.0.37";
|
|
519
519
|
var audius = {
|
|
520
|
-
releaseSHA: "
|
|
520
|
+
releaseSHA: "dd0ddae94286c577c8a34ada50f2f79f613b55d2"
|
|
521
521
|
};
|
|
522
522
|
var description = "";
|
|
523
523
|
var main = "dist/index.cjs.js";
|
|
@@ -42494,14 +42494,12 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
42494
42494
|
userBankOutcomes,
|
|
42495
42495
|
feePayerOverride,
|
|
42496
42496
|
generateRecoveryLink,
|
|
42497
|
-
useEntityManager,
|
|
42498
42497
|
phases,
|
|
42499
42498
|
phase,
|
|
42500
42499
|
userId,
|
|
42501
42500
|
blockHash,
|
|
42502
42501
|
blockNumber,
|
|
42503
42502
|
ownerWallet,
|
|
42504
|
-
response,
|
|
42505
42503
|
newMetadata,
|
|
42506
42504
|
_args4 = arguments;
|
|
42507
42505
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
@@ -42516,7 +42514,6 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
42516
42514
|
userBankOutcomes = _args4.length > 8 && _args4[8] !== undefined ? _args4[8] : {};
|
|
42517
42515
|
feePayerOverride = _args4.length > 9 && _args4[9] !== undefined ? _args4[9] : null;
|
|
42518
42516
|
generateRecoveryLink = _args4.length > 10 && _args4[10] !== undefined ? _args4[10] : true;
|
|
42519
|
-
useEntityManager = _args4.length > 11 && _args4[11] !== undefined ? _args4[11] : false;
|
|
42520
42517
|
phases = {
|
|
42521
42518
|
ADD_REPLICA_SET: 'ADD_REPLICA_SET',
|
|
42522
42519
|
CREATE_USER_RECORD: 'CREATE_USER_RECORD',
|
|
@@ -42526,50 +42523,50 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
42526
42523
|
ADD_USER: 'ADD_USER'
|
|
42527
42524
|
};
|
|
42528
42525
|
phase = '';
|
|
42529
|
-
_context4.prev =
|
|
42526
|
+
_context4.prev = 10;
|
|
42530
42527
|
this.REQUIRES(Services.CREATOR_NODE, Services.IDENTITY_SERVICE);
|
|
42531
42528
|
|
|
42532
42529
|
if (!this.web3Manager.web3IsExternal()) {
|
|
42533
|
-
_context4.next =
|
|
42530
|
+
_context4.next = 18;
|
|
42534
42531
|
break;
|
|
42535
42532
|
}
|
|
42536
42533
|
|
|
42537
42534
|
phase = phases.CREATE_USER_RECORD;
|
|
42538
|
-
_context4.next =
|
|
42535
|
+
_context4.next = 16;
|
|
42539
42536
|
return this.identityService.createUserRecord(email, this.web3Manager.getWalletAddress());
|
|
42540
42537
|
|
|
42541
|
-
case
|
|
42542
|
-
_context4.next =
|
|
42538
|
+
case 16:
|
|
42539
|
+
_context4.next = 28;
|
|
42543
42540
|
break;
|
|
42544
42541
|
|
|
42545
|
-
case
|
|
42542
|
+
case 18:
|
|
42546
42543
|
this.REQUIRES(Services.HEDGEHOG); // If an owner wallet already exists, don't try to recreate it
|
|
42547
42544
|
|
|
42548
42545
|
if (hasWallet) {
|
|
42549
|
-
_context4.next =
|
|
42546
|
+
_context4.next = 28;
|
|
42550
42547
|
break;
|
|
42551
42548
|
}
|
|
42552
42549
|
|
|
42553
42550
|
phase = phases.HEDGEHOG_SIGNUP;
|
|
42554
|
-
_context4.next =
|
|
42551
|
+
_context4.next = 23;
|
|
42555
42552
|
return this.hedgehog.signUp(email, password);
|
|
42556
42553
|
|
|
42557
|
-
case
|
|
42554
|
+
case 23:
|
|
42558
42555
|
ownerWallet = _context4.sent;
|
|
42559
42556
|
this.web3Manager.setOwnerWallet(ownerWallet);
|
|
42560
42557
|
|
|
42561
42558
|
if (!generateRecoveryLink) {
|
|
42562
|
-
_context4.next =
|
|
42559
|
+
_context4.next = 28;
|
|
42563
42560
|
break;
|
|
42564
42561
|
}
|
|
42565
42562
|
|
|
42566
|
-
_context4.next =
|
|
42563
|
+
_context4.next = 28;
|
|
42567
42564
|
return this.generateRecoveryLink({
|
|
42568
42565
|
handle: metadata.handle,
|
|
42569
42566
|
host: host
|
|
42570
42567
|
});
|
|
42571
42568
|
|
|
42572
|
-
case
|
|
42569
|
+
case 28:
|
|
42573
42570
|
// Create a wAudio user bank address.
|
|
42574
42571
|
// If userbank creation fails, we still proceed
|
|
42575
42572
|
// through signup
|
|
@@ -42625,75 +42622,42 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
42625
42622
|
} // Add user to chain
|
|
42626
42623
|
|
|
42627
42624
|
|
|
42628
|
-
|
|
42629
|
-
_context4.next = 47;
|
|
42630
|
-
break;
|
|
42631
|
-
}
|
|
42632
|
-
|
|
42633
|
-
phase = phases.ADD_USER;
|
|
42634
|
-
_context4.next = 34;
|
|
42635
|
-
return this.User.addUser(metadata);
|
|
42636
|
-
|
|
42637
|
-
case 34:
|
|
42638
|
-
response = _context4.sent;
|
|
42639
|
-
userId = response.userId;
|
|
42640
|
-
blockHash = response.blockHash;
|
|
42641
|
-
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)
|
|
42642
|
-
|
|
42643
|
-
phase = phases.ADD_REPLICA_SET;
|
|
42644
|
-
_context4.next = 41;
|
|
42645
|
-
return this.User.assignReplicaSet({
|
|
42646
|
-
userId: userId
|
|
42647
|
-
});
|
|
42648
|
-
|
|
42649
|
-
case 41:
|
|
42650
|
-
metadata = _context4.sent;
|
|
42651
|
-
// Upload profile pic and cover photo to primary Content Node and sync across secondaries
|
|
42652
|
-
phase = phases.UPLOAD_PROFILE_IMAGES;
|
|
42653
|
-
_context4.next = 45;
|
|
42654
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, metadata, useEntityManager);
|
|
42655
|
-
|
|
42656
|
-
case 45:
|
|
42657
|
-
_context4.next = 52;
|
|
42658
|
-
break;
|
|
42659
|
-
|
|
42660
|
-
case 47:
|
|
42661
|
-
_context4.next = 49;
|
|
42625
|
+
_context4.next = 31;
|
|
42662
42626
|
return this.User.createEntityManagerUser({
|
|
42663
42627
|
metadata: metadata
|
|
42664
42628
|
});
|
|
42665
42629
|
|
|
42666
|
-
case
|
|
42630
|
+
case 31:
|
|
42667
42631
|
newMetadata = _context4.sent;
|
|
42668
|
-
_context4.next =
|
|
42669
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata
|
|
42632
|
+
_context4.next = 34;
|
|
42633
|
+
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata);
|
|
42670
42634
|
|
|
42671
|
-
case
|
|
42672
|
-
_context4.next =
|
|
42635
|
+
case 34:
|
|
42636
|
+
_context4.next = 39;
|
|
42673
42637
|
break;
|
|
42674
42638
|
|
|
42675
|
-
case
|
|
42676
|
-
_context4.prev =
|
|
42677
|
-
_context4.t0 = _context4["catch"](
|
|
42639
|
+
case 36:
|
|
42640
|
+
_context4.prev = 36;
|
|
42641
|
+
_context4.t0 = _context4["catch"](10);
|
|
42678
42642
|
return _context4.abrupt("return", {
|
|
42679
42643
|
error: _context4.t0.message,
|
|
42680
42644
|
phase: phase,
|
|
42681
42645
|
errorStatus: _context4.t0.response ? _context4.t0.response.status : null
|
|
42682
42646
|
});
|
|
42683
42647
|
|
|
42684
|
-
case
|
|
42648
|
+
case 39:
|
|
42685
42649
|
return _context4.abrupt("return", {
|
|
42686
42650
|
blockHash: blockHash,
|
|
42687
42651
|
blockNumber: blockNumber,
|
|
42688
42652
|
userId: userId
|
|
42689
42653
|
});
|
|
42690
42654
|
|
|
42691
|
-
case
|
|
42655
|
+
case 40:
|
|
42692
42656
|
case "end":
|
|
42693
42657
|
return _context4.stop();
|
|
42694
42658
|
}
|
|
42695
42659
|
}
|
|
42696
|
-
}, _callee4, this, [[
|
|
42660
|
+
}, _callee4, this, [[10, 36]]);
|
|
42697
42661
|
}));
|
|
42698
42662
|
|
|
42699
42663
|
function signUp(_x3, _x4, _x5) {
|
|
@@ -44779,7 +44743,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
44779
44743
|
}, {
|
|
44780
44744
|
key: "uploadProfileImages",
|
|
44781
44745
|
value: function () {
|
|
44782
|
-
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata
|
|
44746
|
+
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata) {
|
|
44783
44747
|
var didMetadataUpdate, resp, _resp;
|
|
44784
44748
|
|
|
44785
44749
|
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
@@ -44824,8 +44788,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
44824
44788
|
_context13.next = 16;
|
|
44825
44789
|
return this.updateAndUploadMetadata({
|
|
44826
44790
|
newMetadata: metadata,
|
|
44827
|
-
userId: metadata.user_id
|
|
44828
|
-
useEntityManager: useEntityManager
|
|
44791
|
+
userId: metadata.user_id
|
|
44829
44792
|
});
|
|
44830
44793
|
|
|
44831
44794
|
case 16:
|
|
@@ -44839,7 +44802,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
44839
44802
|
}, _callee13, this);
|
|
44840
44803
|
}));
|
|
44841
44804
|
|
|
44842
|
-
function uploadProfileImages(_x10, _x11, _x12
|
|
44805
|
+
function uploadProfileImages(_x10, _x11, _x12) {
|
|
44843
44806
|
return _uploadProfileImages.apply(this, arguments);
|
|
44844
44807
|
}
|
|
44845
44808
|
|
|
@@ -44920,7 +44883,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
44920
44883
|
}, _callee14);
|
|
44921
44884
|
}));
|
|
44922
44885
|
|
|
44923
|
-
return function (
|
|
44886
|
+
return function (_x14) {
|
|
44924
44887
|
return _ref3.apply(this, arguments);
|
|
44925
44888
|
};
|
|
44926
44889
|
}()));
|
|
@@ -44969,8 +44932,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
44969
44932
|
_context15.next = 42;
|
|
44970
44933
|
return this.updateAndUploadMetadata({
|
|
44971
44934
|
newMetadata: newMetadata,
|
|
44972
|
-
userId: userId
|
|
44973
|
-
useEntityManager: true
|
|
44935
|
+
userId: userId
|
|
44974
44936
|
});
|
|
44975
44937
|
|
|
44976
44938
|
case 42:
|
|
@@ -45002,7 +44964,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45002
44964
|
}, _callee15, this, [[7, 47]]);
|
|
45003
44965
|
}));
|
|
45004
44966
|
|
|
45005
|
-
function createEntityManagerUser(
|
|
44967
|
+
function createEntityManagerUser(_x13) {
|
|
45006
44968
|
return _createEntityManagerUser.apply(this, arguments);
|
|
45007
44969
|
}
|
|
45008
44970
|
|
|
@@ -45078,7 +45040,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45078
45040
|
}, _callee16, this);
|
|
45079
45041
|
}));
|
|
45080
45042
|
|
|
45081
|
-
function addUser(
|
|
45043
|
+
function addUser(_x15) {
|
|
45082
45044
|
return _addUser.apply(this, arguments);
|
|
45083
45045
|
}
|
|
45084
45046
|
|
|
@@ -45113,7 +45075,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45113
45075
|
}, _callee17, this);
|
|
45114
45076
|
}));
|
|
45115
45077
|
|
|
45116
|
-
function updateEntityManagerReplicaSet(
|
|
45078
|
+
function updateEntityManagerReplicaSet(_x16) {
|
|
45117
45079
|
return _updateEntityManagerReplicaSet.apply(this, arguments);
|
|
45118
45080
|
}
|
|
45119
45081
|
|
|
@@ -45176,7 +45138,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45176
45138
|
}, _callee18, this);
|
|
45177
45139
|
}));
|
|
45178
45140
|
|
|
45179
|
-
function updateUser(
|
|
45141
|
+
function updateUser(_x17, _x18) {
|
|
45180
45142
|
return _updateUser.apply(this, arguments);
|
|
45181
45143
|
}
|
|
45182
45144
|
|
|
@@ -45189,8 +45151,8 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45189
45151
|
}, {
|
|
45190
45152
|
key: "updateCreator",
|
|
45191
45153
|
value: function () {
|
|
45192
|
-
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata
|
|
45193
|
-
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
45154
|
+
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata) {
|
|
45155
|
+
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, response, txReceipt, latestBlockNumber, latestBlockHash;
|
|
45194
45156
|
|
|
45195
45157
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
45196
45158
|
while (1) {
|
|
@@ -45202,7 +45164,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45202
45164
|
|
|
45203
45165
|
this._validateUserMetadata(newMetadata);
|
|
45204
45166
|
|
|
45205
|
-
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]
|
|
45167
|
+
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]");
|
|
45206
45168
|
fnStartMs = Date.now();
|
|
45207
45169
|
startMs = fnStartMs; // Error if libs instance does not already have existing user state
|
|
45208
45170
|
|
|
@@ -45251,60 +45213,28 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45251
45213
|
_yield$this$creatorNo = _context19.sent;
|
|
45252
45214
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
45253
45215
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
45254
|
-
|
|
45255
|
-
if (useEntityManager) {
|
|
45256
|
-
_context19.next = 37;
|
|
45257
|
-
break;
|
|
45258
|
-
}
|
|
45259
|
-
|
|
45260
|
-
// Write metadata multihash to chain
|
|
45261
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
45262
|
-
_context19.next = 28;
|
|
45263
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
45264
|
-
|
|
45265
|
-
case 28:
|
|
45266
|
-
updateMultiHashResp = _context19.sent;
|
|
45267
|
-
txReceipt = updateMultiHashResp.txReceipt; // Write remaining metadata fields to chain
|
|
45268
|
-
|
|
45269
|
-
_context19.next = 32;
|
|
45270
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId);
|
|
45271
|
-
|
|
45272
|
-
case 32:
|
|
45273
|
-
updateUserResp = _context19.sent;
|
|
45274
|
-
latestBlockHash = updateUserResp.latestBlockHash;
|
|
45275
|
-
latestBlockNumber = Math.max(txReceipt.blockNumber, updateUserResp.latestBlockNumber);
|
|
45276
|
-
_context19.next = 42;
|
|
45277
|
-
break;
|
|
45278
|
-
|
|
45279
|
-
case 37:
|
|
45280
|
-
_context19.next = 39;
|
|
45216
|
+
_context19.next = 26;
|
|
45281
45217
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
45282
45218
|
|
|
45283
|
-
case
|
|
45219
|
+
case 26:
|
|
45284
45220
|
response = _context19.sent;
|
|
45285
45221
|
txReceipt = response.txReceipt;
|
|
45286
45222
|
latestBlockNumber = txReceipt.blockNumber;
|
|
45223
|
+
latestBlockHash = txReceipt.blockHash; // Write to CN to associate blockchain user id with updated metadata and block number
|
|
45287
45224
|
|
|
45288
|
-
|
|
45289
|
-
_context19.next = 44;
|
|
45225
|
+
_context19.next = 32;
|
|
45290
45226
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, latestBlockNumber);
|
|
45291
45227
|
|
|
45292
|
-
case
|
|
45228
|
+
case 32:
|
|
45293
45229
|
// Update libs instance with new user metadata object
|
|
45294
45230
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
45295
|
-
|
|
45296
|
-
if (!latestBlockHash || !latestBlockNumber) {
|
|
45297
|
-
latestBlockHash = txReceipt.blockHash;
|
|
45298
|
-
latestBlockNumber = txReceipt.blockNumber;
|
|
45299
|
-
}
|
|
45300
|
-
|
|
45301
45231
|
return _context19.abrupt("return", {
|
|
45302
45232
|
blockHash: latestBlockHash,
|
|
45303
45233
|
blockNumber: latestBlockNumber,
|
|
45304
45234
|
userId: userId
|
|
45305
45235
|
});
|
|
45306
45236
|
|
|
45307
|
-
case
|
|
45237
|
+
case 34:
|
|
45308
45238
|
case "end":
|
|
45309
45239
|
return _context19.stop();
|
|
45310
45240
|
}
|
|
@@ -45312,7 +45242,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45312
45242
|
}, _callee19, this);
|
|
45313
45243
|
}));
|
|
45314
45244
|
|
|
45315
|
-
function updateCreator(
|
|
45245
|
+
function updateCreator(_x19, _x20) {
|
|
45316
45246
|
return _updateCreator.apply(this, arguments);
|
|
45317
45247
|
}
|
|
45318
45248
|
|
|
@@ -45325,30 +45255,18 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45325
45255
|
}, {
|
|
45326
45256
|
key: "updateIsVerified",
|
|
45327
45257
|
value: function () {
|
|
45328
|
-
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId,
|
|
45258
|
+
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId, privateKey) {
|
|
45329
45259
|
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
45330
45260
|
while (1) {
|
|
45331
45261
|
switch (_context20.prev = _context20.next) {
|
|
45332
45262
|
case 0:
|
|
45333
|
-
|
|
45334
|
-
_context20.next = 6;
|
|
45335
|
-
break;
|
|
45336
|
-
}
|
|
45337
|
-
|
|
45338
|
-
_context20.next = 3;
|
|
45263
|
+
_context20.next = 2;
|
|
45339
45264
|
return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
|
|
45340
45265
|
|
|
45341
|
-
case
|
|
45342
|
-
return _context20.abrupt("return", _context20.sent);
|
|
45343
|
-
|
|
45344
|
-
case 6:
|
|
45345
|
-
_context20.next = 8;
|
|
45346
|
-
return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
|
|
45347
|
-
|
|
45348
|
-
case 8:
|
|
45266
|
+
case 2:
|
|
45349
45267
|
return _context20.abrupt("return", _context20.sent);
|
|
45350
45268
|
|
|
45351
|
-
case
|
|
45269
|
+
case 3:
|
|
45352
45270
|
case "end":
|
|
45353
45271
|
return _context20.stop();
|
|
45354
45272
|
}
|
|
@@ -45356,7 +45274,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45356
45274
|
}, _callee20, this);
|
|
45357
45275
|
}));
|
|
45358
45276
|
|
|
45359
|
-
function updateIsVerified(
|
|
45277
|
+
function updateIsVerified(_x21, _x22) {
|
|
45360
45278
|
return _updateIsVerified.apply(this, arguments);
|
|
45361
45279
|
}
|
|
45362
45280
|
|
|
@@ -45390,7 +45308,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45390
45308
|
}, _callee21, this);
|
|
45391
45309
|
}));
|
|
45392
45310
|
|
|
45393
|
-
function addUserFollow(
|
|
45311
|
+
function addUserFollow(_x23) {
|
|
45394
45312
|
return _addUserFollow.apply(this, arguments);
|
|
45395
45313
|
}
|
|
45396
45314
|
|
|
@@ -45424,7 +45342,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45424
45342
|
}, _callee22, this);
|
|
45425
45343
|
}));
|
|
45426
45344
|
|
|
45427
|
-
function deleteUserFollow(
|
|
45345
|
+
function deleteUserFollow(_x24) {
|
|
45428
45346
|
return _deleteUserFollow.apply(this, arguments);
|
|
45429
45347
|
}
|
|
45430
45348
|
|
|
@@ -45470,7 +45388,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45470
45388
|
}, _callee23, this, [[0, 8]]);
|
|
45471
45389
|
}));
|
|
45472
45390
|
|
|
45473
|
-
function addUserSubscribe(
|
|
45391
|
+
function addUserSubscribe(_x25) {
|
|
45474
45392
|
return _addUserSubscribe.apply(this, arguments);
|
|
45475
45393
|
}
|
|
45476
45394
|
|
|
@@ -45516,7 +45434,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45516
45434
|
}, _callee24, this, [[0, 8]]);
|
|
45517
45435
|
}));
|
|
45518
45436
|
|
|
45519
|
-
function deleteUserSubscribe(
|
|
45437
|
+
function deleteUserSubscribe(_x26) {
|
|
45520
45438
|
return _deleteUserSubscribe.apply(this, arguments);
|
|
45521
45439
|
}
|
|
45522
45440
|
|
|
@@ -45533,13 +45451,13 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45533
45451
|
key: "updateAndUploadMetadata",
|
|
45534
45452
|
value: function () {
|
|
45535
45453
|
var _updateAndUploadMetadata = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(_ref5) {
|
|
45536
|
-
var newMetadata, userId,
|
|
45454
|
+
var newMetadata, userId, phases, phase, oldMetadata, logPrefix, fnStartMs, startMs, _yield$this$_updateRe, _txReceipt, replicaSetSPIDs, _yield$this$creatorNo2, metadataMultihash, metadataFileUUID, response, txReceipt, blockNumber, errorMsg;
|
|
45537
45455
|
|
|
45538
45456
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
45539
45457
|
while (1) {
|
|
45540
45458
|
switch (_context25.prev = _context25.next) {
|
|
45541
45459
|
case 0:
|
|
45542
|
-
newMetadata = _ref5.newMetadata, userId = _ref5.userId
|
|
45460
|
+
newMetadata = _ref5.newMetadata, userId = _ref5.userId;
|
|
45543
45461
|
this.REQUIRES(Services.CREATOR_NODE, Services.DISCOVERY_PROVIDER);
|
|
45544
45462
|
this.IS_OBJECT(newMetadata);
|
|
45545
45463
|
phases = {
|
|
@@ -45570,7 +45488,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45570
45488
|
_context25.prev = 13;
|
|
45571
45489
|
|
|
45572
45490
|
if (!(newMetadata.creator_node_endpoint !== oldMetadata.creator_node_endpoint)) {
|
|
45573
|
-
_context25.next =
|
|
45491
|
+
_context25.next = 28;
|
|
45574
45492
|
break;
|
|
45575
45493
|
}
|
|
45576
45494
|
|
|
@@ -45583,39 +45501,23 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45583
45501
|
_txReceipt = _yield$this$_updateRe.txReceipt;
|
|
45584
45502
|
replicaSetSPIDs = _yield$this$_updateRe.replicaSetSPIDs;
|
|
45585
45503
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateReplicaSetOnChain() completed in ").concat(Date.now() - startMs, "ms"));
|
|
45586
|
-
|
|
45587
|
-
if (!useEntityManager) {
|
|
45588
|
-
_context25.next = 31;
|
|
45589
|
-
break;
|
|
45590
|
-
}
|
|
45591
|
-
|
|
45592
45504
|
startMs = Date.now();
|
|
45593
|
-
_context25.next =
|
|
45505
|
+
_context25.next = 25;
|
|
45594
45506
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, _txReceipt.blockNumber);
|
|
45595
45507
|
|
|
45596
|
-
case
|
|
45508
|
+
case 25:
|
|
45597
45509
|
// @ts-expect-error
|
|
45598
45510
|
newMetadata.primary_id = replicaSetSPIDs[0];
|
|
45599
45511
|
newMetadata.secondary_ids = replicaSetSPIDs.slice(1);
|
|
45600
45512
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] waitForReplicaSetDiscoveryIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
45601
|
-
_context25.next = 35;
|
|
45602
|
-
break;
|
|
45603
45513
|
|
|
45604
|
-
case
|
|
45605
|
-
startMs = Date.now();
|
|
45606
|
-
_context25.next = 34;
|
|
45607
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
45608
|
-
|
|
45609
|
-
case 34:
|
|
45610
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _waitForURSMCreatorNodeEndpointIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
45611
|
-
|
|
45612
|
-
case 35:
|
|
45514
|
+
case 28:
|
|
45613
45515
|
// Upload new metadata object to CN
|
|
45614
45516
|
phase = phases.UPLOAD_METADATA;
|
|
45615
|
-
_context25.next =
|
|
45517
|
+
_context25.next = 31;
|
|
45616
45518
|
return this.creatorNode.uploadCreatorContent(newMetadata);
|
|
45617
45519
|
|
|
45618
|
-
case
|
|
45520
|
+
case 31:
|
|
45619
45521
|
_yield$this$creatorNo2 = _context25.sent;
|
|
45620
45522
|
metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
|
|
45621
45523
|
metadataFileUUID = _yield$this$creatorNo2.metadataFileUUID;
|
|
@@ -45623,85 +45525,54 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45623
45525
|
startMs = Date.now(); // Write metadata multihash to chain
|
|
45624
45526
|
|
|
45625
45527
|
phase = phases.UPDATE_METADATA_ON_CHAIN;
|
|
45626
|
-
|
|
45627
|
-
if (!useEntityManager) {
|
|
45628
|
-
_context25.next = 52;
|
|
45629
|
-
break;
|
|
45630
|
-
}
|
|
45631
|
-
|
|
45632
|
-
_context25.next = 47;
|
|
45528
|
+
_context25.next = 39;
|
|
45633
45529
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
45634
45530
|
|
|
45635
|
-
case
|
|
45531
|
+
case 39:
|
|
45636
45532
|
response = _context25.sent;
|
|
45637
45533
|
txReceipt = response.txReceipt;
|
|
45638
45534
|
blockNumber = txReceipt.blockNumber;
|
|
45639
|
-
_context25.next = 66;
|
|
45640
|
-
break;
|
|
45641
|
-
|
|
45642
|
-
case 52:
|
|
45643
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
45644
|
-
_context25.next = 55;
|
|
45645
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
45646
|
-
|
|
45647
|
-
case 55:
|
|
45648
|
-
res = _context25.sent;
|
|
45649
|
-
txReceipt = res.txReceipt;
|
|
45650
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] UserFactoryClient.updateMultihash() completed in ").concat(Date.now() - startMs, "ms"));
|
|
45651
|
-
startMs = Date.now(); // Write remaining metadata fields to chain
|
|
45652
|
-
|
|
45653
|
-
phase = phases.UPDATE_USER_ON_CHAIN_OPS;
|
|
45654
|
-
_context25.next = 62;
|
|
45655
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId, ['creator_node_endpoint']);
|
|
45656
|
-
|
|
45657
|
-
case 62:
|
|
45658
|
-
_yield$this$_updateUs2 = _context25.sent;
|
|
45659
|
-
latestBlockNumber = _yield$this$_updateUs2.latestBlockNumber;
|
|
45660
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateUserOperations() completed in ").concat(Date.now() - startMs, "ms"));
|
|
45661
|
-
blockNumber = Math.max(txReceipt.blockNumber, latestBlockNumber);
|
|
45662
|
-
|
|
45663
|
-
case 66:
|
|
45664
45535
|
startMs = Date.now(); // Write to CN to associate blockchain user id with updated metadata and block number
|
|
45665
45536
|
|
|
45666
45537
|
phase = phases.ASSOCIATE_USER;
|
|
45667
|
-
_context25.next =
|
|
45538
|
+
_context25.next = 46;
|
|
45668
45539
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, blockNumber);
|
|
45669
45540
|
|
|
45670
|
-
case
|
|
45541
|
+
case 46:
|
|
45671
45542
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] creatorNode.associateCreator() completed in ").concat(Date.now() - startMs, "ms"));
|
|
45672
45543
|
startMs = Date.now(); // Update libs instance with new user metadata object
|
|
45673
45544
|
|
|
45674
45545
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
45675
45546
|
console.log("".concat(logPrefix, " completed in ").concat(Date.now() - fnStartMs, "ms"));
|
|
45676
|
-
_context25.next =
|
|
45547
|
+
_context25.next = 59;
|
|
45677
45548
|
break;
|
|
45678
45549
|
|
|
45679
|
-
case
|
|
45680
|
-
_context25.prev =
|
|
45550
|
+
case 52:
|
|
45551
|
+
_context25.prev = 52;
|
|
45681
45552
|
_context25.t0 = _context25["catch"](13);
|
|
45682
45553
|
// TODO: think about handling the update metadata on chain and associating..
|
|
45683
45554
|
errorMsg = "updateAndUploadMetadata() Error -- Phase ".concat(phase, " in ").concat(Date.now() - fnStartMs, "ms: ").concat(_context25.t0);
|
|
45684
45555
|
|
|
45685
45556
|
if (!(_context25.t0 instanceof Error)) {
|
|
45686
|
-
_context25.next =
|
|
45557
|
+
_context25.next = 58;
|
|
45687
45558
|
break;
|
|
45688
45559
|
}
|
|
45689
45560
|
|
|
45690
45561
|
_context25.t0.message = errorMsg;
|
|
45691
45562
|
throw _context25.t0;
|
|
45692
45563
|
|
|
45693
|
-
case
|
|
45564
|
+
case 58:
|
|
45694
45565
|
throw new Error(errorMsg);
|
|
45695
45566
|
|
|
45696
|
-
case
|
|
45567
|
+
case 59:
|
|
45697
45568
|
case "end":
|
|
45698
45569
|
return _context25.stop();
|
|
45699
45570
|
}
|
|
45700
45571
|
}
|
|
45701
|
-
}, _callee25, this, [[13,
|
|
45572
|
+
}, _callee25, this, [[13, 52]]);
|
|
45702
45573
|
}));
|
|
45703
45574
|
|
|
45704
|
-
function updateAndUploadMetadata(
|
|
45575
|
+
function updateAndUploadMetadata(_x27) {
|
|
45705
45576
|
return _updateAndUploadMetadata.apply(this, arguments);
|
|
45706
45577
|
}
|
|
45707
45578
|
|
|
@@ -45820,7 +45691,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45820
45691
|
}, _callee27, this);
|
|
45821
45692
|
}));
|
|
45822
45693
|
|
|
45823
|
-
function _waitForCreatorNodeEndpointIndexing(
|
|
45694
|
+
function _waitForCreatorNodeEndpointIndexing(_x28, _x29) {
|
|
45824
45695
|
return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
45825
45696
|
}
|
|
45826
45697
|
|
|
@@ -45923,7 +45794,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45923
45794
|
}, _callee29);
|
|
45924
45795
|
}));
|
|
45925
45796
|
|
|
45926
|
-
function waitForReplicaSetDiscoveryIndexing(
|
|
45797
|
+
function waitForReplicaSetDiscoveryIndexing(_x30, _x31, _x32) {
|
|
45927
45798
|
return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
|
|
45928
45799
|
}
|
|
45929
45800
|
|
|
@@ -45998,7 +45869,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
45998
45869
|
}, _callee31);
|
|
45999
45870
|
}));
|
|
46000
45871
|
|
|
46001
|
-
function _waitForURSMCreatorNodeEndpointIndexing(
|
|
45872
|
+
function _waitForURSMCreatorNodeEndpointIndexing(_x33, _x34) {
|
|
46002
45873
|
return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
46003
45874
|
}
|
|
46004
45875
|
|
|
@@ -46084,7 +45955,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
46084
45955
|
}, _callee32, this);
|
|
46085
45956
|
}));
|
|
46086
45957
|
|
|
46087
|
-
function _addUserOperations(
|
|
45958
|
+
function _addUserOperations(_x35, _x36) {
|
|
46088
45959
|
return _addUserOperations2.apply(this, arguments);
|
|
46089
45960
|
}
|
|
46090
45961
|
|
|
@@ -46179,7 +46050,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
46179
46050
|
}, _callee33, this);
|
|
46180
46051
|
}));
|
|
46181
46052
|
|
|
46182
|
-
function _updateUserOperations(
|
|
46053
|
+
function _updateUserOperations(_x37, _x38, _x39) {
|
|
46183
46054
|
return _updateUserOperations2.apply(this, arguments);
|
|
46184
46055
|
}
|
|
46185
46056
|
|
|
@@ -46214,7 +46085,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
46214
46085
|
key: "_updateReplicaSetOnChain",
|
|
46215
46086
|
value: function () {
|
|
46216
46087
|
var _updateReplicaSetOnChain2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(userId, creatorNodeEndpoint) {
|
|
46217
|
-
var primaryEndpoint, secondaries, _yield$Promise$all, _yield$Promise$all2, primarySpID, secondary1SpID, secondary2SpID,
|
|
46088
|
+
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;
|
|
46218
46089
|
|
|
46219
46090
|
return regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
46220
46091
|
while (1) {
|
|
@@ -46259,45 +46130,29 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
46259
46130
|
throw new Error('Current user missing');
|
|
46260
46131
|
|
|
46261
46132
|
case 17:
|
|
46262
|
-
|
|
46263
|
-
|
|
46264
|
-
return (_this$contracts$UserR = this.contracts.UserReplicaSetManagerClient) === null || _this$contracts$UserR === void 0 ? void 0 : _this$contracts$UserR.updateReplicaSet(userId, primarySpID, [secondary1SpID, secondary2SpID]);
|
|
46265
|
-
|
|
46266
|
-
case 20:
|
|
46267
|
-
txReceipt = _context34.sent;
|
|
46268
|
-
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
46269
|
-
updateEndpointTxBlockNumber = (_txReceipt2 = txReceipt) === null || _txReceipt2 === void 0 ? void 0 : _txReceipt2.blockNumber;
|
|
46270
|
-
_context34.next = 25;
|
|
46271
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
46272
|
-
|
|
46273
|
-
case 25:
|
|
46274
|
-
_context34.next = 47;
|
|
46275
|
-
break;
|
|
46276
|
-
|
|
46277
|
-
case 27:
|
|
46278
|
-
_context34.prev = 27;
|
|
46279
|
-
_context34.t0 = _context34["catch"](17);
|
|
46133
|
+
// First try to update with URSM
|
|
46134
|
+
// Fallback to EntityManager when relay errors
|
|
46280
46135
|
currentPrimaryEndpoint = CreatorNode.getPrimary(currentUser.creator_node_endpoint);
|
|
46281
46136
|
currentSecondaries = CreatorNode.getSecondaries(currentUser.creator_node_endpoint);
|
|
46282
46137
|
|
|
46283
46138
|
if (!(currentSecondaries.length < 2)) {
|
|
46284
|
-
_context34.next =
|
|
46139
|
+
_context34.next = 21;
|
|
46285
46140
|
break;
|
|
46286
46141
|
}
|
|
46287
46142
|
|
|
46288
46143
|
throw new Error("Invalid number of secondaries found - received ".concat(currentSecondaries));
|
|
46289
46144
|
|
|
46290
|
-
case
|
|
46291
|
-
_context34.next =
|
|
46145
|
+
case 21:
|
|
46146
|
+
_context34.next = 23;
|
|
46292
46147
|
return Promise.all([this._retrieveSpIDFromEndpoint(currentPrimaryEndpoint), this._retrieveSpIDFromEndpoint(currentSecondaries[0]), this._retrieveSpIDFromEndpoint(currentSecondaries[1])]);
|
|
46293
46148
|
|
|
46294
|
-
case
|
|
46149
|
+
case 23:
|
|
46295
46150
|
_yield$Promise$all3 = _context34.sent;
|
|
46296
46151
|
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 3);
|
|
46297
46152
|
oldPrimary = _yield$Promise$all4[0];
|
|
46298
46153
|
oldSecondary1SpID = _yield$Promise$all4[1];
|
|
46299
46154
|
oldSecondary2SpID = _yield$Promise$all4[2];
|
|
46300
|
-
_context34.next =
|
|
46155
|
+
_context34.next = 30;
|
|
46301
46156
|
return this.updateEntityManagerReplicaSet({
|
|
46302
46157
|
userId: userId,
|
|
46303
46158
|
primary: primarySpID,
|
|
@@ -46306,36 +46161,36 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
46306
46161
|
oldSecondaries: [oldSecondary1SpID, oldSecondary2SpID]
|
|
46307
46162
|
});
|
|
46308
46163
|
|
|
46309
|
-
case
|
|
46164
|
+
case 30:
|
|
46310
46165
|
txReceipt = _context34.sent;
|
|
46311
46166
|
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
46312
|
-
updateEndpointTxBlockNumber =
|
|
46313
|
-
_context34.next =
|
|
46167
|
+
updateEndpointTxBlockNumber = txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.blockNumber;
|
|
46168
|
+
_context34.next = 35;
|
|
46314
46169
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, updateEndpointTxBlockNumber);
|
|
46315
46170
|
|
|
46316
|
-
case
|
|
46171
|
+
case 35:
|
|
46317
46172
|
if (txReceipt) {
|
|
46318
|
-
_context34.next =
|
|
46173
|
+
_context34.next = 37;
|
|
46319
46174
|
break;
|
|
46320
46175
|
}
|
|
46321
46176
|
|
|
46322
46177
|
throw new Error('Unable to update replica set on chain');
|
|
46323
46178
|
|
|
46324
|
-
case
|
|
46179
|
+
case 37:
|
|
46325
46180
|
return _context34.abrupt("return", {
|
|
46326
46181
|
txReceipt: txReceipt,
|
|
46327
46182
|
replicaSetSPIDs: replicaSetSPIDs
|
|
46328
46183
|
});
|
|
46329
46184
|
|
|
46330
|
-
case
|
|
46185
|
+
case 38:
|
|
46331
46186
|
case "end":
|
|
46332
46187
|
return _context34.stop();
|
|
46333
46188
|
}
|
|
46334
46189
|
}
|
|
46335
|
-
}, _callee34, this
|
|
46190
|
+
}, _callee34, this);
|
|
46336
46191
|
}));
|
|
46337
46192
|
|
|
46338
|
-
function _updateReplicaSetOnChain(
|
|
46193
|
+
function _updateReplicaSetOnChain(_x40, _x41) {
|
|
46339
46194
|
return _updateReplicaSetOnChain2.apply(this, arguments);
|
|
46340
46195
|
}
|
|
46341
46196
|
|
|
@@ -46390,7 +46245,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
46390
46245
|
}, _callee35, this);
|
|
46391
46246
|
}));
|
|
46392
46247
|
|
|
46393
|
-
function _retrieveSpIDFromEndpoint(
|
|
46248
|
+
function _retrieveSpIDFromEndpoint(_x42) {
|
|
46394
46249
|
return _retrieveSpIDFromEndpoint2.apply(this, arguments);
|
|
46395
46250
|
}
|
|
46396
46251
|
|
|
@@ -47237,10 +47092,10 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47237
47092
|
}, {
|
|
47238
47093
|
key: "uploadTrack",
|
|
47239
47094
|
value: function () {
|
|
47240
|
-
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress
|
|
47095
|
+
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress) {
|
|
47241
47096
|
var _this2 = this;
|
|
47242
47097
|
|
|
47243
|
-
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID,
|
|
47098
|
+
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID, trackId, response, txReceipt;
|
|
47244
47099
|
|
|
47245
47100
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
47246
47101
|
while (1) {
|
|
@@ -47317,42 +47172,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47317
47172
|
transcodedTrackCID = _yield$retry.transcodedTrackCID;
|
|
47318
47173
|
phase = phases.ADDING_TRACK; // Write metadata to chain
|
|
47319
47174
|
|
|
47320
|
-
|
|
47321
|
-
_context19.next = 31;
|
|
47322
|
-
break;
|
|
47323
|
-
}
|
|
47324
|
-
|
|
47325
|
-
_context19.next = 24;
|
|
47175
|
+
_context19.next = 23;
|
|
47326
47176
|
return this._generateTrackId();
|
|
47327
47177
|
|
|
47328
|
-
case
|
|
47178
|
+
case 23:
|
|
47329
47179
|
trackId = _context19.sent;
|
|
47330
|
-
_context19.next =
|
|
47180
|
+
_context19.next = 26;
|
|
47331
47181
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
47332
47182
|
|
|
47333
|
-
case
|
|
47183
|
+
case 26:
|
|
47334
47184
|
response = _context19.sent;
|
|
47335
47185
|
txReceipt = response.txReceipt;
|
|
47336
|
-
_context19.next = 37;
|
|
47337
|
-
break;
|
|
47338
|
-
|
|
47339
|
-
case 31:
|
|
47340
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
47341
|
-
_context19.next = 34;
|
|
47342
|
-
return this.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
47343
|
-
|
|
47344
|
-
case 34:
|
|
47345
|
-
_response = _context19.sent;
|
|
47346
|
-
txReceipt = _response.txReceipt;
|
|
47347
|
-
trackId = _response.trackId;
|
|
47348
|
-
|
|
47349
|
-
case 37:
|
|
47350
47186
|
phase = phases.ASSOCIATING_TRACK; // Associate the track id with the file metadata and block number
|
|
47351
47187
|
|
|
47352
|
-
_context19.next =
|
|
47188
|
+
_context19.next = 31;
|
|
47353
47189
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber, transcodedTrackUUID);
|
|
47354
47190
|
|
|
47355
|
-
case
|
|
47191
|
+
case 31:
|
|
47356
47192
|
return _context19.abrupt("return", {
|
|
47357
47193
|
blockHash: txReceipt.blockHash,
|
|
47358
47194
|
blockNumber: txReceipt.blockNumber,
|
|
@@ -47361,23 +47197,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47361
47197
|
error: false
|
|
47362
47198
|
});
|
|
47363
47199
|
|
|
47364
|
-
case
|
|
47365
|
-
_context19.prev =
|
|
47200
|
+
case 34:
|
|
47201
|
+
_context19.prev = 34;
|
|
47366
47202
|
_context19.t0 = _context19["catch"](4);
|
|
47367
47203
|
return _context19.abrupt("return", {
|
|
47368
47204
|
error: _context19.t0.message,
|
|
47369
47205
|
phase: phase
|
|
47370
47206
|
});
|
|
47371
47207
|
|
|
47372
|
-
case
|
|
47208
|
+
case 37:
|
|
47373
47209
|
case "end":
|
|
47374
47210
|
return _context19.stop();
|
|
47375
47211
|
}
|
|
47376
47212
|
}
|
|
47377
|
-
}, _callee19, this, [[4,
|
|
47213
|
+
}, _callee19, this, [[4, 34]]);
|
|
47378
47214
|
}));
|
|
47379
47215
|
|
|
47380
|
-
function uploadTrack(_x13, _x14, _x15, _x16
|
|
47216
|
+
function uploadTrack(_x13, _x14, _x15, _x16) {
|
|
47381
47217
|
return _uploadTrack.apply(this, arguments);
|
|
47382
47218
|
}
|
|
47383
47219
|
|
|
@@ -47474,7 +47310,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47474
47310
|
}, _callee21, this);
|
|
47475
47311
|
}));
|
|
47476
47312
|
|
|
47477
|
-
function uploadTrackContentToCreatorNode(_x18, _x19, _x20
|
|
47313
|
+
function uploadTrackContentToCreatorNode(_x17, _x18, _x19, _x20) {
|
|
47478
47314
|
return _uploadTrackContentToCreatorNode.apply(this, arguments);
|
|
47479
47315
|
}
|
|
47480
47316
|
|
|
@@ -47489,7 +47325,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47489
47325
|
}, {
|
|
47490
47326
|
key: "addTracksToChainAndCnode",
|
|
47491
47327
|
value: function () {
|
|
47492
|
-
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList
|
|
47328
|
+
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList) {
|
|
47493
47329
|
var _this4 = this;
|
|
47494
47330
|
|
|
47495
47331
|
var ownerId, addedToChain, requestFailed, associatedWithCreatorNode;
|
|
@@ -47513,8 +47349,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47513
47349
|
_context24.next = 8;
|
|
47514
47350
|
return Promise.all(trackMultihashAndUUIDList.map( /*#__PURE__*/function () {
|
|
47515
47351
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(trackInfo, i) {
|
|
47516
|
-
var metadataMultihash, metadataFileUUID, transcodedTrackUUID,
|
|
47517
|
-
|
|
47352
|
+
var metadataMultihash, metadataFileUUID, transcodedTrackUUID, trackId, response, txReceipt;
|
|
47518
47353
|
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
47519
47354
|
while (1) {
|
|
47520
47355
|
switch (_context22.prev = _context22.next) {
|
|
@@ -47522,60 +47357,41 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47522
47357
|
_context22.prev = 0;
|
|
47523
47358
|
metadataMultihash = trackInfo.metadataMultihash, metadataFileUUID = trackInfo.metadataFileUUID, transcodedTrackUUID = trackInfo.transcodedTrackUUID; // Write metadata to chain
|
|
47524
47359
|
|
|
47525
|
-
|
|
47526
|
-
_context22.next = 12;
|
|
47527
|
-
break;
|
|
47528
|
-
}
|
|
47529
|
-
|
|
47530
|
-
_context22.next = 5;
|
|
47360
|
+
_context22.next = 4;
|
|
47531
47361
|
return _this4._generateTrackId();
|
|
47532
47362
|
|
|
47533
|
-
case
|
|
47363
|
+
case 4:
|
|
47534
47364
|
trackId = _context22.sent;
|
|
47535
|
-
_context22.next =
|
|
47365
|
+
_context22.next = 7;
|
|
47536
47366
|
return _this4.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
47537
47367
|
|
|
47538
|
-
case
|
|
47368
|
+
case 7:
|
|
47539
47369
|
response = _context22.sent;
|
|
47540
47370
|
txReceipt = response.txReceipt;
|
|
47541
|
-
_context22.next = 18;
|
|
47542
|
-
break;
|
|
47543
|
-
|
|
47544
|
-
case 12:
|
|
47545
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
47546
|
-
_context22.next = 15;
|
|
47547
|
-
return _this4.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
47548
|
-
|
|
47549
|
-
case 15:
|
|
47550
|
-
_response2 = _context22.sent;
|
|
47551
|
-
txReceipt = _response2.txReceipt;
|
|
47552
|
-
trackId = _response2.trackId;
|
|
47553
|
-
|
|
47554
|
-
case 18:
|
|
47555
47371
|
addedToChain[i] = {
|
|
47556
47372
|
trackId: trackId,
|
|
47557
47373
|
metadataFileUUID: metadataFileUUID,
|
|
47558
47374
|
transcodedTrackUUID: transcodedTrackUUID,
|
|
47559
47375
|
txReceipt: txReceipt
|
|
47560
47376
|
};
|
|
47561
|
-
_context22.next =
|
|
47377
|
+
_context22.next = 16;
|
|
47562
47378
|
break;
|
|
47563
47379
|
|
|
47564
|
-
case
|
|
47565
|
-
_context22.prev =
|
|
47380
|
+
case 12:
|
|
47381
|
+
_context22.prev = 12;
|
|
47566
47382
|
_context22.t0 = _context22["catch"](0);
|
|
47567
47383
|
requestFailed = true;
|
|
47568
47384
|
console.error(_context22.t0);
|
|
47569
47385
|
|
|
47570
|
-
case
|
|
47386
|
+
case 16:
|
|
47571
47387
|
case "end":
|
|
47572
47388
|
return _context22.stop();
|
|
47573
47389
|
}
|
|
47574
47390
|
}
|
|
47575
|
-
}, _callee22, null, [[0,
|
|
47391
|
+
}, _callee22, null, [[0, 12]]);
|
|
47576
47392
|
}));
|
|
47577
47393
|
|
|
47578
|
-
return function (
|
|
47394
|
+
return function (_x22, _x23) {
|
|
47579
47395
|
return _ref3.apply(this, arguments);
|
|
47580
47396
|
};
|
|
47581
47397
|
}()));
|
|
@@ -47621,7 +47437,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47621
47437
|
}, _callee23);
|
|
47622
47438
|
}));
|
|
47623
47439
|
|
|
47624
|
-
return function (
|
|
47440
|
+
return function (_x24) {
|
|
47625
47441
|
return _ref4.apply(this, arguments);
|
|
47626
47442
|
};
|
|
47627
47443
|
}()));
|
|
@@ -47656,7 +47472,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47656
47472
|
}, _callee24, this, [[11, 16]]);
|
|
47657
47473
|
}));
|
|
47658
47474
|
|
|
47659
|
-
function addTracksToChainAndCnode(
|
|
47475
|
+
function addTracksToChainAndCnode(_x21) {
|
|
47660
47476
|
return _addTracksToChainAndCnode.apply(this, arguments);
|
|
47661
47477
|
}
|
|
47662
47478
|
|
|
@@ -47671,8 +47487,8 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47671
47487
|
}, {
|
|
47672
47488
|
key: "updateTrack",
|
|
47673
47489
|
value: function () {
|
|
47674
|
-
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata
|
|
47675
|
-
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
47490
|
+
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata) {
|
|
47491
|
+
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, trackId, response, txReceipt;
|
|
47676
47492
|
|
|
47677
47493
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
47678
47494
|
while (1) {
|
|
@@ -47702,43 +47518,26 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47702
47518
|
_yield$this$creatorNo = _context25.sent;
|
|
47703
47519
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
47704
47520
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
47521
|
+
// Write the new metadata to chain
|
|
47705
47522
|
trackId = metadata.track_id;
|
|
47706
|
-
|
|
47707
|
-
if (!useEntityManager) {
|
|
47708
|
-
_context25.next = 20;
|
|
47709
|
-
break;
|
|
47710
|
-
}
|
|
47711
|
-
|
|
47712
|
-
_context25.next = 16;
|
|
47523
|
+
_context25.next = 15;
|
|
47713
47524
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
47714
47525
|
|
|
47715
|
-
case
|
|
47526
|
+
case 15:
|
|
47716
47527
|
response = _context25.sent;
|
|
47717
|
-
txReceipt = response.txReceipt;
|
|
47718
|
-
_context25.next = 25;
|
|
47719
|
-
break;
|
|
47528
|
+
txReceipt = response.txReceipt; // Re-associate the track id with the new metadata
|
|
47720
47529
|
|
|
47721
|
-
|
|
47722
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
47723
|
-
_context25.next = 23;
|
|
47724
|
-
return this.contracts.TrackFactoryClient.updateTrack(trackId, ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
47725
|
-
|
|
47726
|
-
case 23:
|
|
47727
|
-
_response3 = _context25.sent;
|
|
47728
|
-
txReceipt = _response3.txReceipt;
|
|
47729
|
-
|
|
47730
|
-
case 25:
|
|
47731
|
-
_context25.next = 27;
|
|
47530
|
+
_context25.next = 19;
|
|
47732
47531
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber);
|
|
47733
47532
|
|
|
47734
|
-
case
|
|
47533
|
+
case 19:
|
|
47735
47534
|
return _context25.abrupt("return", {
|
|
47736
47535
|
blockHash: txReceipt.blockHash,
|
|
47737
47536
|
blockNumber: txReceipt.blockNumber,
|
|
47738
47537
|
trackId: trackId
|
|
47739
47538
|
});
|
|
47740
47539
|
|
|
47741
|
-
case
|
|
47540
|
+
case 20:
|
|
47742
47541
|
case "end":
|
|
47743
47542
|
return _context25.stop();
|
|
47744
47543
|
}
|
|
@@ -47746,7 +47545,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47746
47545
|
}, _callee25, this);
|
|
47747
47546
|
}));
|
|
47748
47547
|
|
|
47749
|
-
function updateTrack(
|
|
47548
|
+
function updateTrack(_x25) {
|
|
47750
47549
|
return _updateTrack.apply(this, arguments);
|
|
47751
47550
|
}
|
|
47752
47551
|
|
|
@@ -47788,7 +47587,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47788
47587
|
}, _callee26, this);
|
|
47789
47588
|
}));
|
|
47790
47589
|
|
|
47791
|
-
function logTrackListen(
|
|
47590
|
+
function logTrackListen(_x26, _x27) {
|
|
47792
47591
|
return _logTrackListen.apply(this, arguments);
|
|
47793
47592
|
}
|
|
47794
47593
|
|
|
@@ -47822,7 +47621,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47822
47621
|
}, _callee27, this);
|
|
47823
47622
|
}));
|
|
47824
47623
|
|
|
47825
|
-
function addTrackRepost(
|
|
47624
|
+
function addTrackRepost(_x28) {
|
|
47826
47625
|
return _addTrackRepost.apply(this, arguments);
|
|
47827
47626
|
}
|
|
47828
47627
|
|
|
@@ -47857,7 +47656,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47857
47656
|
}, _callee28, this);
|
|
47858
47657
|
}));
|
|
47859
47658
|
|
|
47860
|
-
function deleteTrackRepost(
|
|
47659
|
+
function deleteTrackRepost(_x29) {
|
|
47861
47660
|
return _deleteTrackRepost.apply(this, arguments);
|
|
47862
47661
|
}
|
|
47863
47662
|
|
|
@@ -47892,7 +47691,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47892
47691
|
}, _callee29, this);
|
|
47893
47692
|
}));
|
|
47894
47693
|
|
|
47895
|
-
function addTrackSave(
|
|
47694
|
+
function addTrackSave(_x30) {
|
|
47896
47695
|
return _addTrackSave.apply(this, arguments);
|
|
47897
47696
|
}
|
|
47898
47697
|
|
|
@@ -47927,7 +47726,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47927
47726
|
}, _callee30, this);
|
|
47928
47727
|
}));
|
|
47929
47728
|
|
|
47930
|
-
function deleteTrackSave(
|
|
47729
|
+
function deleteTrackSave(_x31) {
|
|
47931
47730
|
return _deleteTrackSave.apply(this, arguments);
|
|
47932
47731
|
}
|
|
47933
47732
|
|
|
@@ -47941,41 +47740,29 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47941
47740
|
}, {
|
|
47942
47741
|
key: "deleteTrack",
|
|
47943
47742
|
value: function () {
|
|
47944
|
-
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId
|
|
47743
|
+
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId) {
|
|
47945
47744
|
var ownerId;
|
|
47946
47745
|
return regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
47947
47746
|
while (1) {
|
|
47948
47747
|
switch (_context31.prev = _context31.next) {
|
|
47949
47748
|
case 0:
|
|
47950
|
-
if (!useEntityManager) {
|
|
47951
|
-
_context31.next = 9;
|
|
47952
|
-
break;
|
|
47953
|
-
}
|
|
47954
|
-
|
|
47955
47749
|
ownerId = this.userStateManager.getCurrentUserId();
|
|
47956
47750
|
|
|
47957
47751
|
if (ownerId) {
|
|
47958
|
-
_context31.next =
|
|
47752
|
+
_context31.next = 3;
|
|
47959
47753
|
break;
|
|
47960
47754
|
}
|
|
47961
47755
|
|
|
47962
47756
|
throw new Error('No users loaded for this wallet');
|
|
47963
47757
|
|
|
47964
|
-
case
|
|
47965
|
-
_context31.next =
|
|
47758
|
+
case 3:
|
|
47759
|
+
_context31.next = 5;
|
|
47966
47760
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.DELETE, '');
|
|
47967
47761
|
|
|
47968
|
-
case
|
|
47969
|
-
return _context31.abrupt("return", _context31.sent);
|
|
47970
|
-
|
|
47971
|
-
case 9:
|
|
47972
|
-
_context31.next = 11;
|
|
47973
|
-
return this.contracts.TrackFactoryClient.deleteTrack(trackId);
|
|
47974
|
-
|
|
47975
|
-
case 11:
|
|
47762
|
+
case 5:
|
|
47976
47763
|
return _context31.abrupt("return", _context31.sent);
|
|
47977
47764
|
|
|
47978
|
-
case
|
|
47765
|
+
case 6:
|
|
47979
47766
|
case "end":
|
|
47980
47767
|
return _context31.stop();
|
|
47981
47768
|
}
|
|
@@ -47983,7 +47770,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
47983
47770
|
}, _callee31, this);
|
|
47984
47771
|
}));
|
|
47985
47772
|
|
|
47986
|
-
function deleteTrack(
|
|
47773
|
+
function deleteTrack(_x32) {
|
|
47987
47774
|
return _deleteTrack.apply(this, arguments);
|
|
47988
47775
|
}
|
|
47989
47776
|
|
|
@@ -54079,9 +53866,7 @@ var rolloverNodes = /*#__PURE__*/function () {
|
|
|
54079
53866
|
newMetadata.creator_node_endpoint = newEndpoints.join(',');
|
|
54080
53867
|
console.debug("Sanity Check - rolloverNodes - new nodes ".concat(newMetadata.creator_node_endpoint));
|
|
54081
53868
|
_context4.next = 32;
|
|
54082
|
-
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata
|
|
54083
|
-
/* useEntityManager */
|
|
54084
|
-
);
|
|
53869
|
+
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata);
|
|
54085
53870
|
|
|
54086
53871
|
case 32:
|
|
54087
53872
|
_context4.next = 37;
|