@audius/sdk 0.0.37 → 0.0.38

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/legacy.js CHANGED
@@ -33455,9 +33455,9 @@ var formatProviders = function formatProviders(providers) {
33455
33455
  };
33456
33456
 
33457
33457
  var name = "@audius/sdk";
33458
- var version = "0.0.37";
33458
+ var version = "0.0.38";
33459
33459
  var audius = {
33460
- releaseSHA: "ce81e1601506bb4982a2d5617ecf220bc94ba76d"
33460
+ releaseSHA: "74503074cb96dea181ec2b218c5cb6d528c1db86"
33461
33461
  };
33462
33462
  var description = "";
33463
33463
  var main = "dist/index.cjs.js";
@@ -37069,7 +37069,7 @@ var Base = /*#__PURE__*/function () {
37069
37069
  return Base;
37070
37070
  }();
37071
37071
 
37072
- var decodeHashId$2 = Utils.decodeHashId;
37072
+ var decodeHashId$1 = Utils.decodeHashId;
37073
37073
  var GetAttestationError = Object.freeze({
37074
37074
  CHALLENGE_INCOMPLETE: 'CHALLENGE_INCOMPLETE',
37075
37075
  ALREADY_DISBURSED: 'ALREADY_DISBURSED',
@@ -37154,7 +37154,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37154
37154
 
37155
37155
  case 7:
37156
37156
  // Aggregate
37157
- logger.info("submitAndEvaluate: aggregating attestations for userId [".concat(decodeHashId$2(encodedUserId), "], challengeId [").concat(challengeId, "]"));
37157
+ logger.info("submitAndEvaluate: aggregating attestations for userId [".concat(decodeHashId$1(encodedUserId), "], challengeId [").concat(challengeId, "]"));
37158
37158
  phase = AttestationPhases.AGGREGATE_ATTESTATIONS;
37159
37159
  _context.next = 11;
37160
37160
  return this.aggregateAttestations({
@@ -37190,7 +37190,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37190
37190
 
37191
37191
  case 21:
37192
37192
  // Submit
37193
- logger.info("submitAndEvaluate: submitting for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$2(encodedUserId), "] with [").concat(discoveryNodeAttestations === null || discoveryNodeAttestations === void 0 ? void 0 : discoveryNodeAttestations.length, "] DN and [").concat(aaoAttestation ? 1 : 0, "] oracle attestations."));
37193
+ logger.info("submitAndEvaluate: submitting for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "] with [").concat(discoveryNodeAttestations === null || discoveryNodeAttestations === void 0 ? void 0 : discoveryNodeAttestations.length, "] DN and [").concat(aaoAttestation ? 1 : 0, "] oracle attestations."));
37194
37194
  fullTokenAmount = new BN__default["default"](amount * WRAPPED_AUDIO_PRECISION);
37195
37195
  phase = AttestationPhases.SUBMIT_ATTESTATIONS; // @ts-expect-error the return types are a bit strange here
37196
37196
 
@@ -37228,7 +37228,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37228
37228
  break;
37229
37229
  }
37230
37230
 
37231
- logger.warn("submitAndEvaluate: saw repeat senders for userId [".concat(decodeHashId$2(encodedUserId), "] challengeId: [").concat(challengeId, "] with err: ").concat(submitErrorCode, ", breaking up into individual transactions"));
37231
+ logger.warn("submitAndEvaluate: saw repeat senders for userId [".concat(decodeHashId$1(encodedUserId), "] challengeId: [").concat(challengeId, "] with err: ").concat(submitErrorCode, ", breaking up into individual transactions"));
37232
37232
  _context.next = 35;
37233
37233
  return this.solanaWeb3Manager.submitChallengeAttestations({
37234
37234
  attestations: discoveryNodeAttestations,
@@ -37251,7 +37251,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37251
37251
 
37252
37252
  case 38:
37253
37253
  // Evaluate
37254
- logger.info("submitAndEvaluate: evaluating for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$2(encodedUserId), "]"));
37254
+ logger.info("submitAndEvaluate: evaluating for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
37255
37255
  phase = AttestationPhases.EVALUATE_ATTESTATIONS;
37256
37256
  _context.next = 42;
37257
37257
  return this.solanaWeb3Manager.evaluateChallengeAttestations({
@@ -37290,7 +37290,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37290
37290
  _context.t0 = _context["catch"](3);
37291
37291
  err = _context.t0.message;
37292
37292
  log = err === GetAttestationError.COGNITO_FLOW || err === GetAttestationError.HCAPTCHA ? logger.info : logger.error;
37293
- log("submitAndEvaluate: failed for userId: [".concat(decodeHashId$2(encodedUserId), "] challenge-id [").concat(challengeId, "] at phase [").concat(phase, "] with err: ").concat(err));
37293
+ log("submitAndEvaluate: failed for userId: [".concat(decodeHashId$1(encodedUserId), "] challenge-id [").concat(challengeId, "] at phase [").concat(phase, "] with err: ").concat(err));
37294
37294
  return _context.abrupt("return", {
37295
37295
  success: false,
37296
37296
  error: err,
@@ -37405,7 +37405,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37405
37405
  _context2.prev = 25;
37406
37406
  _context2.t0 = _context2["catch"](13);
37407
37407
  err = _context2.t0.message;
37408
- logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$2(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(err));
37408
+ logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(err));
37409
37409
  return _context2.abrupt("return", {
37410
37410
  discoveryNodeAttestations: null,
37411
37411
  aaoAttestation: null,
@@ -37468,7 +37468,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37468
37468
  _context2.prev = 43;
37469
37469
  _context2.t1 = _context2["catch"](30);
37470
37470
  _err = _context2.t1.message;
37471
- logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$2(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(_err));
37471
+ logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(_err));
37472
37472
  return _context2.abrupt("return", {
37473
37473
  discoveryNodeAttestations: null,
37474
37474
  aaoAttestation: null,
@@ -37526,7 +37526,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37526
37526
  _context3.prev = 10;
37527
37527
  _context3.t0 = _context3["catch"](2);
37528
37528
  err = _context3.t0.message;
37529
- logger.error("Failed to get challenge attestation for userId [".concat(decodeHashId$2(encodedUserId), "] challengeId [").concat(challengeId, "]from ").concat(discoveryProviderEndpoint, " with ").concat(err));
37529
+ logger.error("Failed to get challenge attestation for userId [".concat(decodeHashId$1(encodedUserId), "] challengeId [").concat(challengeId, "]from ").concat(discoveryProviderEndpoint, " with ").concat(err));
37530
37530
  mappedErr = GetAttestationError[err] || GetAttestationError.DISCOVERY_NODE_UNKNOWN_RESPONSE;
37531
37531
  return _context3.abrupt("return", {
37532
37532
  success: null,
@@ -37799,9 +37799,9 @@ var Rewards = /*#__PURE__*/function (_Base) {
37799
37799
 
37800
37800
  case 16:
37801
37801
  if (needsAttestations.length || unrecoverableError) {
37802
- logger.info("Failed to aggregate attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$2(encodedUserId), "]"));
37802
+ logger.info("Failed to aggregate attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
37803
37803
  } else {
37804
- logger.info("Successfully aggregated attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$2(encodedUserId), "]"));
37804
+ logger.info("Successfully aggregated attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
37805
37805
  }
37806
37806
 
37807
37807
  return _context7.abrupt("return", completedAttestations);
@@ -38026,7 +38026,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
38026
38026
  return Rewards;
38027
38027
  }(Base);
38028
38028
 
38029
- var decodeHashId$1 = Utils.decodeHashId; // `BaseRewardsReporter` is intended to be subclassed, and provides
38029
+ var decodeHashId = Utils.decodeHashId; // `BaseRewardsReporter` is intended to be subclassed, and provides
38030
38030
  // "reporting" functionality to RewardsAttester (i.e. posts to Slack if something notable happens)
38031
38031
 
38032
38032
  var BaseRewardsReporter = /*#__PURE__*/function () {
@@ -39030,7 +39030,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39030
39030
  switch (_context17.prev = _context17.next) {
39031
39031
  case 0:
39032
39032
  challengeId = _ref9.challengeId, userId = _ref9.userId, specifier = _ref9.specifier, amount = _ref9.amount, handle = _ref9.handle, wallet = _ref9.wallet, completedBlocknumber = _ref9.completedBlocknumber;
39033
- this.logger.info("Attempting to attest for userId [".concat(decodeHashId$1(userId), "], challengeId: [").concat(challengeId, "], quorum size: [").concat(this.quorumSize, "]}"));
39033
+ this.logger.info("Attempting to attest for userId [".concat(decodeHashId(userId), "], challengeId: [").concat(challengeId, "], quorum size: [").concat(this.quorumSize, "]}"));
39034
39034
  _context17.next = 4;
39035
39035
  return this.libs.Rewards.submitAndEvaluate({
39036
39036
  challengeId: challengeId,
@@ -39061,7 +39061,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39061
39061
  break;
39062
39062
  }
39063
39063
 
39064
- this.logger.info("Successfully attestested for challenge [".concat(challengeId, "] for user [").concat(decodeHashId$1(userId), "], amount [").concat(amount, "]!"));
39064
+ this.logger.info("Successfully attestested for challenge [".concat(challengeId, "] for user [").concat(decodeHashId(userId), "], amount [").concat(amount, "]!"));
39065
39065
  return _context17.abrupt("return", {
39066
39066
  challengeId: challengeId,
39067
39067
  userId: userId,
@@ -39075,7 +39075,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39075
39075
 
39076
39076
  case 13:
39077
39077
  // Handle error path
39078
- this.logger.error("Failed to attest for challenge [".concat(challengeId, "] for user [").concat(decodeHashId$1(userId), "], amount [").concat(amount, "], oracle: [").concat(this.aaoAddress, "] at phase: [").concat(phase, "] with error [").concat(error, "]"));
39078
+ this.logger.error("Failed to attest for challenge [".concat(challengeId, "] for user [").concat(decodeHashId(userId), "], amount [").concat(amount, "], oracle: [").concat(this.aaoAddress, "] at phase: [").concat(phase, "] with error [").concat(error, "]"));
39079
39079
  return _context17.abrupt("return", {
39080
39080
  challengeId: challengeId,
39081
39081
  userId: userId,
@@ -39333,7 +39333,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39333
39333
  successful.push(res);
39334
39334
 
39335
39335
  _this5.reporter.reportSuccess({
39336
- userId: (_decodeHashId = decodeHashId$1(res.userId)) !== null && _decodeHashId !== void 0 ? _decodeHashId : -1,
39336
+ userId: (_decodeHashId = decodeHashId(res.userId)) !== null && _decodeHashId !== void 0 ? _decodeHashId : -1,
39337
39337
  challengeId: res.challengeId,
39338
39338
  amount: res.amount,
39339
39339
  specifier: res.specifier
@@ -39354,7 +39354,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39354
39354
  var _decodeHashId2;
39355
39355
 
39356
39356
  var report = {
39357
- userId: (_decodeHashId2 = decodeHashId$1(res.userId)) !== null && _decodeHashId2 !== void 0 ? _decodeHashId2 : -1,
39357
+ userId: (_decodeHashId2 = decodeHashId(res.userId)) !== null && _decodeHashId2 !== void 0 ? _decodeHashId2 : -1,
39358
39358
  challengeId: res.challengeId,
39359
39359
  amount: res.amount,
39360
39360
  error: res.error,
@@ -57125,15 +57125,13 @@ var EntityType;
57125
57125
  (function (EntityType) {
57126
57126
  EntityType["PLAYLIST"] = "Playlist";
57127
57127
  })(EntityType || (EntityType = {}));
57128
-
57129
- var encodeHashId = Utils.encodeHashId,
57130
- decodeHashId = Utils.decodeHashId;
57131
57128
  /*
57132
57129
  API surface for updated data contract interactions.
57133
57130
  Provides simplified entity management in a generic fashion
57134
57131
  Handles metadata + file upload etc. for entities such as Playlist/Track/User
57135
57132
  */
57136
57133
 
57134
+
57137
57135
  var EntityManager = /*#__PURE__*/function (_Base) {
57138
57136
  _inherits(EntityManager, _Base);
57139
57137
 
@@ -57157,46 +57155,15 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57157
57155
  return Math.floor(Math.random() * (max - min) + min);
57158
57156
  }
57159
57157
  }, {
57160
- key: "getFullPlaylist",
57161
- value: function () {
57162
- var _getFullPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(playlistId, userId) {
57163
- var encodedPlaylistId, encodedUserId, playlist;
57164
- return regeneratorRuntime.wrap(function _callee$(_context) {
57165
- while (1) {
57166
- switch (_context.prev = _context.next) {
57167
- case 0:
57168
- encodedPlaylistId = encodeHashId(playlistId);
57169
- encodedUserId = encodeHashId(userId);
57170
- _context.next = 4;
57171
- return this.discoveryProvider.getFullPlaylist(encodedPlaylistId, encodedUserId);
57172
-
57173
- case 4:
57174
- playlist = _context.sent[0];
57175
- return _context.abrupt("return", playlist);
57176
-
57177
- case 6:
57178
- case "end":
57179
- return _context.stop();
57180
- }
57181
- }
57182
- }, _callee, this);
57183
- }));
57184
-
57185
- function getFullPlaylist(_x, _x2) {
57186
- return _getFullPlaylist.apply(this, arguments);
57187
- }
57188
-
57189
- return getFullPlaylist;
57190
- }()
57191
- }, {
57192
- key: "mapAddedTimestamps",
57193
- value: function mapAddedTimestamps(addedTimestamps) {
57158
+ key: "mapTimestamps",
57159
+ value: function mapTimestamps(addedTimestamps) {
57194
57160
  var trackIds = addedTimestamps.map(function (trackObj) {
57195
57161
  var _trackObj$metadata_ti;
57196
57162
 
57197
57163
  return {
57198
- track: decodeHashId(trackObj.track_id),
57199
- time: (_trackObj$metadata_ti = trackObj.metadata_timestamp) !== null && _trackObj$metadata_ti !== void 0 ? _trackObj$metadata_ti : trackObj.timestamp
57164
+ track: trackObj.track,
57165
+ time: (_trackObj$metadata_ti = trackObj.metadata_time) !== null && _trackObj$metadata_ti !== void 0 ? _trackObj$metadata_ti : trackObj.time // default to time for legacy playlists
57166
+
57200
57167
  };
57201
57168
  });
57202
57169
  return trackIds;
@@ -57211,7 +57178,6 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57211
57178
  return {
57212
57179
  blockHash: null,
57213
57180
  blockNumber: null,
57214
- playlistId: null,
57215
57181
  error: null
57216
57182
  };
57217
57183
  }
@@ -57222,113 +57188,94 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57222
57188
  }, {
57223
57189
  key: "createPlaylist",
57224
57190
  value: function () {
57225
- var _createPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref) {
57226
- var playlistId, playlistName, trackIds, description, isAlbum, isPrivate, coverArt, coverArtSizes, responseValues, _dirCID, currentUserId, userId, createAction, entityType, dirCID, updatedPlaylistImage, web3, currentBlockNumber, currentBlock, tracks, metadata, _yield$this$creatorNo, metadataMultihash, manageEntityResponse, txReceipt, error;
57191
+ var _createPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(playlist) {
57192
+ var responseValues, _playlist$artwork, _dirCID, userId, createAction, entityType, dirCID, updatedPlaylistImage, tracks, metadata, _yield$this$creatorNo, metadataMultihash, manageEntityResponse, txReceipt, error;
57227
57193
 
57228
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
57194
+ return regeneratorRuntime.wrap(function _callee$(_context) {
57229
57195
  while (1) {
57230
- switch (_context2.prev = _context2.next) {
57196
+ switch (_context.prev = _context.next) {
57231
57197
  case 0:
57232
- playlistId = _ref.playlistId, playlistName = _ref.playlistName, trackIds = _ref.trackIds, description = _ref.description, isAlbum = _ref.isAlbum, isPrivate = _ref.isPrivate, coverArt = _ref.coverArt, coverArtSizes = _ref.coverArtSizes;
57233
57198
  responseValues = this.getDefaultPlaylistReponseValues();
57234
- _context2.prev = 2;
57235
- currentUserId = this.userStateManager.getCurrentUserId();
57199
+ _context.prev = 1;
57200
+ userId = this.userStateManager.getCurrentUserId();
57236
57201
 
57237
- if (currentUserId) {
57238
- _context2.next = 7;
57202
+ if (userId) {
57203
+ _context.next = 6;
57239
57204
  break;
57240
57205
  }
57241
57206
 
57242
57207
  responseValues.error = 'Missing current user ID';
57243
- return _context2.abrupt("return", responseValues);
57208
+ return _context.abrupt("return", responseValues);
57244
57209
 
57245
- case 7:
57246
- userId = parseInt(currentUserId);
57210
+ case 6:
57247
57211
  createAction = Action.CREATE;
57248
57212
  entityType = EntityType.PLAYLIST;
57249
57213
  this.REQUIRES(Services.CREATOR_NODE);
57250
57214
 
57251
- if (!coverArt) {
57252
- _context2.next = 16;
57215
+ if (!(playlist !== null && playlist !== void 0 && (_playlist$artwork = playlist.artwork) !== null && _playlist$artwork !== void 0 && _playlist$artwork.file)) {
57216
+ _context.next = 14;
57253
57217
  break;
57254
57218
  }
57255
57219
 
57256
- _context2.next = 14;
57257
- return this.creatorNode.uploadImage(coverArt, true // square
57220
+ _context.next = 12;
57221
+ return this.creatorNode.uploadImage(playlist.artwork.file, true // square
57258
57222
  );
57259
57223
 
57260
- case 14:
57261
- updatedPlaylistImage = _context2.sent;
57224
+ case 12:
57225
+ updatedPlaylistImage = _context.sent;
57262
57226
  dirCID = updatedPlaylistImage.dirCID;
57263
57227
 
57264
- case 16:
57265
- web3 = this.web3Manager.getWeb3();
57266
- _context2.next = 19;
57267
- return web3.eth.getBlockNumber();
57268
-
57269
- case 19:
57270
- currentBlockNumber = _context2.sent;
57271
- _context2.next = 22;
57272
- return web3.eth.getBlock(currentBlockNumber);
57273
-
57274
- case 22:
57275
- currentBlock = _context2.sent;
57276
- tracks = trackIds.map(function (trackId) {
57277
- return {
57278
- track: trackId,
57279
- time: currentBlock.timestamp
57280
- };
57281
- });
57228
+ case 14:
57229
+ tracks = this.mapTimestamps(playlist.playlist_contents.track_ids);
57282
57230
  metadata = {
57283
- playlist_id: playlistId,
57231
+ playlist_id: playlist.playlist_id,
57284
57232
  playlist_contents: {
57285
57233
  track_ids: tracks
57286
57234
  },
57287
- playlist_name: playlistName,
57288
- playlist_image_sizes_multihash: (_dirCID = dirCID) !== null && _dirCID !== void 0 ? _dirCID : coverArtSizes,
57289
- description: description,
57290
- is_album: isAlbum,
57291
- is_private: isPrivate
57235
+ playlist_name: playlist.playlist_name,
57236
+ playlist_image_sizes_multihash: (_dirCID = dirCID) !== null && _dirCID !== void 0 ? _dirCID : playlist.cover_art_sizes,
57237
+ description: playlist.description,
57238
+ is_album: playlist.is_album,
57239
+ is_private: playlist.is_private
57292
57240
  };
57293
- _context2.next = 27;
57241
+ _context.next = 18;
57294
57242
  return this.creatorNode.uploadPlaylistMetadata(metadata);
57295
57243
 
57296
- case 27:
57297
- _yield$this$creatorNo = _context2.sent;
57244
+ case 18:
57245
+ _yield$this$creatorNo = _context.sent;
57298
57246
  metadataMultihash = _yield$this$creatorNo.metadataMultihash;
57299
- _context2.next = 31;
57247
+ _context.next = 22;
57300
57248
  return this.manageEntity({
57301
57249
  userId: userId,
57302
57250
  entityType: entityType,
57303
- entityId: playlistId,
57251
+ entityId: playlist.playlist_id,
57304
57252
  action: createAction,
57305
57253
  metadataMultihash: metadataMultihash
57306
57254
  });
57307
57255
 
57308
- case 31:
57309
- manageEntityResponse = _context2.sent;
57256
+ case 22:
57257
+ manageEntityResponse = _context.sent;
57310
57258
  txReceipt = manageEntityResponse.txReceipt;
57311
57259
  responseValues.blockHash = txReceipt.blockHash;
57312
57260
  responseValues.blockNumber = txReceipt.blockNumber;
57313
- responseValues.playlistId = playlistId;
57314
- return _context2.abrupt("return", responseValues);
57261
+ return _context.abrupt("return", responseValues);
57315
57262
 
57316
- case 39:
57317
- _context2.prev = 39;
57318
- _context2.t0 = _context2["catch"](2);
57319
- error = _context2.t0.message;
57263
+ case 29:
57264
+ _context.prev = 29;
57265
+ _context.t0 = _context["catch"](1);
57266
+ error = _context.t0.message;
57320
57267
  responseValues.error = error;
57321
- return _context2.abrupt("return", responseValues);
57268
+ return _context.abrupt("return", responseValues);
57322
57269
 
57323
- case 44:
57270
+ case 34:
57324
57271
  case "end":
57325
- return _context2.stop();
57272
+ return _context.stop();
57326
57273
  }
57327
57274
  }
57328
- }, _callee2, this, [[2, 39]]);
57275
+ }, _callee, this, [[1, 29]]);
57329
57276
  }));
57330
57277
 
57331
- function createPlaylist(_x3) {
57278
+ function createPlaylist(_x) {
57332
57279
  return _createPlaylist.apply(this, arguments);
57333
57280
  }
57334
57281
 
@@ -57341,29 +57288,26 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57341
57288
  }, {
57342
57289
  key: "deletePlaylist",
57343
57290
  value: function () {
57344
- var _deletePlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref2) {
57345
- var playlistId, responseValues, currentUserId, userId, resp, txReceipt, error;
57346
-
57347
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
57291
+ var _deletePlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(playlistId) {
57292
+ var responseValues, userId, resp, txReceipt, error;
57293
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
57348
57294
  while (1) {
57349
- switch (_context3.prev = _context3.next) {
57295
+ switch (_context2.prev = _context2.next) {
57350
57296
  case 0:
57351
- playlistId = _ref2.playlistId;
57352
57297
  responseValues = this.getDefaultPlaylistReponseValues();
57353
- currentUserId = this.userStateManager.getCurrentUserId();
57298
+ userId = this.userStateManager.getCurrentUserId();
57354
57299
 
57355
- if (currentUserId) {
57356
- _context3.next = 6;
57300
+ if (userId) {
57301
+ _context2.next = 5;
57357
57302
  break;
57358
57303
  }
57359
57304
 
57360
57305
  responseValues.error = 'Missing current user ID';
57361
- return _context3.abrupt("return", responseValues);
57306
+ return _context2.abrupt("return", responseValues);
57362
57307
 
57363
- case 6:
57364
- userId = parseInt(currentUserId);
57365
- _context3.prev = 7;
57366
- _context3.next = 10;
57308
+ case 5:
57309
+ _context2.prev = 5;
57310
+ _context2.next = 8;
57367
57311
  return this.manageEntity({
57368
57312
  userId: userId,
57369
57313
  entityType: EntityType.PLAYLIST,
@@ -57372,30 +57316,29 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57372
57316
  metadataMultihash: ''
57373
57317
  });
57374
57318
 
57375
- case 10:
57376
- resp = _context3.sent;
57319
+ case 8:
57320
+ resp = _context2.sent;
57377
57321
  txReceipt = resp.txReceipt;
57378
57322
  responseValues.blockHash = txReceipt.blockHash;
57379
57323
  responseValues.blockNumber = txReceipt.blockNumber;
57380
- responseValues.playlistId = playlistId;
57381
- return _context3.abrupt("return", responseValues);
57324
+ return _context2.abrupt("return", responseValues);
57382
57325
 
57383
- case 18:
57384
- _context3.prev = 18;
57385
- _context3.t0 = _context3["catch"](7);
57386
- error = _context3.t0.message;
57326
+ case 15:
57327
+ _context2.prev = 15;
57328
+ _context2.t0 = _context2["catch"](5);
57329
+ error = _context2.t0.message;
57387
57330
  responseValues.error = error;
57388
- return _context3.abrupt("return", responseValues);
57331
+ return _context2.abrupt("return", responseValues);
57389
57332
 
57390
- case 23:
57333
+ case 20:
57391
57334
  case "end":
57392
- return _context3.stop();
57335
+ return _context2.stop();
57393
57336
  }
57394
57337
  }
57395
- }, _callee3, this, [[7, 18]]);
57338
+ }, _callee2, this, [[5, 15]]);
57396
57339
  }));
57397
57340
 
57398
- function deletePlaylist(_x4) {
57341
+ function deletePlaylist(_x2) {
57399
57342
  return _deletePlaylist.apply(this, arguments);
57400
57343
  }
57401
57344
 
@@ -57403,448 +57346,112 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57403
57346
  }()
57404
57347
  /**
57405
57348
  * Update a playlist using updated data contracts flow
57406
- **/
57349
+ */
57407
57350
 
57408
57351
  }, {
57409
- key: "editPlaylist",
57352
+ key: "updatePlaylist",
57410
57353
  value: function () {
57411
- var _editPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref3) {
57412
- var playlistId, playlistName, description, isAlbum, isPrivate, coverArt, responseValues, _dirCID2, currentUserId, userId, updateAction, entityType, dirCID, updatedPlaylistImage, playlist, existingPlaylistTracks, metadata, _yield$this$creatorNo2, metadataMultihash, resp, txReceipt, error;
57354
+ var _updatePlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(playlist) {
57355
+ var responseValues, _playlist$artwork2, _dirCID2, userId, updateAction, entityType, dirCID, updatedPlaylistImage, trackIds, metadata, _yield$this$creatorNo2, metadataMultihash, resp, txReceipt, error;
57413
57356
 
57414
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
57357
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
57415
57358
  while (1) {
57416
- switch (_context4.prev = _context4.next) {
57359
+ switch (_context3.prev = _context3.next) {
57417
57360
  case 0:
57418
- playlistId = _ref3.playlistId, playlistName = _ref3.playlistName, description = _ref3.description, isAlbum = _ref3.isAlbum, isPrivate = _ref3.isPrivate, coverArt = _ref3.coverArt;
57419
57361
  responseValues = this.getDefaultPlaylistReponseValues();
57420
- _context4.prev = 2;
57421
- currentUserId = this.userStateManager.getCurrentUserId();
57362
+ _context3.prev = 1;
57363
+ userId = this.userStateManager.getCurrentUserId();
57422
57364
 
57423
- if (!(!playlistId || playlistId === undefined)) {
57424
- _context4.next = 7;
57365
+ if (!(!playlist || playlist === undefined)) {
57366
+ _context3.next = 6;
57425
57367
  break;
57426
57368
  }
57427
57369
 
57428
- responseValues.error = 'Missing current playlistId';
57429
- return _context4.abrupt("return", responseValues);
57370
+ responseValues.error = 'Missing current playlist';
57371
+ return _context3.abrupt("return", responseValues);
57430
57372
 
57431
- case 7:
57432
- if (currentUserId) {
57433
- _context4.next = 10;
57373
+ case 6:
57374
+ if (userId) {
57375
+ _context3.next = 9;
57434
57376
  break;
57435
57377
  }
57436
57378
 
57437
57379
  responseValues.error = 'Missing current user ID';
57438
- return _context4.abrupt("return", responseValues);
57380
+ return _context3.abrupt("return", responseValues);
57439
57381
 
57440
- case 10:
57441
- userId = parseInt(currentUserId);
57382
+ case 9:
57442
57383
  updateAction = Action.UPDATE;
57443
57384
  entityType = EntityType.PLAYLIST;
57444
57385
  this.REQUIRES(Services.CREATOR_NODE);
57445
57386
 
57446
- if (!coverArt) {
57447
- _context4.next = 19;
57387
+ if (!(playlist !== null && playlist !== void 0 && (_playlist$artwork2 = playlist.artwork) !== null && _playlist$artwork2 !== void 0 && _playlist$artwork2.file)) {
57388
+ _context3.next = 17;
57448
57389
  break;
57449
57390
  }
57450
57391
 
57451
- _context4.next = 17;
57452
- return this.creatorNode.uploadImage(coverArt, true // square
57392
+ _context3.next = 15;
57393
+ return this.creatorNode.uploadImage(playlist.artwork.file, true // square
57453
57394
  );
57454
57395
 
57455
- case 17:
57456
- updatedPlaylistImage = _context4.sent;
57396
+ case 15:
57397
+ updatedPlaylistImage = _context3.sent;
57457
57398
  dirCID = updatedPlaylistImage.dirCID;
57458
57399
 
57459
- case 19:
57460
- _context4.next = 21;
57461
- return this.getFullPlaylist(playlistId, userId);
57462
-
57463
- case 21:
57464
- playlist = _context4.sent;
57465
- existingPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57466
- metadata = {
57467
- playlist_id: playlistId,
57468
- playlist_contents: {
57469
- track_ids: existingPlaylistTracks
57470
- },
57471
- playlist_name: playlistName !== null && playlistName !== void 0 ? playlistName : playlist.playlist_name,
57472
- playlist_image_sizes_multihash: (_dirCID2 = dirCID) !== null && _dirCID2 !== void 0 ? _dirCID2 : playlist.cover_art,
57473
- description: description !== null && description !== void 0 ? description : playlist.description,
57474
- is_album: isAlbum !== null && isAlbum !== void 0 ? isAlbum : playlist.is_album,
57475
- is_private: isPrivate !== null && isPrivate !== void 0 ? isPrivate : playlist.is_private
57476
- };
57477
- _context4.next = 26;
57478
- return this.creatorNode.uploadPlaylistMetadata(metadata);
57479
-
57480
- case 26:
57481
- _yield$this$creatorNo2 = _context4.sent;
57482
- metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
57483
- _context4.next = 30;
57484
- return this.manageEntity({
57485
- userId: userId,
57486
- entityType: entityType,
57487
- entityId: playlistId,
57488
- action: updateAction,
57489
- metadataMultihash: metadataMultihash
57490
- });
57491
-
57492
- case 30:
57493
- resp = _context4.sent;
57494
- txReceipt = resp.txReceipt;
57495
- responseValues.blockHash = txReceipt.blockHash;
57496
- responseValues.blockNumber = txReceipt.blockNumber;
57497
- responseValues.playlistId = playlistId;
57498
- return _context4.abrupt("return", responseValues);
57499
-
57500
- case 38:
57501
- _context4.prev = 38;
57502
- _context4.t0 = _context4["catch"](2);
57503
- error = _context4.t0.message;
57504
- responseValues.error = error;
57505
- return _context4.abrupt("return", responseValues);
57506
-
57507
- case 43:
57508
- case "end":
57509
- return _context4.stop();
57510
- }
57511
- }
57512
- }, _callee4, this, [[2, 38]]);
57513
- }));
57514
-
57515
- function editPlaylist(_x5) {
57516
- return _editPlaylist.apply(this, arguments);
57517
- }
57518
-
57519
- return editPlaylist;
57520
- }()
57521
- }, {
57522
- key: "addPlaylistTrack",
57523
- value: function () {
57524
- var _addPlaylistTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref4) {
57525
- var playlistId, trackId, timestamp, responseValues, currentUserId, userId, updateAction, entityType, playlist, updatedPlaylistTracks, metadata, _yield$this$creatorNo3, metadataMultihash, resp, txReceipt, error;
57526
-
57527
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
57528
- while (1) {
57529
- switch (_context5.prev = _context5.next) {
57530
- case 0:
57531
- playlistId = _ref4.playlistId, trackId = _ref4.trackId, timestamp = _ref4.timestamp;
57532
- responseValues = this.getDefaultPlaylistReponseValues();
57533
- _context5.prev = 2;
57534
- currentUserId = this.userStateManager.getCurrentUserId();
57535
-
57536
- if (!(!playlistId || playlistId === undefined)) {
57537
- _context5.next = 7;
57538
- break;
57539
- }
57540
-
57541
- responseValues.error = 'Missing current playlistId';
57542
- return _context5.abrupt("return", responseValues);
57543
-
57544
- case 7:
57545
- if (currentUserId) {
57546
- _context5.next = 10;
57547
- break;
57548
- }
57549
-
57550
- responseValues.error = 'Missing current user ID';
57551
- return _context5.abrupt("return", responseValues);
57552
-
57553
- case 10:
57554
- userId = parseInt(currentUserId);
57555
- updateAction = Action.UPDATE;
57556
- entityType = EntityType.PLAYLIST;
57557
- this.REQUIRES(Services.CREATOR_NODE);
57558
- _context5.next = 16;
57559
- return this.getFullPlaylist(playlistId, userId);
57560
-
57561
- case 16:
57562
- playlist = _context5.sent;
57563
- updatedPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57564
- updatedPlaylistTracks.push({
57565
- track: trackId,
57566
- time: timestamp
57567
- });
57568
- metadata = {
57569
- playlist_id: playlistId,
57570
- playlist_contents: {
57571
- track_ids: updatedPlaylistTracks
57572
- },
57573
- playlist_name: playlist.playlist_name,
57574
- playlist_image_sizes_multihash: playlist.cover_art,
57575
- description: playlist.description,
57576
- is_album: playlist.is_album,
57577
- is_private: playlist.is_private
57578
- };
57579
- _context5.next = 22;
57580
- return this.creatorNode.uploadPlaylistMetadata(metadata);
57581
-
57582
- case 22:
57583
- _yield$this$creatorNo3 = _context5.sent;
57584
- metadataMultihash = _yield$this$creatorNo3.metadataMultihash;
57585
- _context5.next = 26;
57586
- return this.manageEntity({
57587
- userId: userId,
57588
- entityType: entityType,
57589
- entityId: playlistId,
57590
- action: updateAction,
57591
- metadataMultihash: metadataMultihash
57592
- });
57593
-
57594
- case 26:
57595
- resp = _context5.sent;
57596
- txReceipt = resp.txReceipt;
57597
- responseValues.blockHash = txReceipt.blockHash;
57598
- responseValues.blockNumber = txReceipt.blockNumber;
57599
- responseValues.playlistId = playlistId;
57600
- return _context5.abrupt("return", responseValues);
57601
-
57602
- case 34:
57603
- _context5.prev = 34;
57604
- _context5.t0 = _context5["catch"](2);
57605
- error = _context5.t0.message;
57606
- responseValues.error = error;
57607
- return _context5.abrupt("return", responseValues);
57608
-
57609
- case 39:
57610
- case "end":
57611
- return _context5.stop();
57612
- }
57613
- }
57614
- }, _callee5, this, [[2, 34]]);
57615
- }));
57616
-
57617
- function addPlaylistTrack(_x6) {
57618
- return _addPlaylistTrack.apply(this, arguments);
57619
- }
57620
-
57621
- return addPlaylistTrack;
57622
- }()
57623
- }, {
57624
- key: "deletePlaylistTrack",
57625
- value: function () {
57626
- var _deletePlaylistTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(_ref5) {
57627
- var playlistId, trackId, timestamp, responseValues, currentUserId, userId, updateAction, entityType, playlist, existingPlaylistTracks, updatedTrackIds, metadata, _yield$this$creatorNo4, metadataMultihash, resp, txReceipt, error;
57628
-
57629
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
57630
- while (1) {
57631
- switch (_context6.prev = _context6.next) {
57632
- case 0:
57633
- playlistId = _ref5.playlistId, trackId = _ref5.trackId, timestamp = _ref5.timestamp;
57634
- responseValues = this.getDefaultPlaylistReponseValues();
57635
- _context6.prev = 2;
57636
- currentUserId = this.userStateManager.getCurrentUserId();
57637
-
57638
- if (!(!playlistId || playlistId === undefined)) {
57639
- _context6.next = 7;
57640
- break;
57641
- }
57642
-
57643
- responseValues.error = 'Missing current playlistId';
57644
- return _context6.abrupt("return", responseValues);
57645
-
57646
- case 7:
57647
- if (currentUserId) {
57648
- _context6.next = 10;
57649
- break;
57650
- }
57651
-
57652
- responseValues.error = 'Missing current user ID';
57653
- return _context6.abrupt("return", responseValues);
57654
-
57655
- case 10:
57656
- userId = parseInt(currentUserId);
57657
- updateAction = Action.UPDATE;
57658
- entityType = EntityType.PLAYLIST;
57659
- this.REQUIRES(Services.CREATOR_NODE);
57660
- _context6.next = 16;
57661
- return this.getFullPlaylist(playlistId, userId);
57662
-
57663
- case 16:
57664
- playlist = _context6.sent;
57665
- existingPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57666
- updatedTrackIds = existingPlaylistTracks.filter(function (trackObj) {
57667
- var _ref6;
57668
-
57669
- return (_ref6 = trackObj.track !== trackId && timestamp !== trackObj.metadata_time) !== null && _ref6 !== void 0 ? _ref6 : trackObj.time;
57670
- });
57400
+ case 17:
57401
+ trackIds = this.mapTimestamps(playlist.playlist_contents.track_ids);
57671
57402
  metadata = {
57672
- playlist_id: playlistId,
57403
+ playlist_id: playlist.playlist_id,
57673
57404
  playlist_contents: {
57674
- track_ids: updatedTrackIds
57405
+ track_ids: trackIds
57675
57406
  },
57676
57407
  playlist_name: playlist.playlist_name,
57677
- playlist_image_sizes_multihash: playlist.cover_art,
57408
+ playlist_image_sizes_multihash: (_dirCID2 = dirCID) !== null && _dirCID2 !== void 0 ? _dirCID2 : playlist.cover_art_sizes,
57678
57409
  description: playlist.description,
57679
57410
  is_album: playlist.is_album,
57680
57411
  is_private: playlist.is_private
57681
57412
  };
57682
- _context6.next = 22;
57413
+ _context3.next = 21;
57683
57414
  return this.creatorNode.uploadPlaylistMetadata(metadata);
57684
57415
 
57685
- case 22:
57686
- _yield$this$creatorNo4 = _context6.sent;
57687
- metadataMultihash = _yield$this$creatorNo4.metadataMultihash;
57688
- _context6.next = 26;
57416
+ case 21:
57417
+ _yield$this$creatorNo2 = _context3.sent;
57418
+ metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
57419
+ _context3.next = 25;
57689
57420
  return this.manageEntity({
57690
57421
  userId: userId,
57691
57422
  entityType: entityType,
57692
- entityId: playlistId,
57423
+ entityId: playlist.playlist_id,
57693
57424
  action: updateAction,
57694
57425
  metadataMultihash: metadataMultihash
57695
57426
  });
57696
57427
 
57697
- case 26:
57698
- resp = _context6.sent;
57699
- txReceipt = resp.txReceipt;
57700
- responseValues.blockHash = txReceipt.blockHash;
57701
- responseValues.blockNumber = txReceipt.blockNumber;
57702
- responseValues.playlistId = playlistId;
57703
- return _context6.abrupt("return", responseValues);
57704
-
57705
- case 34:
57706
- _context6.prev = 34;
57707
- _context6.t0 = _context6["catch"](2);
57708
- error = _context6.t0.message;
57709
- responseValues.error = error;
57710
- return _context6.abrupt("return", responseValues);
57711
-
57712
- case 39:
57713
- case "end":
57714
- return _context6.stop();
57715
- }
57716
- }
57717
- }, _callee6, this, [[2, 34]]);
57718
- }));
57719
-
57720
- function deletePlaylistTrack(_x7) {
57721
- return _deletePlaylistTrack.apply(this, arguments);
57722
- }
57723
-
57724
- return deletePlaylistTrack;
57725
- }()
57726
- /**
57727
- * Update a playlist using updated data contracts flow
57728
- **/
57729
-
57730
- }, {
57731
- key: "orderPlaylist",
57732
- value: function () {
57733
- var _orderPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(_ref7) {
57734
- var playlistId, trackIds, responseValues, currentUserId, userId, updateAction, entityType, playlist, existingPlaylistTracks, trackIdsWithTimes, trackIdTimes, metadata, _yield$this$creatorNo5, metadataMultihash, resp, txReceipt, error;
57735
-
57736
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
57737
- while (1) {
57738
- switch (_context7.prev = _context7.next) {
57739
- case 0:
57740
- playlistId = _ref7.playlistId, trackIds = _ref7.trackIds;
57741
- responseValues = this.getDefaultPlaylistReponseValues();
57742
- _context7.prev = 2;
57743
- currentUserId = this.userStateManager.getCurrentUserId();
57744
-
57745
- if (!(!playlistId || playlistId === undefined)) {
57746
- _context7.next = 7;
57747
- break;
57748
- }
57749
-
57750
- responseValues.error = 'Missing current playlistId';
57751
- return _context7.abrupt("return", responseValues);
57752
-
57753
- case 7:
57754
- if (currentUserId) {
57755
- _context7.next = 10;
57756
- break;
57757
- }
57758
-
57759
- responseValues.error = 'Missing current user ID';
57760
- return _context7.abrupt("return", responseValues);
57761
-
57762
- case 10:
57763
- userId = parseInt(currentUserId);
57764
- updateAction = Action.UPDATE;
57765
- entityType = EntityType.PLAYLIST;
57766
- this.REQUIRES(Services.CREATOR_NODE);
57767
- _context7.next = 16;
57768
- return this.getFullPlaylist(playlistId, userId);
57769
-
57770
- case 16:
57771
- playlist = _context7.sent;
57772
- existingPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57773
- trackIdsWithTimes = [];
57774
- trackIdTimes = {};
57775
- existingPlaylistTracks.forEach(function (trackObj) {
57776
- var _trackObj$metadata_ti2;
57777
-
57778
- var trackId = trackObj.track;
57779
- var timestamp = (_trackObj$metadata_ti2 = trackObj.metadata_time) !== null && _trackObj$metadata_ti2 !== void 0 ? _trackObj$metadata_ti2 : trackObj.time;
57780
-
57781
- if (trackId in trackIdTimes) {
57782
- trackIdTimes[trackId].push(timestamp);
57783
- } else {
57784
- trackIdTimes[trackId] = [timestamp];
57785
- }
57786
- }); // new tracks default to currentBlock timestamp
57787
-
57788
- trackIdsWithTimes = trackIds.map(function (trackId) {
57789
- return {
57790
- track: trackId,
57791
- time: trackIdTimes[trackId].pop()
57792
- };
57793
- });
57794
- metadata = {
57795
- playlist_id: playlistId,
57796
- playlist_contents: {
57797
- track_ids: trackIdsWithTimes
57798
- },
57799
- playlist_name: playlist.playlist_name,
57800
- playlist_image_sizes_multihash: playlist.cover_art,
57801
- description: playlist.description,
57802
- is_album: playlist.is_album,
57803
- is_private: playlist.is_private
57804
- };
57805
- _context7.next = 25;
57806
- return this.creatorNode.uploadPlaylistMetadata(metadata);
57807
-
57808
57428
  case 25:
57809
- _yield$this$creatorNo5 = _context7.sent;
57810
- metadataMultihash = _yield$this$creatorNo5.metadataMultihash;
57811
- _context7.next = 29;
57812
- return this.manageEntity({
57813
- userId: userId,
57814
- entityType: entityType,
57815
- entityId: playlistId,
57816
- action: updateAction,
57817
- metadataMultihash: metadataMultihash
57818
- });
57819
-
57820
- case 29:
57821
- resp = _context7.sent;
57429
+ resp = _context3.sent;
57822
57430
  txReceipt = resp.txReceipt;
57823
57431
  responseValues.blockHash = txReceipt.blockHash;
57824
57432
  responseValues.blockNumber = txReceipt.blockNumber;
57825
- responseValues.playlistId = playlistId;
57826
- return _context7.abrupt("return", responseValues);
57433
+ return _context3.abrupt("return", responseValues);
57827
57434
 
57828
- case 37:
57829
- _context7.prev = 37;
57830
- _context7.t0 = _context7["catch"](2);
57831
- error = _context7.t0.message;
57435
+ case 32:
57436
+ _context3.prev = 32;
57437
+ _context3.t0 = _context3["catch"](1);
57438
+ error = _context3.t0.message;
57832
57439
  responseValues.error = error;
57833
- return _context7.abrupt("return", responseValues);
57440
+ return _context3.abrupt("return", responseValues);
57834
57441
 
57835
- case 42:
57442
+ case 37:
57836
57443
  case "end":
57837
- return _context7.stop();
57444
+ return _context3.stop();
57838
57445
  }
57839
57446
  }
57840
- }, _callee7, this, [[2, 37]]);
57447
+ }, _callee3, this, [[1, 32]]);
57841
57448
  }));
57842
57449
 
57843
- function orderPlaylist(_x8) {
57844
- return _orderPlaylist.apply(this, arguments);
57450
+ function updatePlaylist(_x3) {
57451
+ return _updatePlaylist.apply(this, arguments);
57845
57452
  }
57846
57453
 
57847
- return orderPlaylist;
57454
+ return updatePlaylist;
57848
57455
  }()
57849
57456
  /**
57850
57457
  * Manage an entity with the updated data contract flow
@@ -57854,44 +57461,44 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57854
57461
  }, {
57855
57462
  key: "manageEntity",
57856
57463
  value: function () {
57857
- var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(_ref8) {
57464
+ var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref) {
57858
57465
  var userId, entityType, entityId, action, metadataMultihash, error, resp, _this$contracts$Entit;
57859
57466
 
57860
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
57467
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
57861
57468
  while (1) {
57862
- switch (_context8.prev = _context8.next) {
57469
+ switch (_context4.prev = _context4.next) {
57863
57470
  case 0:
57864
- userId = _ref8.userId, entityType = _ref8.entityType, entityId = _ref8.entityId, action = _ref8.action, metadataMultihash = _ref8.metadataMultihash;
57471
+ userId = _ref.userId, entityType = _ref.entityType, entityId = _ref.entityId, action = _ref.action, metadataMultihash = _ref.metadataMultihash;
57865
57472
  error = null;
57866
- _context8.prev = 2;
57867
- _context8.next = 5;
57473
+ _context4.prev = 2;
57474
+ _context4.next = 5;
57868
57475
  return (_this$contracts$Entit = this.contracts.EntityManagerClient) === null || _this$contracts$Entit === void 0 ? void 0 : _this$contracts$Entit.manageEntity(userId, entityType, entityId, action, metadataMultihash);
57869
57476
 
57870
57477
  case 5:
57871
- resp = _context8.sent;
57872
- return _context8.abrupt("return", {
57478
+ resp = _context4.sent;
57479
+ return _context4.abrupt("return", {
57873
57480
  txReceipt: resp.txReceipt,
57874
57481
  error: error
57875
57482
  });
57876
57483
 
57877
57484
  case 9:
57878
- _context8.prev = 9;
57879
- _context8.t0 = _context8["catch"](2);
57880
- error = _context8.t0.message;
57881
- return _context8.abrupt("return", {
57485
+ _context4.prev = 9;
57486
+ _context4.t0 = _context4["catch"](2);
57487
+ error = _context4.t0.message;
57488
+ return _context4.abrupt("return", {
57882
57489
  txReceipt: null,
57883
57490
  error: error
57884
57491
  });
57885
57492
 
57886
57493
  case 13:
57887
57494
  case "end":
57888
- return _context8.stop();
57495
+ return _context4.stop();
57889
57496
  }
57890
57497
  }
57891
- }, _callee8, this, [[2, 9]]);
57498
+ }, _callee4, this, [[2, 9]]);
57892
57499
  }));
57893
57500
 
57894
- function manageEntity(_x9) {
57501
+ function manageEntity(_x4) {
57895
57502
  return _manageEntity.apply(this, arguments);
57896
57503
  }
57897
57504