@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/index.esm.js CHANGED
@@ -33409,9 +33409,9 @@ var formatProviders = function formatProviders(providers) {
33409
33409
  };
33410
33410
 
33411
33411
  var name = "@audius/sdk";
33412
- var version = "0.0.37";
33412
+ var version = "0.0.38";
33413
33413
  var audius = {
33414
- releaseSHA: "ce81e1601506bb4982a2d5617ecf220bc94ba76d"
33414
+ releaseSHA: "74503074cb96dea181ec2b218c5cb6d528c1db86"
33415
33415
  };
33416
33416
  var description = "";
33417
33417
  var main = "dist/index.cjs.js";
@@ -37023,7 +37023,7 @@ var Base = /*#__PURE__*/function () {
37023
37023
  return Base;
37024
37024
  }();
37025
37025
 
37026
- var decodeHashId$2 = Utils.decodeHashId;
37026
+ var decodeHashId$1 = Utils.decodeHashId;
37027
37027
  var GetAttestationError = Object.freeze({
37028
37028
  CHALLENGE_INCOMPLETE: 'CHALLENGE_INCOMPLETE',
37029
37029
  ALREADY_DISBURSED: 'ALREADY_DISBURSED',
@@ -37108,7 +37108,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37108
37108
 
37109
37109
  case 7:
37110
37110
  // Aggregate
37111
- logger.info("submitAndEvaluate: aggregating attestations for userId [".concat(decodeHashId$2(encodedUserId), "], challengeId [").concat(challengeId, "]"));
37111
+ logger.info("submitAndEvaluate: aggregating attestations for userId [".concat(decodeHashId$1(encodedUserId), "], challengeId [").concat(challengeId, "]"));
37112
37112
  phase = AttestationPhases.AGGREGATE_ATTESTATIONS;
37113
37113
  _context.next = 11;
37114
37114
  return this.aggregateAttestations({
@@ -37144,7 +37144,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37144
37144
 
37145
37145
  case 21:
37146
37146
  // Submit
37147
- 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."));
37147
+ 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."));
37148
37148
  fullTokenAmount = new BN(amount * WRAPPED_AUDIO_PRECISION);
37149
37149
  phase = AttestationPhases.SUBMIT_ATTESTATIONS; // @ts-expect-error the return types are a bit strange here
37150
37150
 
@@ -37182,7 +37182,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37182
37182
  break;
37183
37183
  }
37184
37184
 
37185
- logger.warn("submitAndEvaluate: saw repeat senders for userId [".concat(decodeHashId$2(encodedUserId), "] challengeId: [").concat(challengeId, "] with err: ").concat(submitErrorCode, ", breaking up into individual transactions"));
37185
+ logger.warn("submitAndEvaluate: saw repeat senders for userId [".concat(decodeHashId$1(encodedUserId), "] challengeId: [").concat(challengeId, "] with err: ").concat(submitErrorCode, ", breaking up into individual transactions"));
37186
37186
  _context.next = 35;
37187
37187
  return this.solanaWeb3Manager.submitChallengeAttestations({
37188
37188
  attestations: discoveryNodeAttestations,
@@ -37205,7 +37205,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37205
37205
 
37206
37206
  case 38:
37207
37207
  // Evaluate
37208
- logger.info("submitAndEvaluate: evaluating for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$2(encodedUserId), "]"));
37208
+ logger.info("submitAndEvaluate: evaluating for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
37209
37209
  phase = AttestationPhases.EVALUATE_ATTESTATIONS;
37210
37210
  _context.next = 42;
37211
37211
  return this.solanaWeb3Manager.evaluateChallengeAttestations({
@@ -37244,7 +37244,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37244
37244
  _context.t0 = _context["catch"](3);
37245
37245
  err = _context.t0.message;
37246
37246
  log = err === GetAttestationError.COGNITO_FLOW || err === GetAttestationError.HCAPTCHA ? logger.info : logger.error;
37247
- log("submitAndEvaluate: failed for userId: [".concat(decodeHashId$2(encodedUserId), "] challenge-id [").concat(challengeId, "] at phase [").concat(phase, "] with err: ").concat(err));
37247
+ log("submitAndEvaluate: failed for userId: [".concat(decodeHashId$1(encodedUserId), "] challenge-id [").concat(challengeId, "] at phase [").concat(phase, "] with err: ").concat(err));
37248
37248
  return _context.abrupt("return", {
37249
37249
  success: false,
37250
37250
  error: err,
@@ -37359,7 +37359,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37359
37359
  _context2.prev = 25;
37360
37360
  _context2.t0 = _context2["catch"](13);
37361
37361
  err = _context2.t0.message;
37362
- logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$2(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(err));
37362
+ logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(err));
37363
37363
  return _context2.abrupt("return", {
37364
37364
  discoveryNodeAttestations: null,
37365
37365
  aaoAttestation: null,
@@ -37422,7 +37422,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37422
37422
  _context2.prev = 43;
37423
37423
  _context2.t1 = _context2["catch"](30);
37424
37424
  _err = _context2.t1.message;
37425
- logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$2(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(_err));
37425
+ logger.error("Failed to aggregate attestations for user [".concat(decodeHashId$1(encodedUserId), "], challenge-id: [").concat(challengeId, "] with err: ").concat(_err));
37426
37426
  return _context2.abrupt("return", {
37427
37427
  discoveryNodeAttestations: null,
37428
37428
  aaoAttestation: null,
@@ -37480,7 +37480,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37480
37480
  _context3.prev = 10;
37481
37481
  _context3.t0 = _context3["catch"](2);
37482
37482
  err = _context3.t0.message;
37483
- logger.error("Failed to get challenge attestation for userId [".concat(decodeHashId$2(encodedUserId), "] challengeId [").concat(challengeId, "]from ").concat(discoveryProviderEndpoint, " with ").concat(err));
37483
+ logger.error("Failed to get challenge attestation for userId [".concat(decodeHashId$1(encodedUserId), "] challengeId [").concat(challengeId, "]from ").concat(discoveryProviderEndpoint, " with ").concat(err));
37484
37484
  mappedErr = GetAttestationError[err] || GetAttestationError.DISCOVERY_NODE_UNKNOWN_RESPONSE;
37485
37485
  return _context3.abrupt("return", {
37486
37486
  success: null,
@@ -37753,9 +37753,9 @@ var Rewards = /*#__PURE__*/function (_Base) {
37753
37753
 
37754
37754
  case 16:
37755
37755
  if (needsAttestations.length || unrecoverableError) {
37756
- logger.info("Failed to aggregate attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$2(encodedUserId), "]"));
37756
+ logger.info("Failed to aggregate attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
37757
37757
  } else {
37758
- logger.info("Successfully aggregated attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$2(encodedUserId), "]"));
37758
+ logger.info("Successfully aggregated attestations for challenge [".concat(challengeId, "], userId: [").concat(decodeHashId$1(encodedUserId), "]"));
37759
37759
  }
37760
37760
 
37761
37761
  return _context7.abrupt("return", completedAttestations);
@@ -37980,7 +37980,7 @@ var Rewards = /*#__PURE__*/function (_Base) {
37980
37980
  return Rewards;
37981
37981
  }(Base);
37982
37982
 
37983
- var decodeHashId$1 = Utils.decodeHashId; // `BaseRewardsReporter` is intended to be subclassed, and provides
37983
+ var decodeHashId = Utils.decodeHashId; // `BaseRewardsReporter` is intended to be subclassed, and provides
37984
37984
  // "reporting" functionality to RewardsAttester (i.e. posts to Slack if something notable happens)
37985
37985
 
37986
37986
  var BaseRewardsReporter = /*#__PURE__*/function () {
@@ -38984,7 +38984,7 @@ var RewardsAttester = /*#__PURE__*/function () {
38984
38984
  switch (_context17.prev = _context17.next) {
38985
38985
  case 0:
38986
38986
  challengeId = _ref9.challengeId, userId = _ref9.userId, specifier = _ref9.specifier, amount = _ref9.amount, handle = _ref9.handle, wallet = _ref9.wallet, completedBlocknumber = _ref9.completedBlocknumber;
38987
- this.logger.info("Attempting to attest for userId [".concat(decodeHashId$1(userId), "], challengeId: [").concat(challengeId, "], quorum size: [").concat(this.quorumSize, "]}"));
38987
+ this.logger.info("Attempting to attest for userId [".concat(decodeHashId(userId), "], challengeId: [").concat(challengeId, "], quorum size: [").concat(this.quorumSize, "]}"));
38988
38988
  _context17.next = 4;
38989
38989
  return this.libs.Rewards.submitAndEvaluate({
38990
38990
  challengeId: challengeId,
@@ -39015,7 +39015,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39015
39015
  break;
39016
39016
  }
39017
39017
 
39018
- this.logger.info("Successfully attestested for challenge [".concat(challengeId, "] for user [").concat(decodeHashId$1(userId), "], amount [").concat(amount, "]!"));
39018
+ this.logger.info("Successfully attestested for challenge [".concat(challengeId, "] for user [").concat(decodeHashId(userId), "], amount [").concat(amount, "]!"));
39019
39019
  return _context17.abrupt("return", {
39020
39020
  challengeId: challengeId,
39021
39021
  userId: userId,
@@ -39029,7 +39029,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39029
39029
 
39030
39030
  case 13:
39031
39031
  // Handle error path
39032
- 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, "]"));
39032
+ 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, "]"));
39033
39033
  return _context17.abrupt("return", {
39034
39034
  challengeId: challengeId,
39035
39035
  userId: userId,
@@ -39287,7 +39287,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39287
39287
  successful.push(res);
39288
39288
 
39289
39289
  _this5.reporter.reportSuccess({
39290
- userId: (_decodeHashId = decodeHashId$1(res.userId)) !== null && _decodeHashId !== void 0 ? _decodeHashId : -1,
39290
+ userId: (_decodeHashId = decodeHashId(res.userId)) !== null && _decodeHashId !== void 0 ? _decodeHashId : -1,
39291
39291
  challengeId: res.challengeId,
39292
39292
  amount: res.amount,
39293
39293
  specifier: res.specifier
@@ -39308,7 +39308,7 @@ var RewardsAttester = /*#__PURE__*/function () {
39308
39308
  var _decodeHashId2;
39309
39309
 
39310
39310
  var report = {
39311
- userId: (_decodeHashId2 = decodeHashId$1(res.userId)) !== null && _decodeHashId2 !== void 0 ? _decodeHashId2 : -1,
39311
+ userId: (_decodeHashId2 = decodeHashId(res.userId)) !== null && _decodeHashId2 !== void 0 ? _decodeHashId2 : -1,
39312
39312
  challengeId: res.challengeId,
39313
39313
  amount: res.amount,
39314
39314
  error: res.error,
@@ -57079,15 +57079,13 @@ var EntityType;
57079
57079
  (function (EntityType) {
57080
57080
  EntityType["PLAYLIST"] = "Playlist";
57081
57081
  })(EntityType || (EntityType = {}));
57082
-
57083
- var encodeHashId = Utils.encodeHashId,
57084
- decodeHashId = Utils.decodeHashId;
57085
57082
  /*
57086
57083
  API surface for updated data contract interactions.
57087
57084
  Provides simplified entity management in a generic fashion
57088
57085
  Handles metadata + file upload etc. for entities such as Playlist/Track/User
57089
57086
  */
57090
57087
 
57088
+
57091
57089
  var EntityManager = /*#__PURE__*/function (_Base) {
57092
57090
  _inherits(EntityManager, _Base);
57093
57091
 
@@ -57111,46 +57109,15 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57111
57109
  return Math.floor(Math.random() * (max - min) + min);
57112
57110
  }
57113
57111
  }, {
57114
- key: "getFullPlaylist",
57115
- value: function () {
57116
- var _getFullPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(playlistId, userId) {
57117
- var encodedPlaylistId, encodedUserId, playlist;
57118
- return regeneratorRuntime.wrap(function _callee$(_context) {
57119
- while (1) {
57120
- switch (_context.prev = _context.next) {
57121
- case 0:
57122
- encodedPlaylistId = encodeHashId(playlistId);
57123
- encodedUserId = encodeHashId(userId);
57124
- _context.next = 4;
57125
- return this.discoveryProvider.getFullPlaylist(encodedPlaylistId, encodedUserId);
57126
-
57127
- case 4:
57128
- playlist = _context.sent[0];
57129
- return _context.abrupt("return", playlist);
57130
-
57131
- case 6:
57132
- case "end":
57133
- return _context.stop();
57134
- }
57135
- }
57136
- }, _callee, this);
57137
- }));
57138
-
57139
- function getFullPlaylist(_x, _x2) {
57140
- return _getFullPlaylist.apply(this, arguments);
57141
- }
57142
-
57143
- return getFullPlaylist;
57144
- }()
57145
- }, {
57146
- key: "mapAddedTimestamps",
57147
- value: function mapAddedTimestamps(addedTimestamps) {
57112
+ key: "mapTimestamps",
57113
+ value: function mapTimestamps(addedTimestamps) {
57148
57114
  var trackIds = addedTimestamps.map(function (trackObj) {
57149
57115
  var _trackObj$metadata_ti;
57150
57116
 
57151
57117
  return {
57152
- track: decodeHashId(trackObj.track_id),
57153
- time: (_trackObj$metadata_ti = trackObj.metadata_timestamp) !== null && _trackObj$metadata_ti !== void 0 ? _trackObj$metadata_ti : trackObj.timestamp
57118
+ track: trackObj.track,
57119
+ time: (_trackObj$metadata_ti = trackObj.metadata_time) !== null && _trackObj$metadata_ti !== void 0 ? _trackObj$metadata_ti : trackObj.time // default to time for legacy playlists
57120
+
57154
57121
  };
57155
57122
  });
57156
57123
  return trackIds;
@@ -57165,7 +57132,6 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57165
57132
  return {
57166
57133
  blockHash: null,
57167
57134
  blockNumber: null,
57168
- playlistId: null,
57169
57135
  error: null
57170
57136
  };
57171
57137
  }
@@ -57176,113 +57142,94 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57176
57142
  }, {
57177
57143
  key: "createPlaylist",
57178
57144
  value: function () {
57179
- var _createPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref) {
57180
- 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;
57145
+ var _createPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(playlist) {
57146
+ var responseValues, _playlist$artwork, _dirCID, userId, createAction, entityType, dirCID, updatedPlaylistImage, tracks, metadata, _yield$this$creatorNo, metadataMultihash, manageEntityResponse, txReceipt, error;
57181
57147
 
57182
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
57148
+ return regeneratorRuntime.wrap(function _callee$(_context) {
57183
57149
  while (1) {
57184
- switch (_context2.prev = _context2.next) {
57150
+ switch (_context.prev = _context.next) {
57185
57151
  case 0:
57186
- playlistId = _ref.playlistId, playlistName = _ref.playlistName, trackIds = _ref.trackIds, description = _ref.description, isAlbum = _ref.isAlbum, isPrivate = _ref.isPrivate, coverArt = _ref.coverArt, coverArtSizes = _ref.coverArtSizes;
57187
57152
  responseValues = this.getDefaultPlaylistReponseValues();
57188
- _context2.prev = 2;
57189
- currentUserId = this.userStateManager.getCurrentUserId();
57153
+ _context.prev = 1;
57154
+ userId = this.userStateManager.getCurrentUserId();
57190
57155
 
57191
- if (currentUserId) {
57192
- _context2.next = 7;
57156
+ if (userId) {
57157
+ _context.next = 6;
57193
57158
  break;
57194
57159
  }
57195
57160
 
57196
57161
  responseValues.error = 'Missing current user ID';
57197
- return _context2.abrupt("return", responseValues);
57162
+ return _context.abrupt("return", responseValues);
57198
57163
 
57199
- case 7:
57200
- userId = parseInt(currentUserId);
57164
+ case 6:
57201
57165
  createAction = Action.CREATE;
57202
57166
  entityType = EntityType.PLAYLIST;
57203
57167
  this.REQUIRES(Services.CREATOR_NODE);
57204
57168
 
57205
- if (!coverArt) {
57206
- _context2.next = 16;
57169
+ if (!(playlist !== null && playlist !== void 0 && (_playlist$artwork = playlist.artwork) !== null && _playlist$artwork !== void 0 && _playlist$artwork.file)) {
57170
+ _context.next = 14;
57207
57171
  break;
57208
57172
  }
57209
57173
 
57210
- _context2.next = 14;
57211
- return this.creatorNode.uploadImage(coverArt, true // square
57174
+ _context.next = 12;
57175
+ return this.creatorNode.uploadImage(playlist.artwork.file, true // square
57212
57176
  );
57213
57177
 
57214
- case 14:
57215
- updatedPlaylistImage = _context2.sent;
57178
+ case 12:
57179
+ updatedPlaylistImage = _context.sent;
57216
57180
  dirCID = updatedPlaylistImage.dirCID;
57217
57181
 
57218
- case 16:
57219
- web3 = this.web3Manager.getWeb3();
57220
- _context2.next = 19;
57221
- return web3.eth.getBlockNumber();
57222
-
57223
- case 19:
57224
- currentBlockNumber = _context2.sent;
57225
- _context2.next = 22;
57226
- return web3.eth.getBlock(currentBlockNumber);
57227
-
57228
- case 22:
57229
- currentBlock = _context2.sent;
57230
- tracks = trackIds.map(function (trackId) {
57231
- return {
57232
- track: trackId,
57233
- time: currentBlock.timestamp
57234
- };
57235
- });
57182
+ case 14:
57183
+ tracks = this.mapTimestamps(playlist.playlist_contents.track_ids);
57236
57184
  metadata = {
57237
- playlist_id: playlistId,
57185
+ playlist_id: playlist.playlist_id,
57238
57186
  playlist_contents: {
57239
57187
  track_ids: tracks
57240
57188
  },
57241
- playlist_name: playlistName,
57242
- playlist_image_sizes_multihash: (_dirCID = dirCID) !== null && _dirCID !== void 0 ? _dirCID : coverArtSizes,
57243
- description: description,
57244
- is_album: isAlbum,
57245
- is_private: isPrivate
57189
+ playlist_name: playlist.playlist_name,
57190
+ playlist_image_sizes_multihash: (_dirCID = dirCID) !== null && _dirCID !== void 0 ? _dirCID : playlist.cover_art_sizes,
57191
+ description: playlist.description,
57192
+ is_album: playlist.is_album,
57193
+ is_private: playlist.is_private
57246
57194
  };
57247
- _context2.next = 27;
57195
+ _context.next = 18;
57248
57196
  return this.creatorNode.uploadPlaylistMetadata(metadata);
57249
57197
 
57250
- case 27:
57251
- _yield$this$creatorNo = _context2.sent;
57198
+ case 18:
57199
+ _yield$this$creatorNo = _context.sent;
57252
57200
  metadataMultihash = _yield$this$creatorNo.metadataMultihash;
57253
- _context2.next = 31;
57201
+ _context.next = 22;
57254
57202
  return this.manageEntity({
57255
57203
  userId: userId,
57256
57204
  entityType: entityType,
57257
- entityId: playlistId,
57205
+ entityId: playlist.playlist_id,
57258
57206
  action: createAction,
57259
57207
  metadataMultihash: metadataMultihash
57260
57208
  });
57261
57209
 
57262
- case 31:
57263
- manageEntityResponse = _context2.sent;
57210
+ case 22:
57211
+ manageEntityResponse = _context.sent;
57264
57212
  txReceipt = manageEntityResponse.txReceipt;
57265
57213
  responseValues.blockHash = txReceipt.blockHash;
57266
57214
  responseValues.blockNumber = txReceipt.blockNumber;
57267
- responseValues.playlistId = playlistId;
57268
- return _context2.abrupt("return", responseValues);
57215
+ return _context.abrupt("return", responseValues);
57269
57216
 
57270
- case 39:
57271
- _context2.prev = 39;
57272
- _context2.t0 = _context2["catch"](2);
57273
- error = _context2.t0.message;
57217
+ case 29:
57218
+ _context.prev = 29;
57219
+ _context.t0 = _context["catch"](1);
57220
+ error = _context.t0.message;
57274
57221
  responseValues.error = error;
57275
- return _context2.abrupt("return", responseValues);
57222
+ return _context.abrupt("return", responseValues);
57276
57223
 
57277
- case 44:
57224
+ case 34:
57278
57225
  case "end":
57279
- return _context2.stop();
57226
+ return _context.stop();
57280
57227
  }
57281
57228
  }
57282
- }, _callee2, this, [[2, 39]]);
57229
+ }, _callee, this, [[1, 29]]);
57283
57230
  }));
57284
57231
 
57285
- function createPlaylist(_x3) {
57232
+ function createPlaylist(_x) {
57286
57233
  return _createPlaylist.apply(this, arguments);
57287
57234
  }
57288
57235
 
@@ -57295,29 +57242,26 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57295
57242
  }, {
57296
57243
  key: "deletePlaylist",
57297
57244
  value: function () {
57298
- var _deletePlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref2) {
57299
- var playlistId, responseValues, currentUserId, userId, resp, txReceipt, error;
57300
-
57301
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
57245
+ var _deletePlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(playlistId) {
57246
+ var responseValues, userId, resp, txReceipt, error;
57247
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
57302
57248
  while (1) {
57303
- switch (_context3.prev = _context3.next) {
57249
+ switch (_context2.prev = _context2.next) {
57304
57250
  case 0:
57305
- playlistId = _ref2.playlistId;
57306
57251
  responseValues = this.getDefaultPlaylistReponseValues();
57307
- currentUserId = this.userStateManager.getCurrentUserId();
57252
+ userId = this.userStateManager.getCurrentUserId();
57308
57253
 
57309
- if (currentUserId) {
57310
- _context3.next = 6;
57254
+ if (userId) {
57255
+ _context2.next = 5;
57311
57256
  break;
57312
57257
  }
57313
57258
 
57314
57259
  responseValues.error = 'Missing current user ID';
57315
- return _context3.abrupt("return", responseValues);
57260
+ return _context2.abrupt("return", responseValues);
57316
57261
 
57317
- case 6:
57318
- userId = parseInt(currentUserId);
57319
- _context3.prev = 7;
57320
- _context3.next = 10;
57262
+ case 5:
57263
+ _context2.prev = 5;
57264
+ _context2.next = 8;
57321
57265
  return this.manageEntity({
57322
57266
  userId: userId,
57323
57267
  entityType: EntityType.PLAYLIST,
@@ -57326,30 +57270,29 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57326
57270
  metadataMultihash: ''
57327
57271
  });
57328
57272
 
57329
- case 10:
57330
- resp = _context3.sent;
57273
+ case 8:
57274
+ resp = _context2.sent;
57331
57275
  txReceipt = resp.txReceipt;
57332
57276
  responseValues.blockHash = txReceipt.blockHash;
57333
57277
  responseValues.blockNumber = txReceipt.blockNumber;
57334
- responseValues.playlistId = playlistId;
57335
- return _context3.abrupt("return", responseValues);
57278
+ return _context2.abrupt("return", responseValues);
57336
57279
 
57337
- case 18:
57338
- _context3.prev = 18;
57339
- _context3.t0 = _context3["catch"](7);
57340
- error = _context3.t0.message;
57280
+ case 15:
57281
+ _context2.prev = 15;
57282
+ _context2.t0 = _context2["catch"](5);
57283
+ error = _context2.t0.message;
57341
57284
  responseValues.error = error;
57342
- return _context3.abrupt("return", responseValues);
57285
+ return _context2.abrupt("return", responseValues);
57343
57286
 
57344
- case 23:
57287
+ case 20:
57345
57288
  case "end":
57346
- return _context3.stop();
57289
+ return _context2.stop();
57347
57290
  }
57348
57291
  }
57349
- }, _callee3, this, [[7, 18]]);
57292
+ }, _callee2, this, [[5, 15]]);
57350
57293
  }));
57351
57294
 
57352
- function deletePlaylist(_x4) {
57295
+ function deletePlaylist(_x2) {
57353
57296
  return _deletePlaylist.apply(this, arguments);
57354
57297
  }
57355
57298
 
@@ -57357,448 +57300,112 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57357
57300
  }()
57358
57301
  /**
57359
57302
  * Update a playlist using updated data contracts flow
57360
- **/
57303
+ */
57361
57304
 
57362
57305
  }, {
57363
- key: "editPlaylist",
57306
+ key: "updatePlaylist",
57364
57307
  value: function () {
57365
- var _editPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref3) {
57366
- 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;
57308
+ var _updatePlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(playlist) {
57309
+ var responseValues, _playlist$artwork2, _dirCID2, userId, updateAction, entityType, dirCID, updatedPlaylistImage, trackIds, metadata, _yield$this$creatorNo2, metadataMultihash, resp, txReceipt, error;
57367
57310
 
57368
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
57311
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
57369
57312
  while (1) {
57370
- switch (_context4.prev = _context4.next) {
57313
+ switch (_context3.prev = _context3.next) {
57371
57314
  case 0:
57372
- playlistId = _ref3.playlistId, playlistName = _ref3.playlistName, description = _ref3.description, isAlbum = _ref3.isAlbum, isPrivate = _ref3.isPrivate, coverArt = _ref3.coverArt;
57373
57315
  responseValues = this.getDefaultPlaylistReponseValues();
57374
- _context4.prev = 2;
57375
- currentUserId = this.userStateManager.getCurrentUserId();
57316
+ _context3.prev = 1;
57317
+ userId = this.userStateManager.getCurrentUserId();
57376
57318
 
57377
- if (!(!playlistId || playlistId === undefined)) {
57378
- _context4.next = 7;
57319
+ if (!(!playlist || playlist === undefined)) {
57320
+ _context3.next = 6;
57379
57321
  break;
57380
57322
  }
57381
57323
 
57382
- responseValues.error = 'Missing current playlistId';
57383
- return _context4.abrupt("return", responseValues);
57324
+ responseValues.error = 'Missing current playlist';
57325
+ return _context3.abrupt("return", responseValues);
57384
57326
 
57385
- case 7:
57386
- if (currentUserId) {
57387
- _context4.next = 10;
57327
+ case 6:
57328
+ if (userId) {
57329
+ _context3.next = 9;
57388
57330
  break;
57389
57331
  }
57390
57332
 
57391
57333
  responseValues.error = 'Missing current user ID';
57392
- return _context4.abrupt("return", responseValues);
57334
+ return _context3.abrupt("return", responseValues);
57393
57335
 
57394
- case 10:
57395
- userId = parseInt(currentUserId);
57336
+ case 9:
57396
57337
  updateAction = Action.UPDATE;
57397
57338
  entityType = EntityType.PLAYLIST;
57398
57339
  this.REQUIRES(Services.CREATOR_NODE);
57399
57340
 
57400
- if (!coverArt) {
57401
- _context4.next = 19;
57341
+ if (!(playlist !== null && playlist !== void 0 && (_playlist$artwork2 = playlist.artwork) !== null && _playlist$artwork2 !== void 0 && _playlist$artwork2.file)) {
57342
+ _context3.next = 17;
57402
57343
  break;
57403
57344
  }
57404
57345
 
57405
- _context4.next = 17;
57406
- return this.creatorNode.uploadImage(coverArt, true // square
57346
+ _context3.next = 15;
57347
+ return this.creatorNode.uploadImage(playlist.artwork.file, true // square
57407
57348
  );
57408
57349
 
57409
- case 17:
57410
- updatedPlaylistImage = _context4.sent;
57350
+ case 15:
57351
+ updatedPlaylistImage = _context3.sent;
57411
57352
  dirCID = updatedPlaylistImage.dirCID;
57412
57353
 
57413
- case 19:
57414
- _context4.next = 21;
57415
- return this.getFullPlaylist(playlistId, userId);
57416
-
57417
- case 21:
57418
- playlist = _context4.sent;
57419
- existingPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57420
- metadata = {
57421
- playlist_id: playlistId,
57422
- playlist_contents: {
57423
- track_ids: existingPlaylistTracks
57424
- },
57425
- playlist_name: playlistName !== null && playlistName !== void 0 ? playlistName : playlist.playlist_name,
57426
- playlist_image_sizes_multihash: (_dirCID2 = dirCID) !== null && _dirCID2 !== void 0 ? _dirCID2 : playlist.cover_art,
57427
- description: description !== null && description !== void 0 ? description : playlist.description,
57428
- is_album: isAlbum !== null && isAlbum !== void 0 ? isAlbum : playlist.is_album,
57429
- is_private: isPrivate !== null && isPrivate !== void 0 ? isPrivate : playlist.is_private
57430
- };
57431
- _context4.next = 26;
57432
- return this.creatorNode.uploadPlaylistMetadata(metadata);
57433
-
57434
- case 26:
57435
- _yield$this$creatorNo2 = _context4.sent;
57436
- metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
57437
- _context4.next = 30;
57438
- return this.manageEntity({
57439
- userId: userId,
57440
- entityType: entityType,
57441
- entityId: playlistId,
57442
- action: updateAction,
57443
- metadataMultihash: metadataMultihash
57444
- });
57445
-
57446
- case 30:
57447
- resp = _context4.sent;
57448
- txReceipt = resp.txReceipt;
57449
- responseValues.blockHash = txReceipt.blockHash;
57450
- responseValues.blockNumber = txReceipt.blockNumber;
57451
- responseValues.playlistId = playlistId;
57452
- return _context4.abrupt("return", responseValues);
57453
-
57454
- case 38:
57455
- _context4.prev = 38;
57456
- _context4.t0 = _context4["catch"](2);
57457
- error = _context4.t0.message;
57458
- responseValues.error = error;
57459
- return _context4.abrupt("return", responseValues);
57460
-
57461
- case 43:
57462
- case "end":
57463
- return _context4.stop();
57464
- }
57465
- }
57466
- }, _callee4, this, [[2, 38]]);
57467
- }));
57468
-
57469
- function editPlaylist(_x5) {
57470
- return _editPlaylist.apply(this, arguments);
57471
- }
57472
-
57473
- return editPlaylist;
57474
- }()
57475
- }, {
57476
- key: "addPlaylistTrack",
57477
- value: function () {
57478
- var _addPlaylistTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref4) {
57479
- var playlistId, trackId, timestamp, responseValues, currentUserId, userId, updateAction, entityType, playlist, updatedPlaylistTracks, metadata, _yield$this$creatorNo3, metadataMultihash, resp, txReceipt, error;
57480
-
57481
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
57482
- while (1) {
57483
- switch (_context5.prev = _context5.next) {
57484
- case 0:
57485
- playlistId = _ref4.playlistId, trackId = _ref4.trackId, timestamp = _ref4.timestamp;
57486
- responseValues = this.getDefaultPlaylistReponseValues();
57487
- _context5.prev = 2;
57488
- currentUserId = this.userStateManager.getCurrentUserId();
57489
-
57490
- if (!(!playlistId || playlistId === undefined)) {
57491
- _context5.next = 7;
57492
- break;
57493
- }
57494
-
57495
- responseValues.error = 'Missing current playlistId';
57496
- return _context5.abrupt("return", responseValues);
57497
-
57498
- case 7:
57499
- if (currentUserId) {
57500
- _context5.next = 10;
57501
- break;
57502
- }
57503
-
57504
- responseValues.error = 'Missing current user ID';
57505
- return _context5.abrupt("return", responseValues);
57506
-
57507
- case 10:
57508
- userId = parseInt(currentUserId);
57509
- updateAction = Action.UPDATE;
57510
- entityType = EntityType.PLAYLIST;
57511
- this.REQUIRES(Services.CREATOR_NODE);
57512
- _context5.next = 16;
57513
- return this.getFullPlaylist(playlistId, userId);
57514
-
57515
- case 16:
57516
- playlist = _context5.sent;
57517
- updatedPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57518
- updatedPlaylistTracks.push({
57519
- track: trackId,
57520
- time: timestamp
57521
- });
57522
- metadata = {
57523
- playlist_id: playlistId,
57524
- playlist_contents: {
57525
- track_ids: updatedPlaylistTracks
57526
- },
57527
- playlist_name: playlist.playlist_name,
57528
- playlist_image_sizes_multihash: playlist.cover_art,
57529
- description: playlist.description,
57530
- is_album: playlist.is_album,
57531
- is_private: playlist.is_private
57532
- };
57533
- _context5.next = 22;
57534
- return this.creatorNode.uploadPlaylistMetadata(metadata);
57535
-
57536
- case 22:
57537
- _yield$this$creatorNo3 = _context5.sent;
57538
- metadataMultihash = _yield$this$creatorNo3.metadataMultihash;
57539
- _context5.next = 26;
57540
- return this.manageEntity({
57541
- userId: userId,
57542
- entityType: entityType,
57543
- entityId: playlistId,
57544
- action: updateAction,
57545
- metadataMultihash: metadataMultihash
57546
- });
57547
-
57548
- case 26:
57549
- resp = _context5.sent;
57550
- txReceipt = resp.txReceipt;
57551
- responseValues.blockHash = txReceipt.blockHash;
57552
- responseValues.blockNumber = txReceipt.blockNumber;
57553
- responseValues.playlistId = playlistId;
57554
- return _context5.abrupt("return", responseValues);
57555
-
57556
- case 34:
57557
- _context5.prev = 34;
57558
- _context5.t0 = _context5["catch"](2);
57559
- error = _context5.t0.message;
57560
- responseValues.error = error;
57561
- return _context5.abrupt("return", responseValues);
57562
-
57563
- case 39:
57564
- case "end":
57565
- return _context5.stop();
57566
- }
57567
- }
57568
- }, _callee5, this, [[2, 34]]);
57569
- }));
57570
-
57571
- function addPlaylistTrack(_x6) {
57572
- return _addPlaylistTrack.apply(this, arguments);
57573
- }
57574
-
57575
- return addPlaylistTrack;
57576
- }()
57577
- }, {
57578
- key: "deletePlaylistTrack",
57579
- value: function () {
57580
- var _deletePlaylistTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(_ref5) {
57581
- var playlistId, trackId, timestamp, responseValues, currentUserId, userId, updateAction, entityType, playlist, existingPlaylistTracks, updatedTrackIds, metadata, _yield$this$creatorNo4, metadataMultihash, resp, txReceipt, error;
57582
-
57583
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
57584
- while (1) {
57585
- switch (_context6.prev = _context6.next) {
57586
- case 0:
57587
- playlistId = _ref5.playlistId, trackId = _ref5.trackId, timestamp = _ref5.timestamp;
57588
- responseValues = this.getDefaultPlaylistReponseValues();
57589
- _context6.prev = 2;
57590
- currentUserId = this.userStateManager.getCurrentUserId();
57591
-
57592
- if (!(!playlistId || playlistId === undefined)) {
57593
- _context6.next = 7;
57594
- break;
57595
- }
57596
-
57597
- responseValues.error = 'Missing current playlistId';
57598
- return _context6.abrupt("return", responseValues);
57599
-
57600
- case 7:
57601
- if (currentUserId) {
57602
- _context6.next = 10;
57603
- break;
57604
- }
57605
-
57606
- responseValues.error = 'Missing current user ID';
57607
- return _context6.abrupt("return", responseValues);
57608
-
57609
- case 10:
57610
- userId = parseInt(currentUserId);
57611
- updateAction = Action.UPDATE;
57612
- entityType = EntityType.PLAYLIST;
57613
- this.REQUIRES(Services.CREATOR_NODE);
57614
- _context6.next = 16;
57615
- return this.getFullPlaylist(playlistId, userId);
57616
-
57617
- case 16:
57618
- playlist = _context6.sent;
57619
- existingPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57620
- updatedTrackIds = existingPlaylistTracks.filter(function (trackObj) {
57621
- var _ref6;
57622
-
57623
- return (_ref6 = trackObj.track !== trackId && timestamp !== trackObj.metadata_time) !== null && _ref6 !== void 0 ? _ref6 : trackObj.time;
57624
- });
57354
+ case 17:
57355
+ trackIds = this.mapTimestamps(playlist.playlist_contents.track_ids);
57625
57356
  metadata = {
57626
- playlist_id: playlistId,
57357
+ playlist_id: playlist.playlist_id,
57627
57358
  playlist_contents: {
57628
- track_ids: updatedTrackIds
57359
+ track_ids: trackIds
57629
57360
  },
57630
57361
  playlist_name: playlist.playlist_name,
57631
- playlist_image_sizes_multihash: playlist.cover_art,
57362
+ playlist_image_sizes_multihash: (_dirCID2 = dirCID) !== null && _dirCID2 !== void 0 ? _dirCID2 : playlist.cover_art_sizes,
57632
57363
  description: playlist.description,
57633
57364
  is_album: playlist.is_album,
57634
57365
  is_private: playlist.is_private
57635
57366
  };
57636
- _context6.next = 22;
57367
+ _context3.next = 21;
57637
57368
  return this.creatorNode.uploadPlaylistMetadata(metadata);
57638
57369
 
57639
- case 22:
57640
- _yield$this$creatorNo4 = _context6.sent;
57641
- metadataMultihash = _yield$this$creatorNo4.metadataMultihash;
57642
- _context6.next = 26;
57370
+ case 21:
57371
+ _yield$this$creatorNo2 = _context3.sent;
57372
+ metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
57373
+ _context3.next = 25;
57643
57374
  return this.manageEntity({
57644
57375
  userId: userId,
57645
57376
  entityType: entityType,
57646
- entityId: playlistId,
57377
+ entityId: playlist.playlist_id,
57647
57378
  action: updateAction,
57648
57379
  metadataMultihash: metadataMultihash
57649
57380
  });
57650
57381
 
57651
- case 26:
57652
- resp = _context6.sent;
57653
- txReceipt = resp.txReceipt;
57654
- responseValues.blockHash = txReceipt.blockHash;
57655
- responseValues.blockNumber = txReceipt.blockNumber;
57656
- responseValues.playlistId = playlistId;
57657
- return _context6.abrupt("return", responseValues);
57658
-
57659
- case 34:
57660
- _context6.prev = 34;
57661
- _context6.t0 = _context6["catch"](2);
57662
- error = _context6.t0.message;
57663
- responseValues.error = error;
57664
- return _context6.abrupt("return", responseValues);
57665
-
57666
- case 39:
57667
- case "end":
57668
- return _context6.stop();
57669
- }
57670
- }
57671
- }, _callee6, this, [[2, 34]]);
57672
- }));
57673
-
57674
- function deletePlaylistTrack(_x7) {
57675
- return _deletePlaylistTrack.apply(this, arguments);
57676
- }
57677
-
57678
- return deletePlaylistTrack;
57679
- }()
57680
- /**
57681
- * Update a playlist using updated data contracts flow
57682
- **/
57683
-
57684
- }, {
57685
- key: "orderPlaylist",
57686
- value: function () {
57687
- var _orderPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(_ref7) {
57688
- var playlistId, trackIds, responseValues, currentUserId, userId, updateAction, entityType, playlist, existingPlaylistTracks, trackIdsWithTimes, trackIdTimes, metadata, _yield$this$creatorNo5, metadataMultihash, resp, txReceipt, error;
57689
-
57690
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
57691
- while (1) {
57692
- switch (_context7.prev = _context7.next) {
57693
- case 0:
57694
- playlistId = _ref7.playlistId, trackIds = _ref7.trackIds;
57695
- responseValues = this.getDefaultPlaylistReponseValues();
57696
- _context7.prev = 2;
57697
- currentUserId = this.userStateManager.getCurrentUserId();
57698
-
57699
- if (!(!playlistId || playlistId === undefined)) {
57700
- _context7.next = 7;
57701
- break;
57702
- }
57703
-
57704
- responseValues.error = 'Missing current playlistId';
57705
- return _context7.abrupt("return", responseValues);
57706
-
57707
- case 7:
57708
- if (currentUserId) {
57709
- _context7.next = 10;
57710
- break;
57711
- }
57712
-
57713
- responseValues.error = 'Missing current user ID';
57714
- return _context7.abrupt("return", responseValues);
57715
-
57716
- case 10:
57717
- userId = parseInt(currentUserId);
57718
- updateAction = Action.UPDATE;
57719
- entityType = EntityType.PLAYLIST;
57720
- this.REQUIRES(Services.CREATOR_NODE);
57721
- _context7.next = 16;
57722
- return this.getFullPlaylist(playlistId, userId);
57723
-
57724
- case 16:
57725
- playlist = _context7.sent;
57726
- existingPlaylistTracks = this.mapAddedTimestamps(playlist.added_timestamps);
57727
- trackIdsWithTimes = [];
57728
- trackIdTimes = {};
57729
- existingPlaylistTracks.forEach(function (trackObj) {
57730
- var _trackObj$metadata_ti2;
57731
-
57732
- var trackId = trackObj.track;
57733
- var timestamp = (_trackObj$metadata_ti2 = trackObj.metadata_time) !== null && _trackObj$metadata_ti2 !== void 0 ? _trackObj$metadata_ti2 : trackObj.time;
57734
-
57735
- if (trackId in trackIdTimes) {
57736
- trackIdTimes[trackId].push(timestamp);
57737
- } else {
57738
- trackIdTimes[trackId] = [timestamp];
57739
- }
57740
- }); // new tracks default to currentBlock timestamp
57741
-
57742
- trackIdsWithTimes = trackIds.map(function (trackId) {
57743
- return {
57744
- track: trackId,
57745
- time: trackIdTimes[trackId].pop()
57746
- };
57747
- });
57748
- metadata = {
57749
- playlist_id: playlistId,
57750
- playlist_contents: {
57751
- track_ids: trackIdsWithTimes
57752
- },
57753
- playlist_name: playlist.playlist_name,
57754
- playlist_image_sizes_multihash: playlist.cover_art,
57755
- description: playlist.description,
57756
- is_album: playlist.is_album,
57757
- is_private: playlist.is_private
57758
- };
57759
- _context7.next = 25;
57760
- return this.creatorNode.uploadPlaylistMetadata(metadata);
57761
-
57762
57382
  case 25:
57763
- _yield$this$creatorNo5 = _context7.sent;
57764
- metadataMultihash = _yield$this$creatorNo5.metadataMultihash;
57765
- _context7.next = 29;
57766
- return this.manageEntity({
57767
- userId: userId,
57768
- entityType: entityType,
57769
- entityId: playlistId,
57770
- action: updateAction,
57771
- metadataMultihash: metadataMultihash
57772
- });
57773
-
57774
- case 29:
57775
- resp = _context7.sent;
57383
+ resp = _context3.sent;
57776
57384
  txReceipt = resp.txReceipt;
57777
57385
  responseValues.blockHash = txReceipt.blockHash;
57778
57386
  responseValues.blockNumber = txReceipt.blockNumber;
57779
- responseValues.playlistId = playlistId;
57780
- return _context7.abrupt("return", responseValues);
57387
+ return _context3.abrupt("return", responseValues);
57781
57388
 
57782
- case 37:
57783
- _context7.prev = 37;
57784
- _context7.t0 = _context7["catch"](2);
57785
- error = _context7.t0.message;
57389
+ case 32:
57390
+ _context3.prev = 32;
57391
+ _context3.t0 = _context3["catch"](1);
57392
+ error = _context3.t0.message;
57786
57393
  responseValues.error = error;
57787
- return _context7.abrupt("return", responseValues);
57394
+ return _context3.abrupt("return", responseValues);
57788
57395
 
57789
- case 42:
57396
+ case 37:
57790
57397
  case "end":
57791
- return _context7.stop();
57398
+ return _context3.stop();
57792
57399
  }
57793
57400
  }
57794
- }, _callee7, this, [[2, 37]]);
57401
+ }, _callee3, this, [[1, 32]]);
57795
57402
  }));
57796
57403
 
57797
- function orderPlaylist(_x8) {
57798
- return _orderPlaylist.apply(this, arguments);
57404
+ function updatePlaylist(_x3) {
57405
+ return _updatePlaylist.apply(this, arguments);
57799
57406
  }
57800
57407
 
57801
- return orderPlaylist;
57408
+ return updatePlaylist;
57802
57409
  }()
57803
57410
  /**
57804
57411
  * Manage an entity with the updated data contract flow
@@ -57808,44 +57415,44 @@ var EntityManager = /*#__PURE__*/function (_Base) {
57808
57415
  }, {
57809
57416
  key: "manageEntity",
57810
57417
  value: function () {
57811
- var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(_ref8) {
57418
+ var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref) {
57812
57419
  var userId, entityType, entityId, action, metadataMultihash, error, resp, _this$contracts$Entit;
57813
57420
 
57814
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
57421
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
57815
57422
  while (1) {
57816
- switch (_context8.prev = _context8.next) {
57423
+ switch (_context4.prev = _context4.next) {
57817
57424
  case 0:
57818
- userId = _ref8.userId, entityType = _ref8.entityType, entityId = _ref8.entityId, action = _ref8.action, metadataMultihash = _ref8.metadataMultihash;
57425
+ userId = _ref.userId, entityType = _ref.entityType, entityId = _ref.entityId, action = _ref.action, metadataMultihash = _ref.metadataMultihash;
57819
57426
  error = null;
57820
- _context8.prev = 2;
57821
- _context8.next = 5;
57427
+ _context4.prev = 2;
57428
+ _context4.next = 5;
57822
57429
  return (_this$contracts$Entit = this.contracts.EntityManagerClient) === null || _this$contracts$Entit === void 0 ? void 0 : _this$contracts$Entit.manageEntity(userId, entityType, entityId, action, metadataMultihash);
57823
57430
 
57824
57431
  case 5:
57825
- resp = _context8.sent;
57826
- return _context8.abrupt("return", {
57432
+ resp = _context4.sent;
57433
+ return _context4.abrupt("return", {
57827
57434
  txReceipt: resp.txReceipt,
57828
57435
  error: error
57829
57436
  });
57830
57437
 
57831
57438
  case 9:
57832
- _context8.prev = 9;
57833
- _context8.t0 = _context8["catch"](2);
57834
- error = _context8.t0.message;
57835
- return _context8.abrupt("return", {
57439
+ _context4.prev = 9;
57440
+ _context4.t0 = _context4["catch"](2);
57441
+ error = _context4.t0.message;
57442
+ return _context4.abrupt("return", {
57836
57443
  txReceipt: null,
57837
57444
  error: error
57838
57445
  });
57839
57446
 
57840
57447
  case 13:
57841
57448
  case "end":
57842
- return _context8.stop();
57449
+ return _context4.stop();
57843
57450
  }
57844
57451
  }
57845
- }, _callee8, this, [[2, 9]]);
57452
+ }, _callee4, this, [[2, 9]]);
57846
57453
  }));
57847
57454
 
57848
- function manageEntity(_x9) {
57455
+ function manageEntity(_x4) {
57849
57456
  return _manageEntity.apply(this, arguments);
57850
57457
  }
57851
57458