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