@eluvio/elv-client-js 4.2.6 → 4.2.8
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/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +709 -710
- package/dist/src/ContentObjectAudit.js +56 -56
- package/dist/src/Crypto.js +85 -85
- package/dist/src/ElvClient.js +529 -499
- package/dist/src/ElvWallet.js +30 -28
- package/dist/src/EthClient.js +311 -311
- package/dist/src/FrameClient.js +63 -64
- package/dist/src/HttpClient.js +60 -60
- package/dist/src/Id.js +1 -2
- package/dist/src/PermissionsClient.js +499 -487
- package/dist/src/RemoteSigner.js +82 -83
- package/dist/src/UserProfileClient.js +392 -374
- package/dist/src/Utils.js +69 -66
- package/dist/src/Validation.js +10 -10
- package/dist/src/client/ABRPublishing.js +238 -238
- package/dist/src/client/AccessGroups.js +477 -474
- package/dist/src/client/ContentAccess.js +1707 -1711
- package/dist/src/client/ContentManagement.js +871 -871
- package/dist/src/client/Contracts.js +575 -578
- package/dist/src/client/Files.js +700 -684
- package/dist/src/client/LiveConf.js +1 -3
- package/dist/src/client/LiveStream.js +694 -693
- package/dist/src/client/NFT.js +14 -14
- package/dist/src/client/NTP.js +84 -84
- package/dist/src/client/Shares.js +53 -60
- package/dist/src/walletClient/ClientMethods.js +977 -951
- package/dist/src/walletClient/Notifications.js +14 -14
- package/dist/src/walletClient/Profile.js +66 -66
- package/dist/src/walletClient/Utils.js +15 -15
- package/dist/src/walletClient/index.js +572 -562
- package/package.json +1 -1
- package/src/AuthorizationClient.js +9 -3
- package/src/ElvClient.js +1 -1
- package/src/walletClient/index.js +6 -2
- 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(
|
|
75
|
-
var balance, walletCreationEvent, abi, libraryId, objectId, createResponse;
|
|
76
|
-
return _regeneratorRuntime.wrap(function
|
|
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 =
|
|
80
|
+
_context.next = 3;
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
case 1:
|
|
84
84
|
if (!this.creatingWallet) {
|
|
85
|
-
_context.next =
|
|
85
|
+
_context.next = 3;
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
|
-
_context.next =
|
|
88
|
+
_context.next = 2;
|
|
89
89
|
return new Promise(function (resolve) {
|
|
90
90
|
return setTimeout(resolve, 500);
|
|
91
91
|
});
|
|
92
|
-
case
|
|
92
|
+
case 2:
|
|
93
93
|
_context.next = 1;
|
|
94
94
|
break;
|
|
95
|
-
case
|
|
95
|
+
case 3:
|
|
96
96
|
this.creatingWallet = true;
|
|
97
|
-
_context.prev =
|
|
97
|
+
_context.prev = 4;
|
|
98
98
|
if (!(!this.walletAddress || Utils.EqualAddress(this.walletAddress, Utils.nullAddress))) {
|
|
99
|
-
_context.next =
|
|
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 =
|
|
105
|
+
_context.next = 5;
|
|
106
106
|
return this.client.GetBalance({
|
|
107
107
|
address: this.client.signer.address
|
|
108
108
|
});
|
|
109
|
-
case
|
|
109
|
+
case 5:
|
|
110
110
|
balance = _context.sent;
|
|
111
111
|
if (!(balance < 0.05)) {
|
|
112
|
-
_context.next =
|
|
112
|
+
_context.next = 6;
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
return _context.abrupt("return", undefined);
|
|
116
|
-
case
|
|
117
|
-
_context.next =
|
|
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
|
|
123
|
+
case 7:
|
|
124
124
|
walletCreationEvent = _context.sent;
|
|
125
|
-
_context.next =
|
|
125
|
+
_context.next = 8;
|
|
126
126
|
return this.client.ContractAbi({
|
|
127
127
|
contractAddress: this.client.contentSpaceAddress
|
|
128
128
|
});
|
|
129
|
-
case
|
|
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
|
|
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 =
|
|
143
|
-
_context.next =
|
|
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
|
|
149
|
-
_context.next =
|
|
148
|
+
case 11:
|
|
149
|
+
_context.next = 14;
|
|
150
150
|
break;
|
|
151
|
-
case
|
|
152
|
-
_context.prev =
|
|
153
|
-
|
|
154
|
-
if (!(
|
|
155
|
-
_context.next =
|
|
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 =
|
|
159
|
+
_context.next = 13;
|
|
160
160
|
return this.client.CreateContentObject({
|
|
161
161
|
libraryId: libraryId,
|
|
162
162
|
objectId: objectId
|
|
163
163
|
});
|
|
164
|
-
case
|
|
164
|
+
case 13:
|
|
165
165
|
createResponse = _context.sent;
|
|
166
|
-
_context.next =
|
|
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
|
|
174
|
-
_context.next =
|
|
173
|
+
case 14:
|
|
174
|
+
_context.next = 16;
|
|
175
175
|
break;
|
|
176
|
-
case
|
|
177
|
-
_context.prev =
|
|
178
|
-
|
|
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(
|
|
183
|
-
case
|
|
184
|
-
_context.prev =
|
|
182
|
+
console.error(_t2);
|
|
183
|
+
case 16:
|
|
184
|
+
_context.prev = 16;
|
|
185
185
|
this.creatingWallet = false;
|
|
186
|
-
return _context.finish(
|
|
187
|
-
case
|
|
186
|
+
return _context.finish(16);
|
|
187
|
+
case 17:
|
|
188
188
|
case "end":
|
|
189
189
|
return _context.stop();
|
|
190
190
|
}
|
|
191
|
-
}, _callee, this, [[
|
|
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(
|
|
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
|
|
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 =
|
|
215
|
+
_context2.next = 1;
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
218
218
|
return _context2.abrupt("return", this.walletAddress);
|
|
219
|
-
case
|
|
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 =
|
|
227
|
+
_context2.next = 2;
|
|
228
228
|
return this.walletAddressPromise;
|
|
229
|
-
case
|
|
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 =
|
|
235
|
+
_context2.next = 3;
|
|
236
236
|
break;
|
|
237
237
|
}
|
|
238
|
-
_context2.next =
|
|
238
|
+
_context2.next = 3;
|
|
239
239
|
return this.CreateWallet();
|
|
240
|
-
case
|
|
240
|
+
case 3:
|
|
241
241
|
this.walletAddressRetrieved = true;
|
|
242
242
|
return _context2.abrupt("return", this.walletAddress);
|
|
243
|
-
case
|
|
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(
|
|
265
|
+
value: (function () {
|
|
266
|
+
var _UserWalletAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
266
267
|
var address, walletAddress;
|
|
267
|
-
return _regeneratorRuntime.wrap(function
|
|
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 =
|
|
273
|
+
_context3.next = 2;
|
|
273
274
|
break;
|
|
274
275
|
}
|
|
275
|
-
_context3.next =
|
|
276
|
+
_context3.next = 1;
|
|
276
277
|
return this.WalletAddress();
|
|
277
|
-
case
|
|
278
|
+
case 1:
|
|
278
279
|
return _context3.abrupt("return", _context3.sent);
|
|
279
|
-
case
|
|
280
|
+
case 2:
|
|
280
281
|
if (this.userWalletAddresses[address]) {
|
|
281
|
-
_context3.next =
|
|
282
|
+
_context3.next = 4;
|
|
282
283
|
break;
|
|
283
284
|
}
|
|
284
285
|
this.Log("Retrieving user wallet address for user ".concat(address));
|
|
285
|
-
_context3.next =
|
|
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
|
|
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
|
|
297
|
+
case 4:
|
|
297
298
|
return _context3.abrupt("return", this.userWalletAddresses[address]);
|
|
298
|
-
case
|
|
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(
|
|
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
|
-
|
|
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 =
|
|
334
|
+
_context4.next = 2;
|
|
332
335
|
break;
|
|
333
336
|
}
|
|
334
|
-
_context4.next =
|
|
337
|
+
_context4.next = 1;
|
|
335
338
|
return this.UserWalletAddress({
|
|
336
339
|
address: address
|
|
337
340
|
});
|
|
338
|
-
case
|
|
339
|
-
|
|
340
|
-
_context4.next =
|
|
341
|
+
case 1:
|
|
342
|
+
_t3 = _context4.sent;
|
|
343
|
+
_context4.next = 4;
|
|
341
344
|
break;
|
|
342
|
-
case
|
|
343
|
-
_context4.next =
|
|
345
|
+
case 2:
|
|
346
|
+
_context4.next = 3;
|
|
344
347
|
return this.WalletAddress();
|
|
345
|
-
case
|
|
346
|
-
|
|
347
|
-
case
|
|
348
|
-
walletAddress =
|
|
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
|
|
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(
|
|
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
|
|
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 =
|
|
406
|
+
_context5.next = 1;
|
|
403
407
|
break;
|
|
404
408
|
}
|
|
405
409
|
return _context5.abrupt("return");
|
|
406
|
-
case
|
|
407
|
-
_context5.next =
|
|
410
|
+
case 1:
|
|
411
|
+
_context5.next = 2;
|
|
408
412
|
return this.UserWalletAddress({
|
|
409
413
|
address: address
|
|
410
414
|
});
|
|
411
|
-
case
|
|
415
|
+
case 2:
|
|
412
416
|
walletAddress = _context5.sent;
|
|
413
417
|
if (walletAddress) {
|
|
414
|
-
_context5.next =
|
|
418
|
+
_context5.next = 3;
|
|
415
419
|
break;
|
|
416
420
|
}
|
|
417
421
|
return _context5.abrupt("return");
|
|
418
|
-
case
|
|
422
|
+
case 3:
|
|
419
423
|
metadataSubtree = UrlJoin("public", metadataSubtree || "/");
|
|
420
|
-
_context5.next =
|
|
424
|
+
_context5.next = 4;
|
|
421
425
|
return this.UserWalletObjectInfo({
|
|
422
426
|
address: address
|
|
423
427
|
});
|
|
424
|
-
case
|
|
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 =
|
|
433
|
+
_context5.next = 5;
|
|
430
434
|
break;
|
|
431
435
|
}
|
|
432
436
|
return _context5.abrupt("return");
|
|
433
|
-
case
|
|
434
|
-
_context5.next =
|
|
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
|
|
450
|
+
case 6:
|
|
447
451
|
return _context5.abrupt("return", _context5.sent);
|
|
448
|
-
case
|
|
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(
|
|
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
|
|
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 =
|
|
523
|
+
_context6.next = 1;
|
|
519
524
|
return this.UserWalletObjectInfo();
|
|
520
|
-
case
|
|
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 =
|
|
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
|
|
541
|
+
case 2:
|
|
537
542
|
return _context6.abrupt("return", _context6.sent);
|
|
538
|
-
case
|
|
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(
|
|
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
|
|
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 =
|
|
572
|
+
_context7.next = 1;
|
|
567
573
|
return this.UserWalletObjectInfo();
|
|
568
|
-
case
|
|
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 =
|
|
578
|
+
_context7.next = 2;
|
|
573
579
|
return this.client.EditContentObject({
|
|
574
580
|
libraryId: libraryId,
|
|
575
581
|
objectId: objectId
|
|
576
582
|
});
|
|
577
|
-
case
|
|
583
|
+
case 2:
|
|
578
584
|
editRequest = _context7.sent;
|
|
579
|
-
_context7.next =
|
|
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
|
|
588
|
-
_context7.next =
|
|
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
|
|
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(
|
|
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
|
|
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 =
|
|
630
|
+
_context8.next = 1;
|
|
624
631
|
return this.UserWalletObjectInfo();
|
|
625
|
-
case
|
|
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 =
|
|
636
|
+
_context8.next = 2;
|
|
630
637
|
return this.client.EditContentObject({
|
|
631
638
|
libraryId: libraryId,
|
|
632
639
|
objectId: objectId
|
|
633
640
|
});
|
|
634
|
-
case
|
|
641
|
+
case 2:
|
|
635
642
|
editRequest = _context8.sent;
|
|
636
|
-
_context8.next =
|
|
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
|
|
645
|
-
_context8.next =
|
|
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
|
|
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(
|
|
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
|
|
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 =
|
|
687
|
+
_context9.next = 1;
|
|
680
688
|
return this.UserWalletObjectInfo();
|
|
681
|
-
case
|
|
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 =
|
|
693
|
+
_context9.next = 2;
|
|
686
694
|
return this.client.EditContentObject({
|
|
687
695
|
libraryId: libraryId,
|
|
688
696
|
objectId: objectId
|
|
689
697
|
});
|
|
690
|
-
case
|
|
698
|
+
case 2:
|
|
691
699
|
editRequest = _context9.sent;
|
|
692
|
-
_context9.next =
|
|
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
|
|
700
|
-
_context9.next =
|
|
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
|
|
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(
|
|
731
|
-
|
|
732
|
-
|
|
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
|
-
|
|
744
|
+
_context0.next = 1;
|
|
735
745
|
return this.UserMetadata({
|
|
736
746
|
metadataSubtree: "access_level"
|
|
737
747
|
});
|
|
738
|
-
case
|
|
739
|
-
|
|
740
|
-
if (
|
|
741
|
-
|
|
748
|
+
case 1:
|
|
749
|
+
_t4 = _context0.sent;
|
|
750
|
+
if (_t4) {
|
|
751
|
+
_context0.next = 2;
|
|
742
752
|
break;
|
|
743
753
|
}
|
|
744
|
-
|
|
745
|
-
case
|
|
746
|
-
return
|
|
747
|
-
case
|
|
754
|
+
_t4 = "prompt";
|
|
755
|
+
case 2:
|
|
756
|
+
return _context0.abrupt("return", _t4);
|
|
757
|
+
case 3:
|
|
748
758
|
case "end":
|
|
749
|
-
return
|
|
759
|
+
return _context0.stop();
|
|
750
760
|
}
|
|
751
|
-
},
|
|
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(
|
|
779
|
+
value: (function () {
|
|
780
|
+
var _SetAccessLevel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(_ref9) {
|
|
770
781
|
var level;
|
|
771
|
-
return _regeneratorRuntime.wrap(function
|
|
772
|
-
while (1) switch (
|
|
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
|
-
|
|
788
|
+
_context1.next = 1;
|
|
778
789
|
break;
|
|
779
790
|
}
|
|
780
791
|
throw new Error("Invalid access level: " + level);
|
|
781
|
-
case
|
|
782
|
-
|
|
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
|
|
798
|
+
case 2:
|
|
788
799
|
case "end":
|
|
789
|
-
return
|
|
800
|
+
return _context1.stop();
|
|
790
801
|
}
|
|
791
|
-
},
|
|
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(
|
|
817
|
+
value: (function () {
|
|
818
|
+
var _TenantId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
807
819
|
var _yield$this$UserWalle6, objectId;
|
|
808
|
-
return _regeneratorRuntime.wrap(function
|
|
809
|
-
while (1) switch (
|
|
820
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
821
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
810
822
|
case 0:
|
|
811
823
|
if (this.tenantId) {
|
|
812
|
-
|
|
824
|
+
_context10.next = 3;
|
|
813
825
|
break;
|
|
814
826
|
}
|
|
815
|
-
|
|
827
|
+
_context10.next = 1;
|
|
816
828
|
return this.UserWalletObjectInfo();
|
|
817
|
-
case
|
|
818
|
-
_yield$this$UserWalle6 =
|
|
829
|
+
case 1:
|
|
830
|
+
_yield$this$UserWalle6 = _context10.sent;
|
|
819
831
|
objectId = _yield$this$UserWalle6.objectId;
|
|
820
|
-
|
|
832
|
+
_context10.next = 2;
|
|
821
833
|
return this.client.TenantId({
|
|
822
834
|
objectId: objectId
|
|
823
835
|
});
|
|
824
|
-
case
|
|
825
|
-
this.tenantId =
|
|
826
|
-
case
|
|
827
|
-
return
|
|
828
|
-
case
|
|
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
|
|
842
|
+
return _context10.stop();
|
|
831
843
|
}
|
|
832
|
-
},
|
|
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(
|
|
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
|
|
854
|
-
while (1) switch (
|
|
866
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
867
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
855
868
|
case 0:
|
|
856
|
-
id =
|
|
869
|
+
id = _ref0.id, address = _ref0.address;
|
|
857
870
|
if (!(id && (!id.startsWith("iten") || !Utils.ValidHash(id)))) {
|
|
858
|
-
|
|
871
|
+
_context11.next = 1;
|
|
859
872
|
break;
|
|
860
873
|
}
|
|
861
874
|
throw Error("Invalid tenant ID: ".concat(id));
|
|
862
|
-
case
|
|
875
|
+
case 1:
|
|
863
876
|
if (!address) {
|
|
864
|
-
|
|
877
|
+
_context11.next = 3;
|
|
865
878
|
break;
|
|
866
879
|
}
|
|
867
880
|
if (Utils.ValidAddress(address)) {
|
|
868
|
-
|
|
881
|
+
_context11.next = 2;
|
|
869
882
|
break;
|
|
870
883
|
}
|
|
871
884
|
throw Error("Invalid address: ".concat(address));
|
|
872
|
-
case
|
|
885
|
+
case 2:
|
|
873
886
|
id = "iten".concat(Utils.AddressToHash(address));
|
|
874
|
-
case
|
|
875
|
-
|
|
887
|
+
case 3:
|
|
888
|
+
_context11.next = 4;
|
|
876
889
|
return this.UserWalletObjectInfo();
|
|
877
|
-
case
|
|
878
|
-
_yield$this$UserWalle7 =
|
|
890
|
+
case 4:
|
|
891
|
+
_yield$this$UserWalle7 = _context11.sent;
|
|
879
892
|
objectId = _yield$this$UserWalle7.objectId;
|
|
880
|
-
|
|
893
|
+
_context11.next = 5;
|
|
881
894
|
return this.client.SetTenantId({
|
|
882
895
|
objectId: objectId,
|
|
883
896
|
tenantId: id
|
|
884
897
|
});
|
|
885
|
-
case
|
|
886
|
-
tenantInfo =
|
|
898
|
+
case 5:
|
|
899
|
+
tenantInfo = _context11.sent;
|
|
887
900
|
this.tenantContractId = tenantInfo.tenantContractId;
|
|
888
901
|
this.tenantId = tenantInfo.tenantId;
|
|
889
|
-
case
|
|
902
|
+
case 6:
|
|
890
903
|
case "end":
|
|
891
|
-
return
|
|
904
|
+
return _context11.stop();
|
|
892
905
|
}
|
|
893
|
-
},
|
|
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(
|
|
921
|
+
value: (function () {
|
|
922
|
+
var _TenantContractId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
909
923
|
var _yield$this$UserWalle8, objectId;
|
|
910
|
-
return _regeneratorRuntime.wrap(function
|
|
911
|
-
while (1) switch (
|
|
924
|
+
return _regeneratorRuntime.wrap(function (_context12) {
|
|
925
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
912
926
|
case 0:
|
|
913
927
|
if (this.tenantContractId) {
|
|
914
|
-
|
|
928
|
+
_context12.next = 3;
|
|
915
929
|
break;
|
|
916
930
|
}
|
|
917
|
-
|
|
931
|
+
_context12.next = 1;
|
|
918
932
|
return this.UserWalletObjectInfo();
|
|
919
|
-
case
|
|
920
|
-
_yield$this$UserWalle8 =
|
|
933
|
+
case 1:
|
|
934
|
+
_yield$this$UserWalle8 = _context12.sent;
|
|
921
935
|
objectId = _yield$this$UserWalle8.objectId;
|
|
922
|
-
|
|
936
|
+
_context12.next = 2;
|
|
923
937
|
return this.client.TenantContractId({
|
|
924
938
|
objectId: objectId
|
|
925
939
|
});
|
|
926
|
-
case
|
|
927
|
-
this.tenantContractId =
|
|
928
|
-
case
|
|
929
|
-
return
|
|
930
|
-
case
|
|
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
|
|
946
|
+
return _context12.stop();
|
|
933
947
|
}
|
|
934
|
-
},
|
|
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(
|
|
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
|
|
956
|
-
while (1) switch (
|
|
970
|
+
return _regeneratorRuntime.wrap(function (_context13) {
|
|
971
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
957
972
|
case 0:
|
|
958
|
-
tenantContractId =
|
|
959
|
-
|
|
973
|
+
tenantContractId = _ref1.tenantContractId;
|
|
974
|
+
_context13.next = 1;
|
|
960
975
|
return this.UserWalletObjectInfo();
|
|
961
|
-
case
|
|
962
|
-
_yield$this$UserWalle9 =
|
|
976
|
+
case 1:
|
|
977
|
+
_yield$this$UserWalle9 = _context13.sent;
|
|
963
978
|
objectId = _yield$this$UserWalle9.objectId;
|
|
964
|
-
|
|
979
|
+
_context13.next = 2;
|
|
965
980
|
return this.client.SetTenantContractId({
|
|
966
981
|
objectId: objectId,
|
|
967
982
|
tenantContractId: tenantContractId
|
|
968
983
|
});
|
|
969
|
-
case
|
|
970
|
-
tenantInfo =
|
|
984
|
+
case 2:
|
|
985
|
+
tenantInfo = _context13.sent;
|
|
971
986
|
this.tenantContractId = tenantInfo.tenantContractId;
|
|
972
987
|
this.tenantId = tenantInfo.tenantId;
|
|
973
|
-
case
|
|
988
|
+
case 3:
|
|
974
989
|
case "end":
|
|
975
|
-
return
|
|
990
|
+
return _context13.stop();
|
|
976
991
|
}
|
|
977
|
-
},
|
|
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(
|
|
988
|
-
var _yield$this$
|
|
989
|
-
return _regeneratorRuntime.wrap(function
|
|
990
|
-
while (1) switch (
|
|
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
|
-
|
|
1007
|
+
_context14.next = 1;
|
|
993
1008
|
return this.UserWalletObjectInfo();
|
|
994
|
-
case
|
|
995
|
-
_yield$this$
|
|
996
|
-
objectId = _yield$this$
|
|
997
|
-
|
|
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
|
|
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
|
|
1023
|
+
case 3:
|
|
1009
1024
|
case "end":
|
|
1010
|
-
return
|
|
1025
|
+
return _context14.stop();
|
|
1011
1026
|
}
|
|
1012
|
-
},
|
|
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(
|
|
1037
|
-
var
|
|
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$
|
|
1056
|
+
_yield$this$UserWalle1,
|
|
1042
1057
|
libraryId,
|
|
1043
1058
|
objectId,
|
|
1044
|
-
|
|
1045
|
-
return _regeneratorRuntime.wrap(function
|
|
1046
|
-
while (1) switch (
|
|
1059
|
+
_args15 = arguments;
|
|
1060
|
+
return _regeneratorRuntime.wrap(function (_context15) {
|
|
1061
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1047
1062
|
case 0:
|
|
1048
|
-
|
|
1063
|
+
_ref10 = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {}, address = _ref10.address, height = _ref10.height;
|
|
1049
1064
|
if (!address) {
|
|
1050
|
-
|
|
1065
|
+
_context15.next = 2;
|
|
1051
1066
|
break;
|
|
1052
1067
|
}
|
|
1053
|
-
|
|
1068
|
+
_context15.next = 1;
|
|
1054
1069
|
return this.UserWalletAddress({
|
|
1055
1070
|
address: address
|
|
1056
1071
|
});
|
|
1057
|
-
case
|
|
1058
|
-
walletAddress =
|
|
1059
|
-
|
|
1072
|
+
case 1:
|
|
1073
|
+
walletAddress = _context15.sent;
|
|
1074
|
+
_context15.next = 3;
|
|
1060
1075
|
break;
|
|
1061
|
-
case
|
|
1076
|
+
case 2:
|
|
1062
1077
|
address = this.client.signer.address;
|
|
1063
1078
|
walletAddress = this.walletAddress;
|
|
1064
|
-
case
|
|
1079
|
+
case 3:
|
|
1065
1080
|
if (walletAddress) {
|
|
1066
|
-
|
|
1081
|
+
_context15.next = 4;
|
|
1067
1082
|
break;
|
|
1068
1083
|
}
|
|
1069
|
-
return
|
|
1070
|
-
case
|
|
1071
|
-
|
|
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
|
|
1076
|
-
_yield$this$
|
|
1077
|
-
libraryId = _yield$this$
|
|
1078
|
-
objectId = _yield$this$
|
|
1079
|
-
return
|
|
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
|
|
1100
|
+
case 6:
|
|
1086
1101
|
case "end":
|
|
1087
|
-
return
|
|
1102
|
+
return _context15.stop();
|
|
1088
1103
|
}
|
|
1089
|
-
},
|
|
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(
|
|
1106
|
-
var image, size, _yield$this$
|
|
1107
|
-
return _regeneratorRuntime.wrap(function
|
|
1108
|
-
while (1) switch (
|
|
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 =
|
|
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
|
-
|
|
1130
|
+
_context16.next = 1;
|
|
1115
1131
|
break;
|
|
1116
1132
|
}
|
|
1117
1133
|
throw Error("Maximum profile image size is 5MB");
|
|
1118
|
-
case
|
|
1119
|
-
|
|
1134
|
+
case 1:
|
|
1135
|
+
_context16.next = 2;
|
|
1120
1136
|
return this.UserWalletObjectInfo();
|
|
1121
|
-
case
|
|
1122
|
-
_yield$this$
|
|
1123
|
-
libraryId = _yield$this$
|
|
1124
|
-
objectId = _yield$this$
|
|
1125
|
-
|
|
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
|
|
1131
|
-
editRequest =
|
|
1132
|
-
|
|
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
|
|
1142
|
-
|
|
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
|
|
1165
|
+
case 5:
|
|
1150
1166
|
case "end":
|
|
1151
|
-
return
|
|
1167
|
+
return _context16.stop();
|
|
1152
1168
|
}
|
|
1153
|
-
},
|
|
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(
|
|
1173
|
-
|
|
1174
|
-
|
|
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
|
-
|
|
1194
|
+
_context17.next = 1;
|
|
1177
1195
|
return this.UserMetadata({
|
|
1178
1196
|
metadataSubtree: "collected_data"
|
|
1179
1197
|
});
|
|
1180
|
-
case
|
|
1181
|
-
|
|
1182
|
-
if (
|
|
1183
|
-
|
|
1198
|
+
case 1:
|
|
1199
|
+
_t5 = _context17.sent;
|
|
1200
|
+
if (_t5) {
|
|
1201
|
+
_context17.next = 2;
|
|
1184
1202
|
break;
|
|
1185
1203
|
}
|
|
1186
|
-
|
|
1187
|
-
case
|
|
1188
|
-
return
|
|
1189
|
-
case
|
|
1204
|
+
_t5 = {};
|
|
1205
|
+
case 2:
|
|
1206
|
+
return _context17.abrupt("return", _t5);
|
|
1207
|
+
case 3:
|
|
1190
1208
|
case "end":
|
|
1191
|
-
return
|
|
1209
|
+
return _context17.stop();
|
|
1192
1210
|
}
|
|
1193
|
-
},
|
|
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(
|
|
1204
|
-
var libraryId, objectId, versionHash;
|
|
1205
|
-
return _regeneratorRuntime.wrap(function
|
|
1206
|
-
while (1) switch (
|
|
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 =
|
|
1209
|
-
|
|
1210
|
-
|
|
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
|
|
1217
|
-
|
|
1235
|
+
case 2:
|
|
1236
|
+
_context18.next = 4;
|
|
1218
1237
|
break;
|
|
1219
|
-
case
|
|
1220
|
-
|
|
1221
|
-
|
|
1238
|
+
case 3:
|
|
1239
|
+
_context18.prev = 3;
|
|
1240
|
+
_t6 = _context18["catch"](1);
|
|
1222
1241
|
// eslint-disable-next-line no-console
|
|
1223
|
-
console.error(
|
|
1224
|
-
case
|
|
1242
|
+
console.error(_t6);
|
|
1243
|
+
case 4:
|
|
1225
1244
|
case "end":
|
|
1226
|
-
return
|
|
1245
|
+
return _context18.stop();
|
|
1227
1246
|
}
|
|
1228
|
-
},
|
|
1247
|
+
}, _callee18, this, [[1, 3]]);
|
|
1229
1248
|
}));
|
|
1230
|
-
function RecordTags(
|
|
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(
|
|
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
|
|
1241
|
-
while (1) switch (
|
|
1259
|
+
return _regeneratorRuntime.wrap(function (_context19) {
|
|
1260
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1242
1261
|
case 0:
|
|
1243
|
-
libraryId =
|
|
1244
|
-
|
|
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
|
|
1249
|
-
accessType =
|
|
1267
|
+
case 1:
|
|
1268
|
+
accessType = _context19.sent;
|
|
1250
1269
|
if (!(accessType !== "object")) {
|
|
1251
|
-
|
|
1270
|
+
_context19.next = 2;
|
|
1252
1271
|
break;
|
|
1253
1272
|
}
|
|
1254
|
-
return
|
|
1255
|
-
case
|
|
1273
|
+
return _context19.abrupt("return");
|
|
1274
|
+
case 2:
|
|
1256
1275
|
if (!(!versionHash && !libraryId)) {
|
|
1257
|
-
|
|
1276
|
+
_context19.next = 4;
|
|
1258
1277
|
break;
|
|
1259
1278
|
}
|
|
1260
|
-
|
|
1279
|
+
_context19.next = 3;
|
|
1261
1280
|
return this.client.ContentObjectLibraryId({
|
|
1262
1281
|
objectId: objectId
|
|
1263
1282
|
});
|
|
1264
|
-
case
|
|
1265
|
-
libraryId =
|
|
1266
|
-
case
|
|
1283
|
+
case 3:
|
|
1284
|
+
libraryId = _context19.sent;
|
|
1285
|
+
case 4:
|
|
1267
1286
|
if (versionHash) {
|
|
1268
|
-
|
|
1287
|
+
_context19.next = 6;
|
|
1269
1288
|
break;
|
|
1270
1289
|
}
|
|
1271
|
-
|
|
1290
|
+
_context19.next = 5;
|
|
1272
1291
|
return this.client.ContentObject({
|
|
1273
1292
|
libraryId: libraryId,
|
|
1274
1293
|
objectId: objectId
|
|
1275
1294
|
});
|
|
1276
|
-
case
|
|
1277
|
-
versionHash =
|
|
1278
|
-
case
|
|
1279
|
-
|
|
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
|
|
1284
|
-
seen =
|
|
1302
|
+
case 7:
|
|
1303
|
+
seen = _context19.sent;
|
|
1285
1304
|
if (!seen) {
|
|
1286
|
-
|
|
1305
|
+
_context19.next = 8;
|
|
1287
1306
|
break;
|
|
1288
1307
|
}
|
|
1289
|
-
return
|
|
1290
|
-
case
|
|
1291
|
-
|
|
1308
|
+
return _context19.abrupt("return");
|
|
1309
|
+
case 8:
|
|
1310
|
+
_context19.next = 9;
|
|
1292
1311
|
return this.UserWalletObjectInfo();
|
|
1293
|
-
case
|
|
1294
|
-
walletObjectInfo =
|
|
1312
|
+
case 9:
|
|
1313
|
+
walletObjectInfo = _context19.sent;
|
|
1295
1314
|
userLibraryId = walletObjectInfo.libraryId;
|
|
1296
1315
|
userObjectId = walletObjectInfo.objectId; // Mark content as seen
|
|
1297
|
-
|
|
1316
|
+
_context19.next = 10;
|
|
1298
1317
|
return this.client.EditContentObject({
|
|
1299
1318
|
libraryId: userLibraryId,
|
|
1300
1319
|
objectId: userObjectId
|
|
1301
1320
|
});
|
|
1302
|
-
case
|
|
1303
|
-
editRequest =
|
|
1304
|
-
|
|
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
|
|
1313
|
-
|
|
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
|
|
1321
|
-
contentTags =
|
|
1339
|
+
case 12:
|
|
1340
|
+
contentTags = _context19.sent;
|
|
1322
1341
|
if (!(contentTags && contentTags.length > 0)) {
|
|
1323
|
-
|
|
1342
|
+
_context19.next = 14;
|
|
1324
1343
|
break;
|
|
1325
1344
|
}
|
|
1326
|
-
|
|
1345
|
+
_context19.next = 13;
|
|
1327
1346
|
return this.CollectedTags();
|
|
1328
|
-
case
|
|
1329
|
-
userTags =
|
|
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
|
-
|
|
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
|
|
1355
|
-
|
|
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
|
|
1382
|
+
case 15:
|
|
1364
1383
|
case "end":
|
|
1365
|
-
return
|
|
1384
|
+
return _context19.stop();
|
|
1366
1385
|
}
|
|
1367
|
-
},
|
|
1386
|
+
}, _callee19, this);
|
|
1368
1387
|
}));
|
|
1369
|
-
function __RecordTags(
|
|
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;
|