@eluvio/elv-client-js 4.0.147 → 4.2.0

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.
Files changed (47) hide show
  1. package/dist/ElvClient-min.js +2 -67
  2. package/dist/ElvClient-min.js.LICENSE.txt +72 -0
  3. package/dist/ElvClient-node-min.js +2 -66
  4. package/dist/ElvClient-node-min.js.LICENSE.txt +72 -0
  5. package/dist/ElvFrameClient-min.js +2 -60
  6. package/dist/ElvFrameClient-min.js.LICENSE.txt +72 -0
  7. package/dist/ElvPermissionsClient-min.js +2 -60
  8. package/dist/ElvPermissionsClient-min.js.LICENSE.txt +72 -0
  9. package/dist/ElvWalletClient-min.js +2 -67
  10. package/dist/ElvWalletClient-min.js.LICENSE.txt +72 -0
  11. package/dist/ElvWalletClient-node-min.js +2 -66
  12. package/dist/ElvWalletClient-node-min.js.LICENSE.txt +72 -0
  13. package/dist/src/AuthorizationClient.js +713 -715
  14. package/dist/src/ContentObjectAudit.js +59 -59
  15. package/dist/src/Crypto.js +85 -86
  16. package/dist/src/ElvClient.js +532 -501
  17. package/dist/src/ElvWallet.js +30 -28
  18. package/dist/src/EthClient.js +316 -316
  19. package/dist/src/FrameClient.js +70 -71
  20. package/dist/src/HttpClient.js +60 -60
  21. package/dist/src/Id.js +1 -2
  22. package/dist/src/PermissionsClient.js +501 -489
  23. package/dist/src/RemoteSigner.js +83 -84
  24. package/dist/src/UserProfileClient.js +392 -374
  25. package/dist/src/Utils.js +67 -67
  26. package/dist/src/Validation.js +20 -12
  27. package/dist/src/client/ABRPublishing.js +412 -356
  28. package/dist/src/client/AccessGroups.js +479 -476
  29. package/dist/src/client/ContentAccess.js +1750 -1804
  30. package/dist/src/client/ContentManagement.js +874 -874
  31. package/dist/src/client/Contracts.js +586 -590
  32. package/dist/src/client/Files.js +702 -686
  33. package/dist/src/client/LiveConf.js +3 -5
  34. package/dist/src/client/LiveStream.js +659 -652
  35. package/dist/src/client/NFT.js +16 -16
  36. package/dist/src/client/NTP.js +84 -84
  37. package/dist/src/client/Shares.js +51 -51
  38. package/dist/src/walletClient/ClientMethods.js +979 -953
  39. package/dist/src/walletClient/Notifications.js +14 -14
  40. package/dist/src/walletClient/Profile.js +68 -68
  41. package/dist/src/walletClient/Utils.js +17 -17
  42. package/dist/src/walletClient/index.js +574 -564
  43. package/package.json +17 -16
  44. package/src/client/AccessGroups.js +1 -1
  45. package/testScripts/Test.js +5 -1
  46. package/webpack.config.js +10 -13
  47. package/dist/src/ContentObjectVerification.js +0 -281
@@ -62,7 +62,7 @@ var UserProfileClient = /*#__PURE__*/function () {
62
62
  this.walletAddress = undefined;
63
63
  this.walletAddressRetrieved = false;
64
64
  }
65
- _createClass(UserProfileClient, [{
65
+ return _createClass(UserProfileClient, [{
66
66
  key: "Log",
67
67
  value: function Log(message) {
68
68
  var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -71,62 +71,62 @@ var UserProfileClient = /*#__PURE__*/function () {
71
71
  }, {
72
72
  key: "CreateWallet",
73
73
  value: function () {
74
- var _CreateWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
75
- var balance, walletCreationEvent, abi, libraryId, objectId, createResponse;
76
- return _regeneratorRuntime.wrap(function _callee$(_context) {
74
+ var _CreateWallet = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
75
+ var balance, walletCreationEvent, abi, libraryId, objectId, createResponse, _t, _t2;
76
+ return _regeneratorRuntime.wrap(function (_context) {
77
77
  while (1) switch (_context.prev = _context.next) {
78
78
  case 0:
79
79
  if (!this.creatingWallet) {
80
- _context.next = 6;
80
+ _context.next = 3;
81
81
  break;
82
82
  }
83
83
  case 1:
84
84
  if (!this.creatingWallet) {
85
- _context.next = 6;
85
+ _context.next = 3;
86
86
  break;
87
87
  }
88
- _context.next = 4;
88
+ _context.next = 2;
89
89
  return new Promise(function (resolve) {
90
90
  return setTimeout(resolve, 500);
91
91
  });
92
- case 4:
92
+ case 2:
93
93
  _context.next = 1;
94
94
  break;
95
- case 6:
95
+ case 3:
96
96
  this.creatingWallet = true;
97
- _context.prev = 7;
97
+ _context.prev = 4;
98
98
  if (!(!this.walletAddress || Utils.EqualAddress(this.walletAddress, Utils.nullAddress))) {
99
- _context.next = 23;
99
+ _context.next = 9;
100
100
  break;
101
101
  }
102
102
  this.Log("Creating user wallet for user ".concat(this.client.signer.address));
103
103
 
104
104
  // Don't attempt to create a user wallet if user has no funds
105
- _context.next = 12;
105
+ _context.next = 5;
106
106
  return this.client.GetBalance({
107
107
  address: this.client.signer.address
108
108
  });
109
- case 12:
109
+ case 5:
110
110
  balance = _context.sent;
111
111
  if (!(balance < 0.05)) {
112
- _context.next = 15;
112
+ _context.next = 6;
113
113
  break;
114
114
  }
115
115
  return _context.abrupt("return", undefined);
116
- case 15:
117
- _context.next = 17;
116
+ case 6:
117
+ _context.next = 7;
118
118
  return this.client.CallContractMethodAndWait({
119
119
  contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
120
120
  methodName: "createAccessWallet",
121
121
  methodArgs: []
122
122
  });
123
- case 17:
123
+ case 7:
124
124
  walletCreationEvent = _context.sent;
125
- _context.next = 20;
125
+ _context.next = 8;
126
126
  return this.client.ContractAbi({
127
127
  contractAddress: this.client.contentSpaceAddress
128
128
  });
129
- case 20:
129
+ case 8:
130
130
  abi = _context.sent;
131
131
  this.walletAddress = this.client.ExtractValueFromEvent({
132
132
  abi: abi,
@@ -135,60 +135,60 @@ var UserProfileClient = /*#__PURE__*/function () {
135
135
  eventValue: "wallet"
136
136
  });
137
137
  this.userWalletAddresses[Utils.FormatAddress(this.client.signer.address)] = this.walletAddress;
138
- case 23:
138
+ case 9:
139
139
  // Check if wallet object is created
140
140
  libraryId = this.client.contentSpaceLibraryId;
141
141
  objectId = Utils.AddressToObjectId(this.walletAddress);
142
- _context.prev = 25;
143
- _context.next = 28;
142
+ _context.prev = 10;
143
+ _context.next = 11;
144
144
  return this.client.ContentObject({
145
145
  libraryId: libraryId,
146
146
  objectId: objectId
147
147
  });
148
- case 28:
149
- _context.next = 39;
148
+ case 11:
149
+ _context.next = 14;
150
150
  break;
151
- case 30:
152
- _context.prev = 30;
153
- _context.t0 = _context["catch"](25);
154
- if (!(_context.t0.status === 404)) {
155
- _context.next = 39;
151
+ case 12:
152
+ _context.prev = 12;
153
+ _t = _context["catch"](10);
154
+ if (!(_t.status === 404)) {
155
+ _context.next = 14;
156
156
  break;
157
157
  }
158
158
  this.Log("Creating wallet object for user ".concat(this.client.signer.address));
159
- _context.next = 36;
159
+ _context.next = 13;
160
160
  return this.client.CreateContentObject({
161
161
  libraryId: libraryId,
162
162
  objectId: objectId
163
163
  });
164
- case 36:
164
+ case 13:
165
165
  createResponse = _context.sent;
166
- _context.next = 39;
166
+ _context.next = 14;
167
167
  return this.client.FinalizeContentObject({
168
168
  libraryId: libraryId,
169
169
  objectId: objectId,
170
170
  writeToken: createResponse.write_token,
171
171
  commitMessage: "Create user wallet object"
172
172
  });
173
- case 39:
174
- _context.next = 45;
173
+ case 14:
174
+ _context.next = 16;
175
175
  break;
176
- case 41:
177
- _context.prev = 41;
178
- _context.t1 = _context["catch"](7);
176
+ case 15:
177
+ _context.prev = 15;
178
+ _t2 = _context["catch"](4);
179
179
  // eslint-disable-next-line no-console
180
180
  console.error("Failed to create wallet contract:");
181
181
  // eslint-disable-next-line no-console
182
- console.error(_context.t1);
183
- case 45:
184
- _context.prev = 45;
182
+ console.error(_t2);
183
+ case 16:
184
+ _context.prev = 16;
185
185
  this.creatingWallet = false;
186
- return _context.finish(45);
187
- case 48:
186
+ return _context.finish(16);
187
+ case 17:
188
188
  case "end":
189
189
  return _context.stop();
190
190
  }
191
- }, _callee, this, [[7, 41, 45, 48], [25, 30]]);
191
+ }, _callee, this, [[4, 15, 16, 17], [10, 12]]);
192
192
  }));
193
193
  function CreateWallet() {
194
194
  return _CreateWallet.apply(this, arguments);
@@ -202,21 +202,21 @@ var UserProfileClient = /*#__PURE__*/function () {
202
202
  */
203
203
  }, {
204
204
  key: "WalletAddress",
205
- value: function () {
206
- var _WalletAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
205
+ value: (function () {
206
+ var _WalletAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
207
207
  var autoCreate,
208
208
  walletAddress,
209
209
  _args2 = arguments;
210
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
210
+ return _regeneratorRuntime.wrap(function (_context2) {
211
211
  while (1) switch (_context2.prev = _context2.next) {
212
212
  case 0:
213
213
  autoCreate = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : true;
214
214
  if (!(this.walletAddress || this.walletAddressRetrieved)) {
215
- _context2.next = 3;
215
+ _context2.next = 1;
216
216
  break;
217
217
  }
218
218
  return _context2.abrupt("return", this.walletAddress);
219
- case 3:
219
+ case 1:
220
220
  if (!this.walletAddressPromise) {
221
221
  this.walletAddressPromise = this.client.CallContractMethod({
222
222
  contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
@@ -224,23 +224,23 @@ var UserProfileClient = /*#__PURE__*/function () {
224
224
  methodArgs: [this.client.signer.address]
225
225
  });
226
226
  }
227
- _context2.next = 6;
227
+ _context2.next = 2;
228
228
  return this.walletAddressPromise;
229
- case 6:
229
+ case 2:
230
230
  walletAddress = _context2.sent;
231
231
  if (!Utils.EqualAddress(walletAddress, Utils.nullAddress)) {
232
232
  this.walletAddress = walletAddress;
233
233
  }
234
234
  if (!(!this.walletAddress && autoCreate)) {
235
- _context2.next = 11;
235
+ _context2.next = 3;
236
236
  break;
237
237
  }
238
- _context2.next = 11;
238
+ _context2.next = 3;
239
239
  return this.CreateWallet();
240
- case 11:
240
+ case 3:
241
241
  this.walletAddressRetrieved = true;
242
242
  return _context2.abrupt("return", this.walletAddress);
243
- case 13:
243
+ case 4:
244
244
  case "end":
245
245
  return _context2.stop();
246
246
  }
@@ -259,43 +259,44 @@ var UserProfileClient = /*#__PURE__*/function () {
259
259
  *
260
260
  * @return {Promise<string>} - The wallet address of the specified user, if it exists
261
261
  */
262
+ )
262
263
  }, {
263
264
  key: "UserWalletAddress",
264
- value: function () {
265
- var _UserWalletAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
265
+ value: (function () {
266
+ var _UserWalletAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
266
267
  var address, walletAddress;
267
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
268
+ return _regeneratorRuntime.wrap(function (_context3) {
268
269
  while (1) switch (_context3.prev = _context3.next) {
269
270
  case 0:
270
271
  address = _ref2.address;
271
272
  if (!Utils.EqualAddress(address, this.client.signer.address)) {
272
- _context3.next = 5;
273
+ _context3.next = 2;
273
274
  break;
274
275
  }
275
- _context3.next = 4;
276
+ _context3.next = 1;
276
277
  return this.WalletAddress();
277
- case 4:
278
+ case 1:
278
279
  return _context3.abrupt("return", _context3.sent);
279
- case 5:
280
+ case 2:
280
281
  if (this.userWalletAddresses[address]) {
281
- _context3.next = 11;
282
+ _context3.next = 4;
282
283
  break;
283
284
  }
284
285
  this.Log("Retrieving user wallet address for user ".concat(address));
285
- _context3.next = 9;
286
+ _context3.next = 3;
286
287
  return this.client.CallContractMethod({
287
288
  contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
288
289
  methodName: "userWallets",
289
290
  methodArgs: [address]
290
291
  });
291
- case 9:
292
+ case 3:
292
293
  walletAddress = _context3.sent;
293
294
  if (!Utils.EqualAddress(walletAddress, Utils.nullAddress)) {
294
295
  this.userWalletAddresses[address] = walletAddress;
295
296
  }
296
- case 11:
297
+ case 4:
297
298
  return _context3.abrupt("return", this.userWalletAddresses[address]);
298
- case 12:
299
+ case 5:
299
300
  case "end":
300
301
  return _context3.stop();
301
302
  }
@@ -315,42 +316,44 @@ var UserProfileClient = /*#__PURE__*/function () {
315
316
  *
316
317
  * @return {Promise<{Object}>} - An object containing the libraryId and objectId for the wallet object.
317
318
  */
319
+ )
318
320
  }, {
319
321
  key: "UserWalletObjectInfo",
320
- value: function () {
321
- var _UserWalletObjectInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
322
+ value: (function () {
323
+ var _UserWalletObjectInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
322
324
  var _ref3,
323
325
  address,
324
326
  walletAddress,
325
- _args4 = arguments;
326
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
327
+ _args4 = arguments,
328
+ _t3;
329
+ return _regeneratorRuntime.wrap(function (_context4) {
327
330
  while (1) switch (_context4.prev = _context4.next) {
328
331
  case 0:
329
332
  _ref3 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, address = _ref3.address;
330
333
  if (!address) {
331
- _context4.next = 7;
334
+ _context4.next = 2;
332
335
  break;
333
336
  }
334
- _context4.next = 4;
337
+ _context4.next = 1;
335
338
  return this.UserWalletAddress({
336
339
  address: address
337
340
  });
338
- case 4:
339
- _context4.t0 = _context4.sent;
340
- _context4.next = 10;
341
+ case 1:
342
+ _t3 = _context4.sent;
343
+ _context4.next = 4;
341
344
  break;
342
- case 7:
343
- _context4.next = 9;
345
+ case 2:
346
+ _context4.next = 3;
344
347
  return this.WalletAddress();
345
- case 9:
346
- _context4.t0 = _context4.sent;
347
- case 10:
348
- walletAddress = _context4.t0;
348
+ case 3:
349
+ _t3 = _context4.sent;
350
+ case 4:
351
+ walletAddress = _t3;
349
352
  return _context4.abrupt("return", {
350
353
  libraryId: this.client.contentSpaceLibraryId,
351
354
  objectId: walletAddress ? Utils.AddressToObjectId(walletAddress) : ""
352
355
  });
353
- case 12:
356
+ case 5:
354
357
  case "end":
355
358
  return _context4.stop();
356
359
  }
@@ -389,49 +392,50 @@ var UserProfileClient = /*#__PURE__*/function () {
389
392
  *
390
393
  * @return {Promise<Object|string>}
391
394
  */
395
+ )
392
396
  }, {
393
397
  key: "PublicUserMetadata",
394
- value: function () {
395
- var _PublicUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref4) {
398
+ value: (function () {
399
+ var _PublicUserMetadata = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref4) {
396
400
  var address, _ref4$metadataSubtree, metadataSubtree, _ref4$queryParams, queryParams, _ref4$select, select, _ref4$resolveLinks, resolveLinks, _ref4$resolveIncludeS, resolveIncludeSource, _ref4$resolveIgnoreEr, resolveIgnoreErrors, _ref4$linkDepthLimit, linkDepthLimit, walletAddress, _yield$this$UserWalle, libraryId, objectId;
397
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
401
+ return _regeneratorRuntime.wrap(function (_context5) {
398
402
  while (1) switch (_context5.prev = _context5.next) {
399
403
  case 0:
400
404
  address = _ref4.address, _ref4$metadataSubtree = _ref4.metadataSubtree, metadataSubtree = _ref4$metadataSubtree === void 0 ? "/" : _ref4$metadataSubtree, _ref4$queryParams = _ref4.queryParams, queryParams = _ref4$queryParams === void 0 ? {} : _ref4$queryParams, _ref4$select = _ref4.select, select = _ref4$select === void 0 ? [] : _ref4$select, _ref4$resolveLinks = _ref4.resolveLinks, resolveLinks = _ref4$resolveLinks === void 0 ? false : _ref4$resolveLinks, _ref4$resolveIncludeS = _ref4.resolveIncludeSource, resolveIncludeSource = _ref4$resolveIncludeS === void 0 ? false : _ref4$resolveIncludeS, _ref4$resolveIgnoreEr = _ref4.resolveIgnoreErrors, resolveIgnoreErrors = _ref4$resolveIgnoreEr === void 0 ? false : _ref4$resolveIgnoreEr, _ref4$linkDepthLimit = _ref4.linkDepthLimit, linkDepthLimit = _ref4$linkDepthLimit === void 0 ? 1 : _ref4$linkDepthLimit;
401
405
  if (address) {
402
- _context5.next = 3;
406
+ _context5.next = 1;
403
407
  break;
404
408
  }
405
409
  return _context5.abrupt("return");
406
- case 3:
407
- _context5.next = 5;
410
+ case 1:
411
+ _context5.next = 2;
408
412
  return this.UserWalletAddress({
409
413
  address: address
410
414
  });
411
- case 5:
415
+ case 2:
412
416
  walletAddress = _context5.sent;
413
417
  if (walletAddress) {
414
- _context5.next = 8;
418
+ _context5.next = 3;
415
419
  break;
416
420
  }
417
421
  return _context5.abrupt("return");
418
- case 8:
422
+ case 3:
419
423
  metadataSubtree = UrlJoin("public", metadataSubtree || "/");
420
- _context5.next = 11;
424
+ _context5.next = 4;
421
425
  return this.UserWalletObjectInfo({
422
426
  address: address
423
427
  });
424
- case 11:
428
+ case 4:
425
429
  _yield$this$UserWalle = _context5.sent;
426
430
  libraryId = _yield$this$UserWalle.libraryId;
427
431
  objectId = _yield$this$UserWalle.objectId;
428
432
  if (objectId) {
429
- _context5.next = 16;
433
+ _context5.next = 5;
430
434
  break;
431
435
  }
432
436
  return _context5.abrupt("return");
433
- case 16:
434
- _context5.next = 18;
437
+ case 5:
438
+ _context5.next = 6;
435
439
  return this.client.ContentObjectMetadata({
436
440
  libraryId: libraryId,
437
441
  objectId: objectId,
@@ -443,9 +447,9 @@ var UserProfileClient = /*#__PURE__*/function () {
443
447
  resolveIgnoreErrors: resolveIgnoreErrors,
444
448
  linkDepthLimit: linkDepthLimit
445
449
  });
446
- case 18:
450
+ case 6:
447
451
  return _context5.abrupt("return", _context5.sent);
448
- case 19:
452
+ case 7:
449
453
  case "end":
450
454
  return _context5.stop();
451
455
  }
@@ -487,10 +491,11 @@ var UserProfileClient = /*#__PURE__*/function () {
487
491
  *
488
492
  * @return {Promise<Object|string>} - The user's profile metadata - returns undefined if no metadata set or subtree doesn't exist
489
493
  */
494
+ )
490
495
  }, {
491
496
  key: "UserMetadata",
492
- value: function () {
493
- var _UserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
497
+ value: (function () {
498
+ var _UserMetadata = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
494
499
  var _ref5,
495
500
  _ref5$metadataSubtree,
496
501
  metadataSubtree,
@@ -510,18 +515,18 @@ var UserProfileClient = /*#__PURE__*/function () {
510
515
  libraryId,
511
516
  objectId,
512
517
  _args6 = arguments;
513
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
518
+ return _regeneratorRuntime.wrap(function (_context6) {
514
519
  while (1) switch (_context6.prev = _context6.next) {
515
520
  case 0:
516
521
  _ref5 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref5$metadataSubtree = _ref5.metadataSubtree, metadataSubtree = _ref5$metadataSubtree === void 0 ? "/" : _ref5$metadataSubtree, _ref5$queryParams = _ref5.queryParams, queryParams = _ref5$queryParams === void 0 ? {} : _ref5$queryParams, _ref5$select = _ref5.select, select = _ref5$select === void 0 ? [] : _ref5$select, _ref5$resolveLinks = _ref5.resolveLinks, resolveLinks = _ref5$resolveLinks === void 0 ? false : _ref5$resolveLinks, _ref5$resolveIncludeS = _ref5.resolveIncludeSource, resolveIncludeSource = _ref5$resolveIncludeS === void 0 ? false : _ref5$resolveIncludeS, _ref5$resolveIgnoreEr = _ref5.resolveIgnoreErrors, resolveIgnoreErrors = _ref5$resolveIgnoreEr === void 0 ? false : _ref5$resolveIgnoreEr, _ref5$linkDepthLimit = _ref5.linkDepthLimit, linkDepthLimit = _ref5$linkDepthLimit === void 0 ? 1 : _ref5$linkDepthLimit;
517
522
  this.Log("Accessing private user metadata at ".concat(metadataSubtree));
518
- _context6.next = 4;
523
+ _context6.next = 1;
519
524
  return this.UserWalletObjectInfo();
520
- case 4:
525
+ case 1:
521
526
  _yield$this$UserWalle2 = _context6.sent;
522
527
  libraryId = _yield$this$UserWalle2.libraryId;
523
528
  objectId = _yield$this$UserWalle2.objectId;
524
- _context6.next = 9;
529
+ _context6.next = 2;
525
530
  return this.client.ContentObjectMetadata({
526
531
  libraryId: libraryId,
527
532
  objectId: objectId,
@@ -533,9 +538,9 @@ var UserProfileClient = /*#__PURE__*/function () {
533
538
  resolveIgnoreErrors: resolveIgnoreErrors,
534
539
  linkDepthLimit: linkDepthLimit
535
540
  });
536
- case 9:
541
+ case 2:
537
542
  return _context6.abrupt("return", _context6.sent);
538
- case 10:
543
+ case 3:
539
544
  case "end":
540
545
  return _context6.stop();
541
546
  }
@@ -553,30 +558,31 @@ var UserProfileClient = /*#__PURE__*/function () {
553
558
  * @param {Object} metadata - New metadata
554
559
  * @param {string=} metadataSubtree - Subtree to merge into - modifies root metadata if not specified
555
560
  */
561
+ )
556
562
  }, {
557
563
  key: "MergeUserMetadata",
558
- value: function () {
559
- var _MergeUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref6) {
564
+ value: (function () {
565
+ var _MergeUserMetadata = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref6) {
560
566
  var _ref6$metadataSubtree, metadataSubtree, _ref6$metadata, metadata, _yield$this$UserWalle3, libraryId, objectId, editRequest;
561
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
567
+ return _regeneratorRuntime.wrap(function (_context7) {
562
568
  while (1) switch (_context7.prev = _context7.next) {
563
569
  case 0:
564
570
  _ref6$metadataSubtree = _ref6.metadataSubtree, metadataSubtree = _ref6$metadataSubtree === void 0 ? "/" : _ref6$metadataSubtree, _ref6$metadata = _ref6.metadata, metadata = _ref6$metadata === void 0 ? {} : _ref6$metadata;
565
571
  this.Log("Merging user metadata at ".concat(metadataSubtree));
566
- _context7.next = 4;
572
+ _context7.next = 1;
567
573
  return this.UserWalletObjectInfo();
568
- case 4:
574
+ case 1:
569
575
  _yield$this$UserWalle3 = _context7.sent;
570
576
  libraryId = _yield$this$UserWalle3.libraryId;
571
577
  objectId = _yield$this$UserWalle3.objectId;
572
- _context7.next = 9;
578
+ _context7.next = 2;
573
579
  return this.client.EditContentObject({
574
580
  libraryId: libraryId,
575
581
  objectId: objectId
576
582
  });
577
- case 9:
583
+ case 2:
578
584
  editRequest = _context7.sent;
579
- _context7.next = 12;
585
+ _context7.next = 3;
580
586
  return this.client.MergeMetadata({
581
587
  libraryId: libraryId,
582
588
  objectId: objectId,
@@ -584,15 +590,15 @@ var UserProfileClient = /*#__PURE__*/function () {
584
590
  metadataSubtree: metadataSubtree,
585
591
  metadata: metadata
586
592
  });
587
- case 12:
588
- _context7.next = 14;
593
+ case 3:
594
+ _context7.next = 4;
589
595
  return this.client.FinalizeContentObject({
590
596
  libraryId: libraryId,
591
597
  objectId: objectId,
592
598
  writeToken: editRequest.write_token,
593
599
  commitMessage: "Merge user metadata"
594
600
  });
595
- case 14:
601
+ case 4:
596
602
  case "end":
597
603
  return _context7.stop();
598
604
  }
@@ -610,30 +616,31 @@ var UserProfileClient = /*#__PURE__*/function () {
610
616
  * @param {Object} metadata - New metadata
611
617
  * @param {string=} metadataSubtree - Subtree to replace - modifies root metadata if not specified
612
618
  */
619
+ )
613
620
  }, {
614
621
  key: "ReplaceUserMetadata",
615
- value: function () {
616
- var _ReplaceUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
622
+ value: (function () {
623
+ var _ReplaceUserMetadata = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
617
624
  var _ref7$metadataSubtree, metadataSubtree, _ref7$metadata, metadata, _yield$this$UserWalle4, libraryId, objectId, editRequest;
618
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
625
+ return _regeneratorRuntime.wrap(function (_context8) {
619
626
  while (1) switch (_context8.prev = _context8.next) {
620
627
  case 0:
621
628
  _ref7$metadataSubtree = _ref7.metadataSubtree, metadataSubtree = _ref7$metadataSubtree === void 0 ? "/" : _ref7$metadataSubtree, _ref7$metadata = _ref7.metadata, metadata = _ref7$metadata === void 0 ? {} : _ref7$metadata;
622
629
  this.Log("Replacing user metadata at ".concat(metadataSubtree));
623
- _context8.next = 4;
630
+ _context8.next = 1;
624
631
  return this.UserWalletObjectInfo();
625
- case 4:
632
+ case 1:
626
633
  _yield$this$UserWalle4 = _context8.sent;
627
634
  libraryId = _yield$this$UserWalle4.libraryId;
628
635
  objectId = _yield$this$UserWalle4.objectId;
629
- _context8.next = 9;
636
+ _context8.next = 2;
630
637
  return this.client.EditContentObject({
631
638
  libraryId: libraryId,
632
639
  objectId: objectId
633
640
  });
634
- case 9:
641
+ case 2:
635
642
  editRequest = _context8.sent;
636
- _context8.next = 12;
643
+ _context8.next = 3;
637
644
  return this.client.ReplaceMetadata({
638
645
  libraryId: libraryId,
639
646
  objectId: objectId,
@@ -641,15 +648,15 @@ var UserProfileClient = /*#__PURE__*/function () {
641
648
  metadataSubtree: metadataSubtree,
642
649
  metadata: metadata
643
650
  });
644
- case 12:
645
- _context8.next = 14;
651
+ case 3:
652
+ _context8.next = 4;
646
653
  return this.client.FinalizeContentObject({
647
654
  libraryId: libraryId,
648
655
  objectId: objectId,
649
656
  writeToken: editRequest.write_token,
650
657
  commitMessage: "Replace user metadata"
651
658
  });
652
- case 14:
659
+ case 4:
653
660
  case "end":
654
661
  return _context8.stop();
655
662
  }
@@ -666,45 +673,46 @@ var UserProfileClient = /*#__PURE__*/function () {
666
673
  * @namedParams
667
674
  * @param {string=} metadataSubtree - Subtree to delete - deletes all metadata if not specified
668
675
  */
676
+ )
669
677
  }, {
670
678
  key: "DeleteUserMetadata",
671
- value: function () {
672
- var _DeleteUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref8) {
679
+ value: (function () {
680
+ var _DeleteUserMetadata = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref8) {
673
681
  var _ref8$metadataSubtree, metadataSubtree, _yield$this$UserWalle5, libraryId, objectId, editRequest;
674
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
682
+ return _regeneratorRuntime.wrap(function (_context9) {
675
683
  while (1) switch (_context9.prev = _context9.next) {
676
684
  case 0:
677
685
  _ref8$metadataSubtree = _ref8.metadataSubtree, metadataSubtree = _ref8$metadataSubtree === void 0 ? "/" : _ref8$metadataSubtree;
678
686
  this.Log("Deleting user metadata at ".concat(metadataSubtree));
679
- _context9.next = 4;
687
+ _context9.next = 1;
680
688
  return this.UserWalletObjectInfo();
681
- case 4:
689
+ case 1:
682
690
  _yield$this$UserWalle5 = _context9.sent;
683
691
  libraryId = _yield$this$UserWalle5.libraryId;
684
692
  objectId = _yield$this$UserWalle5.objectId;
685
- _context9.next = 9;
693
+ _context9.next = 2;
686
694
  return this.client.EditContentObject({
687
695
  libraryId: libraryId,
688
696
  objectId: objectId
689
697
  });
690
- case 9:
698
+ case 2:
691
699
  editRequest = _context9.sent;
692
- _context9.next = 12;
700
+ _context9.next = 3;
693
701
  return this.client.DeleteMetadata({
694
702
  libraryId: libraryId,
695
703
  objectId: objectId,
696
704
  writeToken: editRequest.write_token,
697
705
  metadataSubtree: metadataSubtree
698
706
  });
699
- case 12:
700
- _context9.next = 14;
707
+ case 3:
708
+ _context9.next = 4;
701
709
  return this.client.FinalizeContentObject({
702
710
  libraryId: libraryId,
703
711
  objectId: objectId,
704
712
  writeToken: editRequest.write_token,
705
713
  commitMessage: "Delete user metadata"
706
714
  });
707
- case 14:
715
+ case 4:
708
716
  case "end":
709
717
  return _context9.stop();
710
718
  }
@@ -724,31 +732,33 @@ var UserProfileClient = /*#__PURE__*/function () {
724
732
  *
725
733
  * @return {Promise<string>} - Access setting
726
734
  */
735
+ )
727
736
  }, {
728
737
  key: "AccessLevel",
729
- value: function () {
730
- var _AccessLevel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
731
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
732
- while (1) switch (_context10.prev = _context10.next) {
738
+ value: (function () {
739
+ var _AccessLevel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
740
+ var _t4;
741
+ return _regeneratorRuntime.wrap(function (_context0) {
742
+ while (1) switch (_context0.prev = _context0.next) {
733
743
  case 0:
734
- _context10.next = 2;
744
+ _context0.next = 1;
735
745
  return this.UserMetadata({
736
746
  metadataSubtree: "access_level"
737
747
  });
738
- case 2:
739
- _context10.t0 = _context10.sent;
740
- if (_context10.t0) {
741
- _context10.next = 5;
748
+ case 1:
749
+ _t4 = _context0.sent;
750
+ if (_t4) {
751
+ _context0.next = 2;
742
752
  break;
743
753
  }
744
- _context10.t0 = "prompt";
745
- case 5:
746
- return _context10.abrupt("return", _context10.t0);
747
- case 6:
754
+ _t4 = "prompt";
755
+ case 2:
756
+ return _context0.abrupt("return", _t4);
757
+ case 3:
748
758
  case "end":
749
- return _context10.stop();
759
+ return _context0.stop();
750
760
  }
751
- }, _callee10, this);
761
+ }, _callee0, this);
752
762
  }));
753
763
  function AccessLevel() {
754
764
  return _AccessLevel.apply(this, arguments);
@@ -763,32 +773,33 @@ var UserProfileClient = /*#__PURE__*/function () {
763
773
  * @namedParams
764
774
  * @param level
765
775
  */
776
+ )
766
777
  }, {
767
778
  key: "SetAccessLevel",
768
- value: function () {
769
- var _SetAccessLevel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref9) {
779
+ value: (function () {
780
+ var _SetAccessLevel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(_ref9) {
770
781
  var level;
771
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
772
- while (1) switch (_context11.prev = _context11.next) {
782
+ return _regeneratorRuntime.wrap(function (_context1) {
783
+ while (1) switch (_context1.prev = _context1.next) {
773
784
  case 0:
774
785
  level = _ref9.level;
775
786
  level = level.toLowerCase();
776
787
  if (["private", "prompt", "public"].includes(level)) {
777
- _context11.next = 4;
788
+ _context1.next = 1;
778
789
  break;
779
790
  }
780
791
  throw new Error("Invalid access level: " + level);
781
- case 4:
782
- _context11.next = 6;
792
+ case 1:
793
+ _context1.next = 2;
783
794
  return this.ReplaceUserMetadata({
784
795
  metadataSubtree: "access_level",
785
796
  metadata: level
786
797
  });
787
- case 6:
798
+ case 2:
788
799
  case "end":
789
- return _context11.stop();
800
+ return _context1.stop();
790
801
  }
791
- }, _callee11, this);
802
+ }, _callee1, this);
792
803
  }));
793
804
  function SetAccessLevel(_x6) {
794
805
  return _SetAccessLevel.apply(this, arguments);
@@ -800,36 +811,37 @@ var UserProfileClient = /*#__PURE__*/function () {
800
811
  *
801
812
  * @return {Promise<string>} - Tenant ID
802
813
  */
814
+ )
803
815
  }, {
804
816
  key: "TenantId",
805
- value: function () {
806
- var _TenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
817
+ value: (function () {
818
+ var _TenantId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
807
819
  var _yield$this$UserWalle6, objectId;
808
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
809
- while (1) switch (_context12.prev = _context12.next) {
820
+ return _regeneratorRuntime.wrap(function (_context10) {
821
+ while (1) switch (_context10.prev = _context10.next) {
810
822
  case 0:
811
823
  if (this.tenantId) {
812
- _context12.next = 8;
824
+ _context10.next = 3;
813
825
  break;
814
826
  }
815
- _context12.next = 3;
827
+ _context10.next = 1;
816
828
  return this.UserWalletObjectInfo();
817
- case 3:
818
- _yield$this$UserWalle6 = _context12.sent;
829
+ case 1:
830
+ _yield$this$UserWalle6 = _context10.sent;
819
831
  objectId = _yield$this$UserWalle6.objectId;
820
- _context12.next = 7;
832
+ _context10.next = 2;
821
833
  return this.client.TenantId({
822
834
  objectId: objectId
823
835
  });
824
- case 7:
825
- this.tenantId = _context12.sent;
826
- case 8:
827
- return _context12.abrupt("return", this.tenantId);
828
- case 9:
836
+ case 2:
837
+ this.tenantId = _context10.sent;
838
+ case 3:
839
+ return _context10.abrupt("return", this.tenantId);
840
+ case 4:
829
841
  case "end":
830
- return _context12.stop();
842
+ return _context10.stop();
831
843
  }
832
- }, _callee12, this);
844
+ }, _callee10, this);
833
845
  }));
834
846
  function TenantId() {
835
847
  return _TenantId.apply(this, arguments);
@@ -845,52 +857,53 @@ var UserProfileClient = /*#__PURE__*/function () {
845
857
  * @param {string} id - The tenant ID in hash format
846
858
  * @param {string} address - The group address to use in the hash if id is not provided
847
859
  */
860
+ )
848
861
  }, {
849
862
  key: "SetTenantId",
850
- value: function () {
851
- var _SetTenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref10) {
863
+ value: (function () {
864
+ var _SetTenantId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref0) {
852
865
  var id, address, _yield$this$UserWalle7, objectId, tenantInfo;
853
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
854
- while (1) switch (_context13.prev = _context13.next) {
866
+ return _regeneratorRuntime.wrap(function (_context11) {
867
+ while (1) switch (_context11.prev = _context11.next) {
855
868
  case 0:
856
- id = _ref10.id, address = _ref10.address;
869
+ id = _ref0.id, address = _ref0.address;
857
870
  if (!(id && (!id.startsWith("iten") || !Utils.ValidHash(id)))) {
858
- _context13.next = 3;
871
+ _context11.next = 1;
859
872
  break;
860
873
  }
861
874
  throw Error("Invalid tenant ID: ".concat(id));
862
- case 3:
875
+ case 1:
863
876
  if (!address) {
864
- _context13.next = 7;
877
+ _context11.next = 3;
865
878
  break;
866
879
  }
867
880
  if (Utils.ValidAddress(address)) {
868
- _context13.next = 6;
881
+ _context11.next = 2;
869
882
  break;
870
883
  }
871
884
  throw Error("Invalid address: ".concat(address));
872
- case 6:
885
+ case 2:
873
886
  id = "iten".concat(Utils.AddressToHash(address));
874
- case 7:
875
- _context13.next = 9;
887
+ case 3:
888
+ _context11.next = 4;
876
889
  return this.UserWalletObjectInfo();
877
- case 9:
878
- _yield$this$UserWalle7 = _context13.sent;
890
+ case 4:
891
+ _yield$this$UserWalle7 = _context11.sent;
879
892
  objectId = _yield$this$UserWalle7.objectId;
880
- _context13.next = 13;
893
+ _context11.next = 5;
881
894
  return this.client.SetTenantId({
882
895
  objectId: objectId,
883
896
  tenantId: id
884
897
  });
885
- case 13:
886
- tenantInfo = _context13.sent;
898
+ case 5:
899
+ tenantInfo = _context11.sent;
887
900
  this.tenantContractId = tenantInfo.tenantContractId;
888
901
  this.tenantId = tenantInfo.tenantId;
889
- case 16:
902
+ case 6:
890
903
  case "end":
891
- return _context13.stop();
904
+ return _context11.stop();
892
905
  }
893
- }, _callee13, this);
906
+ }, _callee11, this);
894
907
  }));
895
908
  function SetTenantId(_x7) {
896
909
  return _SetTenantId.apply(this, arguments);
@@ -902,36 +915,37 @@ var UserProfileClient = /*#__PURE__*/function () {
902
915
  *
903
916
  * @return {Promise<string>} - Tenant Contract ID
904
917
  */
918
+ )
905
919
  }, {
906
920
  key: "TenantContractId",
907
- value: function () {
908
- var _TenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
921
+ value: (function () {
922
+ var _TenantContractId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
909
923
  var _yield$this$UserWalle8, objectId;
910
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
911
- while (1) switch (_context14.prev = _context14.next) {
924
+ return _regeneratorRuntime.wrap(function (_context12) {
925
+ while (1) switch (_context12.prev = _context12.next) {
912
926
  case 0:
913
927
  if (this.tenantContractId) {
914
- _context14.next = 8;
928
+ _context12.next = 3;
915
929
  break;
916
930
  }
917
- _context14.next = 3;
931
+ _context12.next = 1;
918
932
  return this.UserWalletObjectInfo();
919
- case 3:
920
- _yield$this$UserWalle8 = _context14.sent;
933
+ case 1:
934
+ _yield$this$UserWalle8 = _context12.sent;
921
935
  objectId = _yield$this$UserWalle8.objectId;
922
- _context14.next = 7;
936
+ _context12.next = 2;
923
937
  return this.client.TenantContractId({
924
938
  objectId: objectId
925
939
  });
926
- case 7:
927
- this.tenantContractId = _context14.sent;
928
- case 8:
929
- return _context14.abrupt("return", this.tenantContractId);
930
- case 9:
940
+ case 2:
941
+ this.tenantContractId = _context12.sent;
942
+ case 3:
943
+ return _context12.abrupt("return", this.tenantContractId);
944
+ case 4:
931
945
  case "end":
932
- return _context14.stop();
946
+ return _context12.stop();
933
947
  }
934
- }, _callee14, this);
948
+ }, _callee12, this);
935
949
  }));
936
950
  function TenantContractId() {
937
951
  return _TenantContractId.apply(this, arguments);
@@ -947,69 +961,70 @@ var UserProfileClient = /*#__PURE__*/function () {
947
961
  * @param {string} tenantContractId - The tenant contract ID in hash format
948
962
  * @param {string} address - The tenant address to use in the hash if id is not provided
949
963
  */
964
+ )
950
965
  }, {
951
966
  key: "SetTenantContractId",
952
- value: function () {
953
- var _SetTenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref11) {
967
+ value: (function () {
968
+ var _SetTenantContractId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref1) {
954
969
  var tenantContractId, _yield$this$UserWalle9, objectId, tenantInfo;
955
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
956
- while (1) switch (_context15.prev = _context15.next) {
970
+ return _regeneratorRuntime.wrap(function (_context13) {
971
+ while (1) switch (_context13.prev = _context13.next) {
957
972
  case 0:
958
- tenantContractId = _ref11.tenantContractId;
959
- _context15.next = 3;
973
+ tenantContractId = _ref1.tenantContractId;
974
+ _context13.next = 1;
960
975
  return this.UserWalletObjectInfo();
961
- case 3:
962
- _yield$this$UserWalle9 = _context15.sent;
976
+ case 1:
977
+ _yield$this$UserWalle9 = _context13.sent;
963
978
  objectId = _yield$this$UserWalle9.objectId;
964
- _context15.next = 7;
979
+ _context13.next = 2;
965
980
  return this.client.SetTenantContractId({
966
981
  objectId: objectId,
967
982
  tenantContractId: tenantContractId
968
983
  });
969
- case 7:
970
- tenantInfo = _context15.sent;
984
+ case 2:
985
+ tenantInfo = _context13.sent;
971
986
  this.tenantContractId = tenantInfo.tenantContractId;
972
987
  this.tenantId = tenantInfo.tenantId;
973
- case 10:
988
+ case 3:
974
989
  case "end":
975
- return _context15.stop();
990
+ return _context13.stop();
976
991
  }
977
- }, _callee15, this);
992
+ }, _callee13, this);
978
993
  }));
979
994
  function SetTenantContractId(_x8) {
980
995
  return _SetTenantContractId.apply(this, arguments);
981
996
  }
982
997
  return SetTenantContractId;
983
- }()
998
+ }())
984
999
  }, {
985
1000
  key: "ResetTenantId",
986
1001
  value: function () {
987
- var _ResetTenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
988
- var _yield$this$UserWalle10, objectId;
989
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
990
- while (1) switch (_context16.prev = _context16.next) {
1002
+ var _ResetTenantId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
1003
+ var _yield$this$UserWalle0, objectId;
1004
+ return _regeneratorRuntime.wrap(function (_context14) {
1005
+ while (1) switch (_context14.prev = _context14.next) {
991
1006
  case 0:
992
- _context16.next = 2;
1007
+ _context14.next = 1;
993
1008
  return this.UserWalletObjectInfo();
994
- case 2:
995
- _yield$this$UserWalle10 = _context16.sent;
996
- objectId = _yield$this$UserWalle10.objectId;
997
- _context16.next = 6;
1009
+ case 1:
1010
+ _yield$this$UserWalle0 = _context14.sent;
1011
+ objectId = _yield$this$UserWalle0.objectId;
1012
+ _context14.next = 2;
998
1013
  return this.client.ResetTenantId({
999
1014
  objectId: objectId
1000
1015
  });
1001
- case 6:
1016
+ case 2:
1002
1017
  this.tenantId = this.client.TenantId({
1003
1018
  objectId: objectId
1004
1019
  });
1005
1020
  this.tenantContractId = this.client.TenantContractId({
1006
1021
  objectId: objectId
1007
1022
  });
1008
- case 8:
1023
+ case 3:
1009
1024
  case "end":
1010
- return _context16.stop();
1025
+ return _context14.stop();
1011
1026
  }
1012
- }, _callee16, this);
1027
+ }, _callee14, this);
1013
1028
  }));
1014
1029
  function ResetTenantId() {
1015
1030
  return _ResetTenantId.apply(this, arguments);
@@ -1032,61 +1047,61 @@ var UserProfileClient = /*#__PURE__*/function () {
1032
1047
  */
1033
1048
  }, {
1034
1049
  key: "UserProfileImage",
1035
- value: function () {
1036
- var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
1037
- var _ref12,
1050
+ value: (function () {
1051
+ var _UserProfileImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
1052
+ var _ref10,
1038
1053
  address,
1039
1054
  height,
1040
1055
  walletAddress,
1041
- _yield$this$UserWalle11,
1056
+ _yield$this$UserWalle1,
1042
1057
  libraryId,
1043
1058
  objectId,
1044
- _args17 = arguments;
1045
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1046
- while (1) switch (_context17.prev = _context17.next) {
1059
+ _args15 = arguments;
1060
+ return _regeneratorRuntime.wrap(function (_context15) {
1061
+ while (1) switch (_context15.prev = _context15.next) {
1047
1062
  case 0:
1048
- _ref12 = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {}, address = _ref12.address, height = _ref12.height;
1063
+ _ref10 = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {}, address = _ref10.address, height = _ref10.height;
1049
1064
  if (!address) {
1050
- _context17.next = 7;
1065
+ _context15.next = 2;
1051
1066
  break;
1052
1067
  }
1053
- _context17.next = 4;
1068
+ _context15.next = 1;
1054
1069
  return this.UserWalletAddress({
1055
1070
  address: address
1056
1071
  });
1057
- case 4:
1058
- walletAddress = _context17.sent;
1059
- _context17.next = 9;
1072
+ case 1:
1073
+ walletAddress = _context15.sent;
1074
+ _context15.next = 3;
1060
1075
  break;
1061
- case 7:
1076
+ case 2:
1062
1077
  address = this.client.signer.address;
1063
1078
  walletAddress = this.walletAddress;
1064
- case 9:
1079
+ case 3:
1065
1080
  if (walletAddress) {
1066
- _context17.next = 11;
1081
+ _context15.next = 4;
1067
1082
  break;
1068
1083
  }
1069
- return _context17.abrupt("return");
1070
- case 11:
1071
- _context17.next = 13;
1084
+ return _context15.abrupt("return");
1085
+ case 4:
1086
+ _context15.next = 5;
1072
1087
  return this.UserWalletObjectInfo({
1073
1088
  address: address
1074
1089
  });
1075
- case 13:
1076
- _yield$this$UserWalle11 = _context17.sent;
1077
- libraryId = _yield$this$UserWalle11.libraryId;
1078
- objectId = _yield$this$UserWalle11.objectId;
1079
- return _context17.abrupt("return", this.client.ContentObjectImageUrl({
1090
+ case 5:
1091
+ _yield$this$UserWalle1 = _context15.sent;
1092
+ libraryId = _yield$this$UserWalle1.libraryId;
1093
+ objectId = _yield$this$UserWalle1.objectId;
1094
+ return _context15.abrupt("return", this.client.ContentObjectImageUrl({
1080
1095
  libraryId: libraryId,
1081
1096
  objectId: objectId,
1082
1097
  height: height,
1083
1098
  imagePath: "public/profile_image"
1084
1099
  }));
1085
- case 17:
1100
+ case 6:
1086
1101
  case "end":
1087
- return _context17.stop();
1102
+ return _context15.stop();
1088
1103
  }
1089
- }, _callee17, this);
1104
+ }, _callee15, this);
1090
1105
  }));
1091
1106
  function UserProfileImage() {
1092
1107
  return _UserProfileImage.apply(this, arguments);
@@ -1099,37 +1114,38 @@ var UserProfileClient = /*#__PURE__*/function () {
1099
1114
  * @namedParams
1100
1115
  * @param {blob} image - The new profile image for the current user
1101
1116
  */
1117
+ )
1102
1118
  }, {
1103
1119
  key: "SetUserProfileImage",
1104
- value: function () {
1105
- var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref13) {
1106
- var image, size, _yield$this$UserWalle12, libraryId, objectId, editRequest;
1107
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1108
- while (1) switch (_context18.prev = _context18.next) {
1120
+ value: (function () {
1121
+ var _SetUserProfileImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref11) {
1122
+ var image, size, _yield$this$UserWalle10, libraryId, objectId, editRequest;
1123
+ return _regeneratorRuntime.wrap(function (_context16) {
1124
+ while (1) switch (_context16.prev = _context16.next) {
1109
1125
  case 0:
1110
- image = _ref13.image;
1126
+ image = _ref11.image;
1111
1127
  this.Log("Setting profile image for user ".concat(this.client.signer.address));
1112
1128
  size = image.length || image.byteLength || image.size;
1113
1129
  if (!(size > 5000000)) {
1114
- _context18.next = 5;
1130
+ _context16.next = 1;
1115
1131
  break;
1116
1132
  }
1117
1133
  throw Error("Maximum profile image size is 5MB");
1118
- case 5:
1119
- _context18.next = 7;
1134
+ case 1:
1135
+ _context16.next = 2;
1120
1136
  return this.UserWalletObjectInfo();
1121
- case 7:
1122
- _yield$this$UserWalle12 = _context18.sent;
1123
- libraryId = _yield$this$UserWalle12.libraryId;
1124
- objectId = _yield$this$UserWalle12.objectId;
1125
- _context18.next = 12;
1137
+ case 2:
1138
+ _yield$this$UserWalle10 = _context16.sent;
1139
+ libraryId = _yield$this$UserWalle10.libraryId;
1140
+ objectId = _yield$this$UserWalle10.objectId;
1141
+ _context16.next = 3;
1126
1142
  return this.client.EditContentObject({
1127
1143
  libraryId: libraryId,
1128
1144
  objectId: objectId
1129
1145
  });
1130
- case 12:
1131
- editRequest = _context18.sent;
1132
- _context18.next = 15;
1146
+ case 3:
1147
+ editRequest = _context16.sent;
1148
+ _context16.next = 4;
1133
1149
  return this.client.SetContentObjectImage({
1134
1150
  libraryId: libraryId,
1135
1151
  objectId: objectId,
@@ -1138,19 +1154,19 @@ var UserProfileClient = /*#__PURE__*/function () {
1138
1154
  imageName: "profile_image",
1139
1155
  imagePath: "public/profile_image"
1140
1156
  });
1141
- case 15:
1142
- _context18.next = 17;
1157
+ case 4:
1158
+ _context16.next = 5;
1143
1159
  return this.client.FinalizeContentObject({
1144
1160
  libraryId: libraryId,
1145
1161
  objectId: objectId,
1146
1162
  writeToken: editRequest.write_token,
1147
1163
  commitMessage: "Set user profile image"
1148
1164
  });
1149
- case 17:
1165
+ case 5:
1150
1166
  case "end":
1151
- return _context18.stop();
1167
+ return _context16.stop();
1152
1168
  }
1153
- }, _callee18, this);
1169
+ }, _callee16, this);
1154
1170
  }));
1155
1171
  function SetUserProfileImage(_x9) {
1156
1172
  return _SetUserProfileImage.apply(this, arguments);
@@ -1166,68 +1182,71 @@ var UserProfileClient = /*#__PURE__*/function () {
1166
1182
  *
1167
1183
  * @return {Promise<Object>} - User tags
1168
1184
  */
1185
+ )
1169
1186
  }, {
1170
1187
  key: "CollectedTags",
1171
- value: function () {
1172
- var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
1173
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1174
- while (1) switch (_context19.prev = _context19.next) {
1188
+ value: (function () {
1189
+ var _CollectedTags = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
1190
+ var _t5;
1191
+ return _regeneratorRuntime.wrap(function (_context17) {
1192
+ while (1) switch (_context17.prev = _context17.next) {
1175
1193
  case 0:
1176
- _context19.next = 2;
1194
+ _context17.next = 1;
1177
1195
  return this.UserMetadata({
1178
1196
  metadataSubtree: "collected_data"
1179
1197
  });
1180
- case 2:
1181
- _context19.t0 = _context19.sent;
1182
- if (_context19.t0) {
1183
- _context19.next = 5;
1198
+ case 1:
1199
+ _t5 = _context17.sent;
1200
+ if (_t5) {
1201
+ _context17.next = 2;
1184
1202
  break;
1185
1203
  }
1186
- _context19.t0 = {};
1187
- case 5:
1188
- return _context19.abrupt("return", _context19.t0);
1189
- case 6:
1204
+ _t5 = {};
1205
+ case 2:
1206
+ return _context17.abrupt("return", _t5);
1207
+ case 3:
1190
1208
  case "end":
1191
- return _context19.stop();
1209
+ return _context17.stop();
1192
1210
  }
1193
- }, _callee19, this);
1211
+ }, _callee17, this);
1194
1212
  }));
1195
1213
  function CollectedTags() {
1196
1214
  return _CollectedTags.apply(this, arguments);
1197
1215
  }
1198
1216
  return CollectedTags;
1199
1217
  }() // Ensure recording tags never causes action to fail
1218
+ )
1200
1219
  }, {
1201
1220
  key: "RecordTags",
1202
1221
  value: function () {
1203
- var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref14) {
1204
- var libraryId, objectId, versionHash;
1205
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1206
- while (1) switch (_context20.prev = _context20.next) {
1222
+ var _RecordTags = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref12) {
1223
+ var libraryId, objectId, versionHash, _t6;
1224
+ return _regeneratorRuntime.wrap(function (_context18) {
1225
+ while (1) switch (_context18.prev = _context18.next) {
1207
1226
  case 0:
1208
- libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash;
1209
- _context20.prev = 1;
1210
- _context20.next = 4;
1227
+ libraryId = _ref12.libraryId, objectId = _ref12.objectId, versionHash = _ref12.versionHash;
1228
+ _context18.prev = 1;
1229
+ _context18.next = 2;
1211
1230
  return this.__RecordTags({
1212
1231
  libraryId: libraryId,
1213
1232
  objectId: objectId,
1214
1233
  versionHash: versionHash
1215
1234
  });
1216
- case 4:
1217
- _context20.next = 9;
1235
+ case 2:
1236
+ _context18.next = 4;
1218
1237
  break;
1219
- case 6:
1220
- _context20.prev = 6;
1221
- _context20.t0 = _context20["catch"](1);
1238
+ case 3:
1239
+ _context18.prev = 3;
1240
+ _t6 = _context18["catch"](1);
1222
1241
  // eslint-disable-next-line no-console
1223
- console.error(_context20.t0);
1224
- case 9:
1242
+ console.error(_t6);
1243
+ case 4:
1225
1244
  case "end":
1226
- return _context20.stop();
1245
+ return _context18.stop();
1227
1246
  }
1228
- }, _callee20, this, [[1, 6]]);
1247
+ }, _callee18, this, [[1, 3]]);
1229
1248
  }));
1230
- function RecordTags(_x10) {
1249
+ function RecordTags(_x0) {
1231
1250
  return _RecordTags.apply(this, arguments);
1232
1251
  }
1233
1252
  return RecordTags;
@@ -1235,73 +1254,73 @@ var UserProfileClient = /*#__PURE__*/function () {
1235
1254
  }, {
1236
1255
  key: "__RecordTags",
1237
1256
  value: function () {
1238
- var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref15) {
1257
+ var _RecordTags2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref13) {
1239
1258
  var libraryId, objectId, versionHash, accessType, seen, walletObjectInfo, userLibraryId, userObjectId, editRequest, contentTags, userTags, formattedTags;
1240
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1241
- while (1) switch (_context21.prev = _context21.next) {
1259
+ return _regeneratorRuntime.wrap(function (_context19) {
1260
+ while (1) switch (_context19.prev = _context19.next) {
1242
1261
  case 0:
1243
- libraryId = _ref15.libraryId, objectId = _ref15.objectId, versionHash = _ref15.versionHash;
1244
- _context21.next = 3;
1262
+ libraryId = _ref13.libraryId, objectId = _ref13.objectId, versionHash = _ref13.versionHash;
1263
+ _context19.next = 1;
1245
1264
  return this.client.AccessType({
1246
1265
  id: objectId
1247
1266
  });
1248
- case 3:
1249
- accessType = _context21.sent;
1267
+ case 1:
1268
+ accessType = _context19.sent;
1250
1269
  if (!(accessType !== "object")) {
1251
- _context21.next = 6;
1270
+ _context19.next = 2;
1252
1271
  break;
1253
1272
  }
1254
- return _context21.abrupt("return");
1255
- case 6:
1273
+ return _context19.abrupt("return");
1274
+ case 2:
1256
1275
  if (!(!versionHash && !libraryId)) {
1257
- _context21.next = 10;
1276
+ _context19.next = 4;
1258
1277
  break;
1259
1278
  }
1260
- _context21.next = 9;
1279
+ _context19.next = 3;
1261
1280
  return this.client.ContentObjectLibraryId({
1262
1281
  objectId: objectId
1263
1282
  });
1264
- case 9:
1265
- libraryId = _context21.sent;
1266
- case 10:
1283
+ case 3:
1284
+ libraryId = _context19.sent;
1285
+ case 4:
1267
1286
  if (versionHash) {
1268
- _context21.next = 14;
1287
+ _context19.next = 6;
1269
1288
  break;
1270
1289
  }
1271
- _context21.next = 13;
1290
+ _context19.next = 5;
1272
1291
  return this.client.ContentObject({
1273
1292
  libraryId: libraryId,
1274
1293
  objectId: objectId
1275
1294
  });
1276
- case 13:
1277
- versionHash = _context21.sent.hash;
1278
- case 14:
1279
- _context21.next = 16;
1295
+ case 5:
1296
+ versionHash = _context19.sent.hash;
1297
+ case 6:
1298
+ _context19.next = 7;
1280
1299
  return this.UserMetadata({
1281
1300
  metadataSubtree: UrlJoin("accessed_content", versionHash)
1282
1301
  });
1283
- case 16:
1284
- seen = _context21.sent;
1302
+ case 7:
1303
+ seen = _context19.sent;
1285
1304
  if (!seen) {
1286
- _context21.next = 19;
1305
+ _context19.next = 8;
1287
1306
  break;
1288
1307
  }
1289
- return _context21.abrupt("return");
1290
- case 19:
1291
- _context21.next = 21;
1308
+ return _context19.abrupt("return");
1309
+ case 8:
1310
+ _context19.next = 9;
1292
1311
  return this.UserWalletObjectInfo();
1293
- case 21:
1294
- walletObjectInfo = _context21.sent;
1312
+ case 9:
1313
+ walletObjectInfo = _context19.sent;
1295
1314
  userLibraryId = walletObjectInfo.libraryId;
1296
1315
  userObjectId = walletObjectInfo.objectId; // Mark content as seen
1297
- _context21.next = 26;
1316
+ _context19.next = 10;
1298
1317
  return this.client.EditContentObject({
1299
1318
  libraryId: userLibraryId,
1300
1319
  objectId: userObjectId
1301
1320
  });
1302
- case 26:
1303
- editRequest = _context21.sent;
1304
- _context21.next = 29;
1321
+ case 10:
1322
+ editRequest = _context19.sent;
1323
+ _context19.next = 11;
1305
1324
  return this.client.ReplaceMetadata({
1306
1325
  libraryId: userLibraryId,
1307
1326
  objectId: userObjectId,
@@ -1309,24 +1328,24 @@ var UserProfileClient = /*#__PURE__*/function () {
1309
1328
  metadataSubtree: UrlJoin("accessed_content", versionHash),
1310
1329
  metadata: Date.now()
1311
1330
  });
1312
- case 29:
1313
- _context21.next = 31;
1331
+ case 11:
1332
+ _context19.next = 12;
1314
1333
  return this.client.ContentObjectMetadata({
1315
1334
  libraryId: libraryId,
1316
1335
  objectId: objectId,
1317
1336
  versionHash: versionHash,
1318
1337
  metadataSubtree: "video_tags"
1319
1338
  });
1320
- case 31:
1321
- contentTags = _context21.sent;
1339
+ case 12:
1340
+ contentTags = _context19.sent;
1322
1341
  if (!(contentTags && contentTags.length > 0)) {
1323
- _context21.next = 40;
1342
+ _context19.next = 14;
1324
1343
  break;
1325
1344
  }
1326
- _context21.next = 35;
1345
+ _context19.next = 13;
1327
1346
  return this.CollectedTags();
1328
- case 35:
1329
- userTags = _context21.sent;
1347
+ case 13:
1348
+ userTags = _context19.sent;
1330
1349
  formattedTags = this.__FormatVideoTags(contentTags);
1331
1350
  Object.keys(formattedTags).forEach(function (tag) {
1332
1351
  if (userTags[tag]) {
@@ -1343,7 +1362,7 @@ var UserProfileClient = /*#__PURE__*/function () {
1343
1362
  });
1344
1363
 
1345
1364
  // Update user tags
1346
- _context21.next = 40;
1365
+ _context19.next = 14;
1347
1366
  return this.client.ReplaceMetadata({
1348
1367
  libraryId: userLibraryId,
1349
1368
  objectId: userObjectId,
@@ -1351,8 +1370,8 @@ var UserProfileClient = /*#__PURE__*/function () {
1351
1370
  metadataSubtree: "collected_data",
1352
1371
  metadata: userTags
1353
1372
  });
1354
- case 40:
1355
- _context21.next = 42;
1373
+ case 14:
1374
+ _context19.next = 15;
1356
1375
  return this.client.FinalizeContentObject({
1357
1376
  libraryId: userLibraryId,
1358
1377
  objectId: userObjectId,
@@ -1360,13 +1379,13 @@ var UserProfileClient = /*#__PURE__*/function () {
1360
1379
  commitMessage: "Record user tags",
1361
1380
  awaitCommitConfirmation: false
1362
1381
  });
1363
- case 42:
1382
+ case 15:
1364
1383
  case "end":
1365
- return _context21.stop();
1384
+ return _context19.stop();
1366
1385
  }
1367
- }, _callee21, this);
1386
+ }, _callee19, this);
1368
1387
  }));
1369
- function __RecordTags(_x11) {
1388
+ function __RecordTags(_x1) {
1370
1389
  return _RecordTags2.apply(this, arguments);
1371
1390
  }
1372
1391
  return __RecordTags;
@@ -1445,6 +1464,5 @@ var UserProfileClient = /*#__PURE__*/function () {
1445
1464
  });
1446
1465
  }
1447
1466
  }]);
1448
- return UserProfileClient;
1449
1467
  }();
1450
1468
  module.exports = UserProfileClient;