@eluvio/elv-client-js 3.1.92 → 3.1.95
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 +15 -11
- package/dist/ElvClient-node-min.js +17 -13
- package/dist/ElvFrameClient-min.js +13 -9
- package/dist/ElvPermissionsClient-min.js +13 -9
- package/dist/src/AuthorizationClient.js +2248 -1990
- package/dist/src/ContentObjectVerification.js +164 -173
- package/dist/src/Crypto.js +376 -324
- package/dist/src/ElvClient.js +1214 -938
- package/dist/src/ElvWallet.js +119 -95
- package/dist/src/EthClient.js +1040 -896
- package/dist/src/FrameClient.js +331 -300
- package/dist/src/HttpClient.js +153 -147
- package/dist/src/Id.js +1 -3
- package/dist/src/PermissionsClient.js +1294 -1168
- package/dist/src/RemoteSigner.js +260 -200
- package/dist/src/UserProfileClient.js +1168 -1014
- package/dist/src/Utils.js +382 -178
- package/dist/src/client/ABRPublishing.js +895 -856
- package/dist/src/client/AccessGroups.js +1102 -959
- package/dist/src/client/ContentAccess.js +3737 -3427
- package/dist/src/client/ContentManagement.js +2255 -2063
- package/dist/src/client/Contracts.js +647 -563
- package/dist/src/client/Files.js +1886 -1757
- package/dist/src/client/NFT.js +127 -158
- package/dist/src/client/NTP.js +478 -422
- package/package.json +2 -1
- package/src/ElvClient.js +62 -1
- package/src/RemoteSigner.js +22 -18
- package/src/Utils.js +119 -0
- package/src/client/ABRPublishing.js +2 -1
- package/src/client/NFT.js +14 -49
- package/testScripts/Test.js +0 -19
- package/testScripts/VariantABRProfile.js +45 -0
- package/utilities/SimpleIngest.js +245 -0
- package/package-lock.json +0 -12650
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
2
2
|
|
|
3
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
+
|
|
3
5
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
4
6
|
|
|
5
7
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
@@ -14,61 +16,50 @@ var _require = require("./FrameClient"),
|
|
|
14
16
|
var _require2 = require("./LogMessage"),
|
|
15
17
|
LogMessage = _require2.LogMessage;
|
|
16
18
|
|
|
17
|
-
var UserProfileClient =
|
|
18
|
-
/*#__PURE__*/
|
|
19
|
-
function () {
|
|
19
|
+
var UserProfileClient = /*#__PURE__*/function () {
|
|
20
20
|
"use strict";
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
client.SetSigner({signer});
|
|
64
|
-
await client.userProfileClient.UserMetadata()
|
|
65
|
-
let frameClient = new FrameClient();
|
|
66
|
-
await client.userProfileClient.UserMetadata()
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
}]);
|
|
71
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Methods used to access and modify information about the user
|
|
24
|
+
*
|
|
25
|
+
* <h4 id="PromptsAndAccessLevels">A note about access level and prompts: </h4>
|
|
26
|
+
*
|
|
27
|
+
* Note: This section only applies to applications working within Eluvio Core
|
|
28
|
+
*
|
|
29
|
+
* Users can choose whether or not their info is shared to applications. A user
|
|
30
|
+
* may choose to allow open access to their profile, no access to their profile, or
|
|
31
|
+
* they may choose to be prompted to give access when an application requests it. The
|
|
32
|
+
* user's access level can be determined using the <a href="#AccessLevel">AccessLevel</a>
|
|
33
|
+
* method.
|
|
34
|
+
*
|
|
35
|
+
* By default, users will be prompted to give access. For methods that access the user's private information,
|
|
36
|
+
* Eluvio Core will intercept the request and prompt the user for permission before proceeding. In
|
|
37
|
+
* these cases, the normal FrameClient timeout period will be ignored, and the response will come
|
|
38
|
+
* only after the user accepts or rejects the request.
|
|
39
|
+
*
|
|
40
|
+
* Access and modification of user metadata is namespaced to the requesting application when using the
|
|
41
|
+
* FrameClient. Public user metadata can be accessed using the PublicUserMetadata method.
|
|
42
|
+
*
|
|
43
|
+
* If the user refuses to give permission, an error will be thrown. Otherwise, the request will proceed
|
|
44
|
+
* as normal.
|
|
45
|
+
*
|
|
46
|
+
* <h4>Usage</h4>
|
|
47
|
+
*
|
|
48
|
+
* Access the UserProfileClient from ElvClient or FrameClient via client.userProfileClient
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
let client = ElvClient.FromConfiguration({configuration: ClientConfiguration});
|
|
52
|
+
let wallet = client.GenerateWallet();
|
|
53
|
+
let signer = wallet.AddAccount({
|
|
54
|
+
accountName: "Alice",
|
|
55
|
+
privateKey: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
56
|
+
});
|
|
57
|
+
client.SetSigner({signer});
|
|
58
|
+
await client.userProfileClient.UserMetadata()
|
|
59
|
+
let frameClient = new FrameClient();
|
|
60
|
+
await client.userProfileClient.UserMetadata()
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
72
63
|
function UserProfileClient(_ref) {
|
|
73
64
|
var client = _ref.client,
|
|
74
65
|
debug = _ref.debug;
|
|
@@ -83,149 +74,163 @@ function () {
|
|
|
83
74
|
}
|
|
84
75
|
|
|
85
76
|
_createClass(UserProfileClient, [{
|
|
77
|
+
key: "Log",
|
|
78
|
+
value: function Log(message) {
|
|
79
|
+
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
80
|
+
LogMessage(this, message, error);
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
86
83
|
key: "CreateWallet",
|
|
87
|
-
value: function
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
value: function () {
|
|
85
|
+
var _CreateWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
86
|
+
var balance, walletCreationEvent, abi, libraryId, objectId, createResponse;
|
|
87
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
88
|
+
while (1) {
|
|
89
|
+
switch (_context.prev = _context.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
if (!this.creatingWallet) {
|
|
92
|
+
_context.next = 6;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
97
95
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
case 1:
|
|
97
|
+
if (!this.creatingWallet) {
|
|
98
|
+
_context.next = 6;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_context.next = 4;
|
|
103
|
+
return new Promise(function (resolve) {
|
|
104
|
+
return setTimeout(resolve, 500);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
case 4:
|
|
108
|
+
_context.next = 1;
|
|
101
109
|
break;
|
|
102
|
-
}
|
|
103
110
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}));
|
|
111
|
+
case 6:
|
|
112
|
+
this.creatingWallet = true;
|
|
113
|
+
_context.prev = 7;
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
if (!(!this.walletAddress || Utils.EqualAddress(this.walletAddress, Utils.nullAddress))) {
|
|
116
|
+
_context.next = 23;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
112
119
|
|
|
113
|
-
|
|
114
|
-
this.creatingWallet = true;
|
|
115
|
-
_context.prev = 7;
|
|
120
|
+
this.Log("Creating user wallet for user ".concat(this.client.signer.address)); // Don't attempt to create a user wallet if user has no funds
|
|
116
121
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
_context.next = 12;
|
|
123
|
+
return this.client.GetBalance({
|
|
124
|
+
address: this.client.signer.address
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
case 12:
|
|
128
|
+
balance = _context.sent;
|
|
129
|
+
|
|
130
|
+
if (!(balance < 0.1)) {
|
|
131
|
+
_context.next = 15;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
121
134
|
|
|
122
|
-
|
|
135
|
+
return _context.abrupt("return", undefined);
|
|
123
136
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
case 15:
|
|
138
|
+
_context.next = 17;
|
|
139
|
+
return this.client.CallContractMethodAndWait({
|
|
140
|
+
contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
|
|
141
|
+
methodName: "createAccessWallet",
|
|
142
|
+
methodArgs: []
|
|
143
|
+
});
|
|
128
144
|
|
|
129
|
-
|
|
130
|
-
|
|
145
|
+
case 17:
|
|
146
|
+
walletCreationEvent = _context.sent;
|
|
147
|
+
_context.next = 20;
|
|
148
|
+
return this.client.ContractAbi({
|
|
149
|
+
contractAddress: this.client.contentSpaceAddress
|
|
150
|
+
});
|
|
131
151
|
|
|
132
|
-
|
|
133
|
-
|
|
152
|
+
case 20:
|
|
153
|
+
abi = _context.sent;
|
|
154
|
+
this.walletAddress = this.client.ExtractValueFromEvent({
|
|
155
|
+
abi: abi,
|
|
156
|
+
event: walletCreationEvent,
|
|
157
|
+
eventName: "CreateAccessWallet",
|
|
158
|
+
eventValue: "wallet"
|
|
159
|
+
});
|
|
160
|
+
this.userWalletAddresses[Utils.FormatAddress(this.client.signer.address)] = this.walletAddress;
|
|
161
|
+
|
|
162
|
+
case 23:
|
|
163
|
+
// Check if wallet object is created
|
|
164
|
+
libraryId = this.client.contentSpaceLibraryId;
|
|
165
|
+
objectId = Utils.AddressToObjectId(this.walletAddress);
|
|
166
|
+
_context.prev = 25;
|
|
167
|
+
_context.next = 28;
|
|
168
|
+
return this.client.ContentObject({
|
|
169
|
+
libraryId: libraryId,
|
|
170
|
+
objectId: objectId
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
case 28:
|
|
174
|
+
_context.next = 39;
|
|
134
175
|
break;
|
|
135
|
-
}
|
|
136
176
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
abi = _context.sent;
|
|
156
|
-
this.walletAddress = this.client.ExtractValueFromEvent({
|
|
157
|
-
abi: abi,
|
|
158
|
-
event: walletCreationEvent,
|
|
159
|
-
eventName: "CreateAccessWallet",
|
|
160
|
-
eventValue: "wallet"
|
|
161
|
-
});
|
|
162
|
-
this.userWalletAddresses[Utils.FormatAddress(this.client.signer.address)] = this.walletAddress;
|
|
163
|
-
|
|
164
|
-
case 23:
|
|
165
|
-
// Check if wallet object is created
|
|
166
|
-
libraryId = this.client.contentSpaceLibraryId;
|
|
167
|
-
objectId = Utils.AddressToObjectId(this.walletAddress);
|
|
168
|
-
_context.prev = 25;
|
|
169
|
-
_context.next = 28;
|
|
170
|
-
return _regeneratorRuntime.awrap(this.client.ContentObject({
|
|
171
|
-
libraryId: libraryId,
|
|
172
|
-
objectId: objectId
|
|
173
|
-
}));
|
|
174
|
-
|
|
175
|
-
case 28:
|
|
176
|
-
_context.next = 39;
|
|
177
|
-
break;
|
|
178
|
-
|
|
179
|
-
case 30:
|
|
180
|
-
_context.prev = 30;
|
|
181
|
-
_context.t0 = _context["catch"](25);
|
|
182
|
-
|
|
183
|
-
if (!(_context.t0.status === 404)) {
|
|
177
|
+
case 30:
|
|
178
|
+
_context.prev = 30;
|
|
179
|
+
_context.t0 = _context["catch"](25);
|
|
180
|
+
|
|
181
|
+
if (!(_context.t0.status === 404)) {
|
|
182
|
+
_context.next = 39;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
this.Log("Creating wallet object for user ".concat(this.client.signer.address));
|
|
187
|
+
_context.next = 36;
|
|
188
|
+
return this.client.CreateContentObject({
|
|
189
|
+
libraryId: libraryId,
|
|
190
|
+
objectId: objectId
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
case 36:
|
|
194
|
+
createResponse = _context.sent;
|
|
184
195
|
_context.next = 39;
|
|
196
|
+
return this.client.FinalizeContentObject({
|
|
197
|
+
libraryId: libraryId,
|
|
198
|
+
objectId: objectId,
|
|
199
|
+
writeToken: createResponse.write_token,
|
|
200
|
+
commitMessage: "Create user wallet object"
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
case 39:
|
|
204
|
+
_context.next = 45;
|
|
185
205
|
break;
|
|
186
|
-
}
|
|
187
206
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
case 39:
|
|
206
|
-
_context.next = 45;
|
|
207
|
-
break;
|
|
208
|
-
|
|
209
|
-
case 41:
|
|
210
|
-
_context.prev = 41;
|
|
211
|
-
_context.t1 = _context["catch"](7);
|
|
212
|
-
// eslint-disable-next-line no-console
|
|
213
|
-
console.error("Failed to create wallet contract:"); // eslint-disable-next-line no-console
|
|
214
|
-
|
|
215
|
-
console.error(_context.t1);
|
|
216
|
-
|
|
217
|
-
case 45:
|
|
218
|
-
_context.prev = 45;
|
|
219
|
-
this.creatingWallet = false;
|
|
220
|
-
return _context.finish(45);
|
|
221
|
-
|
|
222
|
-
case 48:
|
|
223
|
-
case "end":
|
|
224
|
-
return _context.stop();
|
|
207
|
+
case 41:
|
|
208
|
+
_context.prev = 41;
|
|
209
|
+
_context.t1 = _context["catch"](7);
|
|
210
|
+
// eslint-disable-next-line no-console
|
|
211
|
+
console.error("Failed to create wallet contract:"); // eslint-disable-next-line no-console
|
|
212
|
+
|
|
213
|
+
console.error(_context.t1);
|
|
214
|
+
|
|
215
|
+
case 45:
|
|
216
|
+
_context.prev = 45;
|
|
217
|
+
this.creatingWallet = false;
|
|
218
|
+
return _context.finish(45);
|
|
219
|
+
|
|
220
|
+
case 48:
|
|
221
|
+
case "end":
|
|
222
|
+
return _context.stop();
|
|
223
|
+
}
|
|
225
224
|
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
225
|
+
}, _callee, this, [[7, 41, 45, 48], [25, 30]]);
|
|
226
|
+
}));
|
|
227
|
+
|
|
228
|
+
function CreateWallet() {
|
|
229
|
+
return _CreateWallet.apply(this, arguments);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return CreateWallet;
|
|
233
|
+
}()
|
|
229
234
|
/**
|
|
230
235
|
* Get the contract address of the current user's BaseAccessWallet contract
|
|
231
236
|
*
|
|
@@ -234,61 +239,69 @@ function () {
|
|
|
234
239
|
|
|
235
240
|
}, {
|
|
236
241
|
key: "WalletAddress",
|
|
237
|
-
value: function
|
|
238
|
-
var
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
242
|
+
value: function () {
|
|
243
|
+
var _WalletAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
244
|
+
var autoCreate,
|
|
245
|
+
walletAddress,
|
|
246
|
+
_args2 = arguments;
|
|
247
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
248
|
+
while (1) {
|
|
249
|
+
switch (_context2.prev = _context2.next) {
|
|
250
|
+
case 0:
|
|
251
|
+
autoCreate = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : true;
|
|
252
|
+
|
|
253
|
+
if (!(this.walletAddress || this.walletAddressRetrieved)) {
|
|
254
|
+
_context2.next = 3;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
251
257
|
|
|
252
|
-
|
|
258
|
+
return _context2.abrupt("return", this.walletAddress);
|
|
253
259
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
case 3:
|
|
261
|
+
if (!this.walletAddressPromise) {
|
|
262
|
+
this.walletAddressPromise = this.client.CallContractMethod({
|
|
263
|
+
contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
|
|
264
|
+
methodName: "userWallets",
|
|
265
|
+
methodArgs: [this.client.signer.address]
|
|
266
|
+
});
|
|
267
|
+
}
|
|
262
268
|
|
|
263
|
-
|
|
264
|
-
|
|
269
|
+
_context2.next = 6;
|
|
270
|
+
return this.walletAddressPromise;
|
|
265
271
|
|
|
266
|
-
|
|
267
|
-
|
|
272
|
+
case 6:
|
|
273
|
+
walletAddress = _context2.sent;
|
|
268
274
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
if (!Utils.EqualAddress(walletAddress, Utils.nullAddress)) {
|
|
276
|
+
this.walletAddress = walletAddress;
|
|
277
|
+
}
|
|
272
278
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
279
|
+
if (!(!this.walletAddress && autoCreate)) {
|
|
280
|
+
_context2.next = 11;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
277
283
|
|
|
278
|
-
|
|
279
|
-
|
|
284
|
+
_context2.next = 11;
|
|
285
|
+
return this.CreateWallet();
|
|
280
286
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
287
|
+
case 11:
|
|
288
|
+
this.walletAddressRetrieved = true;
|
|
289
|
+
return _context2.abrupt("return", this.walletAddress);
|
|
284
290
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
291
|
+
case 13:
|
|
292
|
+
case "end":
|
|
293
|
+
return _context2.stop();
|
|
294
|
+
}
|
|
288
295
|
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
296
|
+
}, _callee2, this);
|
|
297
|
+
}));
|
|
298
|
+
|
|
299
|
+
function WalletAddress() {
|
|
300
|
+
return _WalletAddress.apply(this, arguments);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return WalletAddress;
|
|
304
|
+
}()
|
|
292
305
|
/**
|
|
293
306
|
* Get the user wallet address for the specified user, if it exists
|
|
294
307
|
*
|
|
@@ -300,56 +313,64 @@ function () {
|
|
|
300
313
|
|
|
301
314
|
}, {
|
|
302
315
|
key: "UserWalletAddress",
|
|
303
|
-
value: function
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
316
|
+
value: function () {
|
|
317
|
+
var _UserWalletAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
318
|
+
var address, walletAddress;
|
|
319
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
320
|
+
while (1) {
|
|
321
|
+
switch (_context3.prev = _context3.next) {
|
|
322
|
+
case 0:
|
|
323
|
+
address = _ref2.address;
|
|
324
|
+
|
|
325
|
+
if (!Utils.EqualAddress(address, this.client.signer.address)) {
|
|
326
|
+
_context3.next = 5;
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
315
329
|
|
|
316
|
-
|
|
317
|
-
|
|
330
|
+
_context3.next = 4;
|
|
331
|
+
return this.WalletAddress();
|
|
318
332
|
|
|
319
|
-
|
|
320
|
-
|
|
333
|
+
case 4:
|
|
334
|
+
return _context3.abrupt("return", _context3.sent);
|
|
321
335
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
336
|
+
case 5:
|
|
337
|
+
if (this.userWalletAddresses[address]) {
|
|
338
|
+
_context3.next = 11;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
327
341
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
342
|
+
this.Log("Retrieving user wallet address for user ".concat(address));
|
|
343
|
+
_context3.next = 9;
|
|
344
|
+
return this.client.CallContractMethod({
|
|
345
|
+
contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
|
|
346
|
+
methodName: "userWallets",
|
|
347
|
+
methodArgs: [address]
|
|
348
|
+
});
|
|
335
349
|
|
|
336
|
-
|
|
337
|
-
|
|
350
|
+
case 9:
|
|
351
|
+
walletAddress = _context3.sent;
|
|
338
352
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
353
|
+
if (!Utils.EqualAddress(walletAddress, Utils.nullAddress)) {
|
|
354
|
+
this.userWalletAddresses[address] = walletAddress;
|
|
355
|
+
}
|
|
342
356
|
|
|
343
|
-
|
|
344
|
-
|
|
357
|
+
case 11:
|
|
358
|
+
return _context3.abrupt("return", this.userWalletAddresses[address]);
|
|
345
359
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
360
|
+
case 12:
|
|
361
|
+
case "end":
|
|
362
|
+
return _context3.stop();
|
|
363
|
+
}
|
|
349
364
|
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
365
|
+
}, _callee3, this);
|
|
366
|
+
}));
|
|
367
|
+
|
|
368
|
+
function UserWalletAddress(_x) {
|
|
369
|
+
return _UserWalletAddress.apply(this, arguments);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return UserWalletAddress;
|
|
373
|
+
}()
|
|
353
374
|
/**
|
|
354
375
|
* Retrieve the user wallet object information (library ID and object ID)
|
|
355
376
|
*
|
|
@@ -362,54 +383,62 @@ function () {
|
|
|
362
383
|
|
|
363
384
|
}, {
|
|
364
385
|
key: "UserWalletObjectInfo",
|
|
365
|
-
value: function
|
|
366
|
-
var
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
386
|
+
value: function () {
|
|
387
|
+
var _UserWalletObjectInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
388
|
+
var _ref3,
|
|
389
|
+
address,
|
|
390
|
+
walletAddress,
|
|
391
|
+
_args4 = arguments;
|
|
392
|
+
|
|
393
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
394
|
+
while (1) {
|
|
395
|
+
switch (_context4.prev = _context4.next) {
|
|
396
|
+
case 0:
|
|
397
|
+
_ref3 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, address = _ref3.address;
|
|
398
|
+
|
|
399
|
+
if (!address) {
|
|
400
|
+
_context4.next = 7;
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
_context4.next = 4;
|
|
405
|
+
return this.UserWalletAddress({
|
|
406
|
+
address: address
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
case 4:
|
|
410
|
+
_context4.t0 = _context4.sent;
|
|
411
|
+
_context4.next = 10;
|
|
379
412
|
break;
|
|
380
|
-
}
|
|
381
413
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
walletAddress = _context4.t0;
|
|
401
|
-
return _context4.abrupt("return", {
|
|
402
|
-
libraryId: this.client.contentSpaceLibraryId,
|
|
403
|
-
objectId: walletAddress ? Utils.AddressToObjectId(walletAddress) : ""
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
case 12:
|
|
407
|
-
case "end":
|
|
408
|
-
return _context4.stop();
|
|
414
|
+
case 7:
|
|
415
|
+
_context4.next = 9;
|
|
416
|
+
return this.WalletAddress();
|
|
417
|
+
|
|
418
|
+
case 9:
|
|
419
|
+
_context4.t0 = _context4.sent;
|
|
420
|
+
|
|
421
|
+
case 10:
|
|
422
|
+
walletAddress = _context4.t0;
|
|
423
|
+
return _context4.abrupt("return", {
|
|
424
|
+
libraryId: this.client.contentSpaceLibraryId,
|
|
425
|
+
objectId: walletAddress ? Utils.AddressToObjectId(walletAddress) : ""
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
case 12:
|
|
429
|
+
case "end":
|
|
430
|
+
return _context4.stop();
|
|
431
|
+
}
|
|
409
432
|
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
433
|
+
}, _callee4, this);
|
|
434
|
+
}));
|
|
435
|
+
|
|
436
|
+
function UserWalletObjectInfo() {
|
|
437
|
+
return _UserWalletObjectInfo.apply(this, arguments);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return UserWalletObjectInfo;
|
|
441
|
+
}()
|
|
413
442
|
/**
|
|
414
443
|
* Access the specified user's public profile metadata
|
|
415
444
|
*
|
|
@@ -441,81 +470,89 @@ function () {
|
|
|
441
470
|
|
|
442
471
|
}, {
|
|
443
472
|
key: "PublicUserMetadata",
|
|
444
|
-
value: function
|
|
445
|
-
var
|
|
473
|
+
value: function () {
|
|
474
|
+
var _PublicUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref4) {
|
|
475
|
+
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;
|
|
476
|
+
|
|
477
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
478
|
+
while (1) {
|
|
479
|
+
switch (_context5.prev = _context5.next) {
|
|
480
|
+
case 0:
|
|
481
|
+
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;
|
|
482
|
+
|
|
483
|
+
if (address) {
|
|
484
|
+
_context5.next = 3;
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
446
487
|
|
|
447
|
-
|
|
448
|
-
while (1) {
|
|
449
|
-
switch (_context5.prev = _context5.next) {
|
|
450
|
-
case 0:
|
|
451
|
-
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;
|
|
488
|
+
return _context5.abrupt("return");
|
|
452
489
|
|
|
453
|
-
|
|
454
|
-
_context5.next =
|
|
455
|
-
|
|
456
|
-
|
|
490
|
+
case 3:
|
|
491
|
+
_context5.next = 5;
|
|
492
|
+
return this.UserWalletAddress({
|
|
493
|
+
address: address
|
|
494
|
+
});
|
|
457
495
|
|
|
458
|
-
|
|
496
|
+
case 5:
|
|
497
|
+
walletAddress = _context5.sent;
|
|
459
498
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}));
|
|
499
|
+
if (walletAddress) {
|
|
500
|
+
_context5.next = 8;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
465
503
|
|
|
466
|
-
|
|
467
|
-
walletAddress = _context5.sent;
|
|
504
|
+
return _context5.abrupt("return");
|
|
468
505
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
506
|
+
case 8:
|
|
507
|
+
metadataSubtree = UrlJoin("public", metadataSubtree || "/");
|
|
508
|
+
_context5.next = 11;
|
|
509
|
+
return this.UserWalletObjectInfo({
|
|
510
|
+
address: address
|
|
511
|
+
});
|
|
473
512
|
|
|
474
|
-
|
|
513
|
+
case 11:
|
|
514
|
+
_yield$this$UserWalle = _context5.sent;
|
|
515
|
+
libraryId = _yield$this$UserWalle.libraryId;
|
|
516
|
+
objectId = _yield$this$UserWalle.objectId;
|
|
475
517
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
address: address
|
|
481
|
-
}));
|
|
518
|
+
if (objectId) {
|
|
519
|
+
_context5.next = 16;
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
482
522
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
523
|
+
return _context5.abrupt("return");
|
|
524
|
+
|
|
525
|
+
case 16:
|
|
526
|
+
_context5.next = 18;
|
|
527
|
+
return this.client.ContentObjectMetadata({
|
|
528
|
+
libraryId: libraryId,
|
|
529
|
+
objectId: objectId,
|
|
530
|
+
queryParams: queryParams,
|
|
531
|
+
select: select,
|
|
532
|
+
metadataSubtree: metadataSubtree,
|
|
533
|
+
resolveLinks: resolveLinks,
|
|
534
|
+
resolveIncludeSource: resolveIncludeSource,
|
|
535
|
+
resolveIgnoreErrors: resolveIgnoreErrors,
|
|
536
|
+
linkDepthLimit: linkDepthLimit
|
|
537
|
+
});
|
|
487
538
|
|
|
488
|
-
|
|
489
|
-
_context5.
|
|
490
|
-
break;
|
|
491
|
-
}
|
|
539
|
+
case 18:
|
|
540
|
+
return _context5.abrupt("return", _context5.sent);
|
|
492
541
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
return _regeneratorRuntime.awrap(this.client.ContentObjectMetadata({
|
|
498
|
-
libraryId: libraryId,
|
|
499
|
-
objectId: objectId,
|
|
500
|
-
queryParams: queryParams,
|
|
501
|
-
select: select,
|
|
502
|
-
metadataSubtree: metadataSubtree,
|
|
503
|
-
resolveLinks: resolveLinks,
|
|
504
|
-
resolveIncludeSource: resolveIncludeSource,
|
|
505
|
-
resolveIgnoreErrors: resolveIgnoreErrors,
|
|
506
|
-
linkDepthLimit: linkDepthLimit
|
|
507
|
-
}));
|
|
508
|
-
|
|
509
|
-
case 18:
|
|
510
|
-
return _context5.abrupt("return", _context5.sent);
|
|
511
|
-
|
|
512
|
-
case 19:
|
|
513
|
-
case "end":
|
|
514
|
-
return _context5.stop();
|
|
542
|
+
case 19:
|
|
543
|
+
case "end":
|
|
544
|
+
return _context5.stop();
|
|
545
|
+
}
|
|
515
546
|
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
547
|
+
}, _callee5, this);
|
|
548
|
+
}));
|
|
549
|
+
|
|
550
|
+
function PublicUserMetadata(_x2) {
|
|
551
|
+
return _PublicUserMetadata.apply(this, arguments);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return PublicUserMetadata;
|
|
555
|
+
}()
|
|
519
556
|
/**
|
|
520
557
|
* Access the current user's metadata
|
|
521
558
|
*
|
|
@@ -550,63 +587,71 @@ function () {
|
|
|
550
587
|
|
|
551
588
|
}, {
|
|
552
589
|
key: "UserMetadata",
|
|
553
|
-
value: function
|
|
554
|
-
var
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
590
|
+
value: function () {
|
|
591
|
+
var _UserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
592
|
+
var _ref5,
|
|
593
|
+
_ref5$metadataSubtree,
|
|
594
|
+
metadataSubtree,
|
|
595
|
+
_ref5$queryParams,
|
|
596
|
+
queryParams,
|
|
597
|
+
_ref5$select,
|
|
598
|
+
select,
|
|
599
|
+
_ref5$resolveLinks,
|
|
600
|
+
resolveLinks,
|
|
601
|
+
_ref5$resolveIncludeS,
|
|
602
|
+
resolveIncludeSource,
|
|
603
|
+
_ref5$resolveIgnoreEr,
|
|
604
|
+
resolveIgnoreErrors,
|
|
605
|
+
_ref5$linkDepthLimit,
|
|
606
|
+
linkDepthLimit,
|
|
607
|
+
_yield$this$UserWalle2,
|
|
608
|
+
libraryId,
|
|
609
|
+
objectId,
|
|
610
|
+
_args6 = arguments;
|
|
611
|
+
|
|
612
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
613
|
+
while (1) {
|
|
614
|
+
switch (_context6.prev = _context6.next) {
|
|
615
|
+
case 0:
|
|
616
|
+
_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;
|
|
617
|
+
this.Log("Accessing private user metadata at ".concat(metadataSubtree));
|
|
618
|
+
_context6.next = 4;
|
|
619
|
+
return this.UserWalletObjectInfo();
|
|
620
|
+
|
|
621
|
+
case 4:
|
|
622
|
+
_yield$this$UserWalle2 = _context6.sent;
|
|
623
|
+
libraryId = _yield$this$UserWalle2.libraryId;
|
|
624
|
+
objectId = _yield$this$UserWalle2.objectId;
|
|
625
|
+
_context6.next = 9;
|
|
626
|
+
return this.client.ContentObjectMetadata({
|
|
627
|
+
libraryId: libraryId,
|
|
628
|
+
objectId: objectId,
|
|
629
|
+
metadataSubtree: metadataSubtree,
|
|
630
|
+
queryParams: queryParams,
|
|
631
|
+
select: select,
|
|
632
|
+
resolveLinks: resolveLinks,
|
|
633
|
+
resolveIncludeSource: resolveIncludeSource,
|
|
634
|
+
resolveIgnoreErrors: resolveIgnoreErrors,
|
|
635
|
+
linkDepthLimit: linkDepthLimit
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
case 9:
|
|
639
|
+
return _context6.abrupt("return", _context6.sent);
|
|
640
|
+
|
|
641
|
+
case 10:
|
|
642
|
+
case "end":
|
|
643
|
+
return _context6.stop();
|
|
644
|
+
}
|
|
606
645
|
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
|
|
646
|
+
}, _callee6, this);
|
|
647
|
+
}));
|
|
648
|
+
|
|
649
|
+
function UserMetadata() {
|
|
650
|
+
return _UserMetadata.apply(this, arguments);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return UserMetadata;
|
|
654
|
+
}()
|
|
610
655
|
/**
|
|
611
656
|
* Merge the current user's profile metadata
|
|
612
657
|
*
|
|
@@ -617,55 +662,63 @@ function () {
|
|
|
617
662
|
|
|
618
663
|
}, {
|
|
619
664
|
key: "MergeUserMetadata",
|
|
620
|
-
value: function
|
|
621
|
-
var
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
+
value: function () {
|
|
666
|
+
var _MergeUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref6) {
|
|
667
|
+
var _ref6$metadataSubtree, metadataSubtree, _ref6$metadata, metadata, _yield$this$UserWalle3, libraryId, objectId, editRequest;
|
|
668
|
+
|
|
669
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
670
|
+
while (1) {
|
|
671
|
+
switch (_context7.prev = _context7.next) {
|
|
672
|
+
case 0:
|
|
673
|
+
_ref6$metadataSubtree = _ref6.metadataSubtree, metadataSubtree = _ref6$metadataSubtree === void 0 ? "/" : _ref6$metadataSubtree, _ref6$metadata = _ref6.metadata, metadata = _ref6$metadata === void 0 ? {} : _ref6$metadata;
|
|
674
|
+
this.Log("Merging user metadata at ".concat(metadataSubtree));
|
|
675
|
+
_context7.next = 4;
|
|
676
|
+
return this.UserWalletObjectInfo();
|
|
677
|
+
|
|
678
|
+
case 4:
|
|
679
|
+
_yield$this$UserWalle3 = _context7.sent;
|
|
680
|
+
libraryId = _yield$this$UserWalle3.libraryId;
|
|
681
|
+
objectId = _yield$this$UserWalle3.objectId;
|
|
682
|
+
_context7.next = 9;
|
|
683
|
+
return this.client.EditContentObject({
|
|
684
|
+
libraryId: libraryId,
|
|
685
|
+
objectId: objectId
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
case 9:
|
|
689
|
+
editRequest = _context7.sent;
|
|
690
|
+
_context7.next = 12;
|
|
691
|
+
return this.client.MergeMetadata({
|
|
692
|
+
libraryId: libraryId,
|
|
693
|
+
objectId: objectId,
|
|
694
|
+
writeToken: editRequest.write_token,
|
|
695
|
+
metadataSubtree: metadataSubtree,
|
|
696
|
+
metadata: metadata
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
case 12:
|
|
700
|
+
_context7.next = 14;
|
|
701
|
+
return this.client.FinalizeContentObject({
|
|
702
|
+
libraryId: libraryId,
|
|
703
|
+
objectId: objectId,
|
|
704
|
+
writeToken: editRequest.write_token,
|
|
705
|
+
commitMessage: "Merge user metadata"
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
case 14:
|
|
709
|
+
case "end":
|
|
710
|
+
return _context7.stop();
|
|
711
|
+
}
|
|
665
712
|
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
|
|
713
|
+
}, _callee7, this);
|
|
714
|
+
}));
|
|
715
|
+
|
|
716
|
+
function MergeUserMetadata(_x3) {
|
|
717
|
+
return _MergeUserMetadata.apply(this, arguments);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
return MergeUserMetadata;
|
|
721
|
+
}()
|
|
669
722
|
/**
|
|
670
723
|
* Replace the current user's profile metadata
|
|
671
724
|
*
|
|
@@ -676,55 +729,63 @@ function () {
|
|
|
676
729
|
|
|
677
730
|
}, {
|
|
678
731
|
key: "ReplaceUserMetadata",
|
|
679
|
-
value: function
|
|
680
|
-
var
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
732
|
+
value: function () {
|
|
733
|
+
var _ReplaceUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
|
|
734
|
+
var _ref7$metadataSubtree, metadataSubtree, _ref7$metadata, metadata, _yield$this$UserWalle4, libraryId, objectId, editRequest;
|
|
735
|
+
|
|
736
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
737
|
+
while (1) {
|
|
738
|
+
switch (_context8.prev = _context8.next) {
|
|
739
|
+
case 0:
|
|
740
|
+
_ref7$metadataSubtree = _ref7.metadataSubtree, metadataSubtree = _ref7$metadataSubtree === void 0 ? "/" : _ref7$metadataSubtree, _ref7$metadata = _ref7.metadata, metadata = _ref7$metadata === void 0 ? {} : _ref7$metadata;
|
|
741
|
+
this.Log("Replacing user metadata at ".concat(metadataSubtree));
|
|
742
|
+
_context8.next = 4;
|
|
743
|
+
return this.UserWalletObjectInfo();
|
|
744
|
+
|
|
745
|
+
case 4:
|
|
746
|
+
_yield$this$UserWalle4 = _context8.sent;
|
|
747
|
+
libraryId = _yield$this$UserWalle4.libraryId;
|
|
748
|
+
objectId = _yield$this$UserWalle4.objectId;
|
|
749
|
+
_context8.next = 9;
|
|
750
|
+
return this.client.EditContentObject({
|
|
751
|
+
libraryId: libraryId,
|
|
752
|
+
objectId: objectId
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
case 9:
|
|
756
|
+
editRequest = _context8.sent;
|
|
757
|
+
_context8.next = 12;
|
|
758
|
+
return this.client.ReplaceMetadata({
|
|
759
|
+
libraryId: libraryId,
|
|
760
|
+
objectId: objectId,
|
|
761
|
+
writeToken: editRequest.write_token,
|
|
762
|
+
metadataSubtree: metadataSubtree,
|
|
763
|
+
metadata: metadata
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
case 12:
|
|
767
|
+
_context8.next = 14;
|
|
768
|
+
return this.client.FinalizeContentObject({
|
|
769
|
+
libraryId: libraryId,
|
|
770
|
+
objectId: objectId,
|
|
771
|
+
writeToken: editRequest.write_token,
|
|
772
|
+
commitMessage: "Replace user metadata"
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
case 14:
|
|
776
|
+
case "end":
|
|
777
|
+
return _context8.stop();
|
|
778
|
+
}
|
|
724
779
|
}
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
|
|
780
|
+
}, _callee8, this);
|
|
781
|
+
}));
|
|
782
|
+
|
|
783
|
+
function ReplaceUserMetadata(_x4) {
|
|
784
|
+
return _ReplaceUserMetadata.apply(this, arguments);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
return ReplaceUserMetadata;
|
|
788
|
+
}()
|
|
728
789
|
/**
|
|
729
790
|
* Delete the specified subtree from the users profile metadata
|
|
730
791
|
*
|
|
@@ -734,54 +795,62 @@ function () {
|
|
|
734
795
|
|
|
735
796
|
}, {
|
|
736
797
|
key: "DeleteUserMetadata",
|
|
737
|
-
value: function
|
|
738
|
-
var
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
798
|
+
value: function () {
|
|
799
|
+
var _DeleteUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref8) {
|
|
800
|
+
var _ref8$metadataSubtree, metadataSubtree, _yield$this$UserWalle5, libraryId, objectId, editRequest;
|
|
801
|
+
|
|
802
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
803
|
+
while (1) {
|
|
804
|
+
switch (_context9.prev = _context9.next) {
|
|
805
|
+
case 0:
|
|
806
|
+
_ref8$metadataSubtree = _ref8.metadataSubtree, metadataSubtree = _ref8$metadataSubtree === void 0 ? "/" : _ref8$metadataSubtree;
|
|
807
|
+
this.Log("Deleting user metadata at ".concat(metadataSubtree));
|
|
808
|
+
_context9.next = 4;
|
|
809
|
+
return this.UserWalletObjectInfo();
|
|
810
|
+
|
|
811
|
+
case 4:
|
|
812
|
+
_yield$this$UserWalle5 = _context9.sent;
|
|
813
|
+
libraryId = _yield$this$UserWalle5.libraryId;
|
|
814
|
+
objectId = _yield$this$UserWalle5.objectId;
|
|
815
|
+
_context9.next = 9;
|
|
816
|
+
return this.client.EditContentObject({
|
|
817
|
+
libraryId: libraryId,
|
|
818
|
+
objectId: objectId
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
case 9:
|
|
822
|
+
editRequest = _context9.sent;
|
|
823
|
+
_context9.next = 12;
|
|
824
|
+
return this.client.DeleteMetadata({
|
|
825
|
+
libraryId: libraryId,
|
|
826
|
+
objectId: objectId,
|
|
827
|
+
writeToken: editRequest.write_token,
|
|
828
|
+
metadataSubtree: metadataSubtree
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
case 12:
|
|
832
|
+
_context9.next = 14;
|
|
833
|
+
return this.client.FinalizeContentObject({
|
|
834
|
+
libraryId: libraryId,
|
|
835
|
+
objectId: objectId,
|
|
836
|
+
writeToken: editRequest.write_token,
|
|
837
|
+
commitMessage: "Delete user metadata"
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
case 14:
|
|
841
|
+
case "end":
|
|
842
|
+
return _context9.stop();
|
|
843
|
+
}
|
|
781
844
|
}
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
|
|
845
|
+
}, _callee9, this);
|
|
846
|
+
}));
|
|
847
|
+
|
|
848
|
+
function DeleteUserMetadata(_x5) {
|
|
849
|
+
return _DeleteUserMetadata.apply(this, arguments);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
return DeleteUserMetadata;
|
|
853
|
+
}()
|
|
785
854
|
/**
|
|
786
855
|
* Return the permissions the current user allows for apps to access their profile.
|
|
787
856
|
*
|
|
@@ -794,36 +863,44 @@ function () {
|
|
|
794
863
|
|
|
795
864
|
}, {
|
|
796
865
|
key: "AccessLevel",
|
|
797
|
-
value: function
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
if (_context10.t0) {
|
|
811
|
-
_context10.next = 5;
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
866
|
+
value: function () {
|
|
867
|
+
var _AccessLevel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
868
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
869
|
+
while (1) {
|
|
870
|
+
switch (_context10.prev = _context10.next) {
|
|
871
|
+
case 0:
|
|
872
|
+
_context10.next = 2;
|
|
873
|
+
return this.UserMetadata({
|
|
874
|
+
metadataSubtree: "access_level"
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
case 2:
|
|
878
|
+
_context10.t0 = _context10.sent;
|
|
814
879
|
|
|
815
|
-
|
|
880
|
+
if (_context10.t0) {
|
|
881
|
+
_context10.next = 5;
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
_context10.t0 = "prompt";
|
|
816
886
|
|
|
817
|
-
|
|
818
|
-
|
|
887
|
+
case 5:
|
|
888
|
+
return _context10.abrupt("return", _context10.t0);
|
|
819
889
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
890
|
+
case 6:
|
|
891
|
+
case "end":
|
|
892
|
+
return _context10.stop();
|
|
893
|
+
}
|
|
823
894
|
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
895
|
+
}, _callee10, this);
|
|
896
|
+
}));
|
|
897
|
+
|
|
898
|
+
function AccessLevel() {
|
|
899
|
+
return _AccessLevel.apply(this, arguments);
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
return AccessLevel;
|
|
903
|
+
}()
|
|
827
904
|
/**
|
|
828
905
|
* Set the current user's access level.
|
|
829
906
|
*
|
|
@@ -835,36 +912,44 @@ function () {
|
|
|
835
912
|
|
|
836
913
|
}, {
|
|
837
914
|
key: "SetAccessLevel",
|
|
838
|
-
value: function
|
|
839
|
-
var
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
915
|
+
value: function () {
|
|
916
|
+
var _SetAccessLevel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref9) {
|
|
917
|
+
var level;
|
|
918
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
919
|
+
while (1) {
|
|
920
|
+
switch (_context11.prev = _context11.next) {
|
|
921
|
+
case 0:
|
|
922
|
+
level = _ref9.level;
|
|
923
|
+
level = level.toLowerCase();
|
|
924
|
+
|
|
925
|
+
if (["private", "prompt", "public"].includes(level)) {
|
|
926
|
+
_context11.next = 4;
|
|
927
|
+
break;
|
|
928
|
+
}
|
|
851
929
|
|
|
852
|
-
|
|
930
|
+
throw new Error("Invalid access level: " + level);
|
|
853
931
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
932
|
+
case 4:
|
|
933
|
+
_context11.next = 6;
|
|
934
|
+
return this.ReplaceUserMetadata({
|
|
935
|
+
metadataSubtree: "access_level",
|
|
936
|
+
metadata: level
|
|
937
|
+
});
|
|
860
938
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
939
|
+
case 6:
|
|
940
|
+
case "end":
|
|
941
|
+
return _context11.stop();
|
|
942
|
+
}
|
|
864
943
|
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
944
|
+
}, _callee11, this);
|
|
945
|
+
}));
|
|
946
|
+
|
|
947
|
+
function SetAccessLevel(_x6) {
|
|
948
|
+
return _SetAccessLevel.apply(this, arguments);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
return SetAccessLevel;
|
|
952
|
+
}()
|
|
868
953
|
/**
|
|
869
954
|
* Return the ID of the tenant this user belongs to, if set.
|
|
870
955
|
*
|
|
@@ -873,107 +958,136 @@ function () {
|
|
|
873
958
|
|
|
874
959
|
}, {
|
|
875
960
|
key: "TenantId",
|
|
876
|
-
value: function
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
961
|
+
value: function () {
|
|
962
|
+
var _TenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
963
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
964
|
+
while (1) {
|
|
965
|
+
switch (_context12.prev = _context12.next) {
|
|
966
|
+
case 0:
|
|
967
|
+
if (this.tenantId) {
|
|
968
|
+
_context12.next = 4;
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
885
971
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
972
|
+
_context12.next = 3;
|
|
973
|
+
return this.UserMetadata({
|
|
974
|
+
metadataSubtree: "tenantId"
|
|
975
|
+
});
|
|
890
976
|
|
|
891
|
-
|
|
892
|
-
|
|
977
|
+
case 3:
|
|
978
|
+
this.tenantId = _context12.sent;
|
|
893
979
|
|
|
894
|
-
|
|
895
|
-
|
|
980
|
+
case 4:
|
|
981
|
+
return _context12.abrupt("return", this.tenantId);
|
|
896
982
|
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
983
|
+
case 5:
|
|
984
|
+
case "end":
|
|
985
|
+
return _context12.stop();
|
|
986
|
+
}
|
|
900
987
|
}
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
|
|
988
|
+
}, _callee12, this);
|
|
989
|
+
}));
|
|
990
|
+
|
|
991
|
+
function TenantId() {
|
|
992
|
+
return _TenantId.apply(this, arguments);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
return TenantId;
|
|
996
|
+
}()
|
|
904
997
|
/**
|
|
905
998
|
* Set the current user's tenant
|
|
906
999
|
*
|
|
907
1000
|
* Note: This method is not accessible to applications. Eluvio core will drop the request.
|
|
908
1001
|
*
|
|
909
1002
|
* @namedParams
|
|
910
|
-
* @param
|
|
1003
|
+
* @param {string} id - The tenant ID in hash format
|
|
1004
|
+
* @param {string} address - The group address to use in the hash if id is not provided
|
|
911
1005
|
*/
|
|
912
1006
|
|
|
913
1007
|
}, {
|
|
914
1008
|
key: "SetTenantId",
|
|
915
|
-
value: function
|
|
916
|
-
var
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1009
|
+
value: function () {
|
|
1010
|
+
var _SetTenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref10) {
|
|
1011
|
+
var id, address, version;
|
|
1012
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1013
|
+
while (1) {
|
|
1014
|
+
switch (_context13.prev = _context13.next) {
|
|
1015
|
+
case 0:
|
|
1016
|
+
id = _ref10.id, address = _ref10.address;
|
|
1017
|
+
|
|
1018
|
+
if (!(id && (!id.startsWith("iten") || !Utils.ValidHash(id)))) {
|
|
1019
|
+
_context13.next = 3;
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
927
1022
|
|
|
928
|
-
|
|
1023
|
+
throw Error("Invalid tenant ID: ".concat(id));
|
|
929
1024
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
1025
|
+
case 3:
|
|
1026
|
+
if (!address) {
|
|
1027
|
+
_context13.next = 7;
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
934
1030
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1031
|
+
if (Utils.ValidAddress(address)) {
|
|
1032
|
+
_context13.next = 6;
|
|
1033
|
+
break;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
throw Error("Invalid address: ".concat(address));
|
|
940
1037
|
|
|
941
|
-
|
|
942
|
-
|
|
1038
|
+
case 6:
|
|
1039
|
+
id = "iten".concat(Utils.AddressToHash(address));
|
|
943
1040
|
|
|
944
|
-
|
|
1041
|
+
case 7:
|
|
1042
|
+
_context13.prev = 7;
|
|
945
1043
|
_context13.next = 10;
|
|
946
|
-
|
|
947
|
-
|
|
1044
|
+
return this.client.AccessType({
|
|
1045
|
+
id: id
|
|
1046
|
+
});
|
|
948
1047
|
|
|
949
|
-
|
|
1048
|
+
case 10:
|
|
1049
|
+
version = _context13.sent;
|
|
950
1050
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1051
|
+
if (!(version !== this.client.authClient.ACCESS_TYPES.GROUP)) {
|
|
1052
|
+
_context13.next = 13;
|
|
1053
|
+
break;
|
|
1054
|
+
}
|
|
954
1055
|
|
|
955
|
-
|
|
956
|
-
_context13.prev = 12;
|
|
957
|
-
_context13.t0 = _context13["catch"](4);
|
|
958
|
-
throw Error("Invalid tenant ID: " + id);
|
|
1056
|
+
throw Error("Invalid tenant ID: " + id);
|
|
959
1057
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
metadataSubtree: "tenantId",
|
|
964
|
-
metadata: id
|
|
965
|
-
}));
|
|
1058
|
+
case 13:
|
|
1059
|
+
_context13.next = 18;
|
|
1060
|
+
break;
|
|
966
1061
|
|
|
967
|
-
|
|
968
|
-
|
|
1062
|
+
case 15:
|
|
1063
|
+
_context13.prev = 15;
|
|
1064
|
+
_context13.t0 = _context13["catch"](7);
|
|
1065
|
+
throw Error("Invalid tenant ID: " + id);
|
|
969
1066
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1067
|
+
case 18:
|
|
1068
|
+
_context13.next = 20;
|
|
1069
|
+
return this.ReplaceUserMetadata({
|
|
1070
|
+
metadataSubtree: "tenantId",
|
|
1071
|
+
metadata: id
|
|
1072
|
+
});
|
|
1073
|
+
|
|
1074
|
+
case 20:
|
|
1075
|
+
this.tenantId = id;
|
|
1076
|
+
|
|
1077
|
+
case 21:
|
|
1078
|
+
case "end":
|
|
1079
|
+
return _context13.stop();
|
|
1080
|
+
}
|
|
973
1081
|
}
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
|
|
1082
|
+
}, _callee13, this, [[7, 15]]);
|
|
1083
|
+
}));
|
|
1084
|
+
|
|
1085
|
+
function SetTenantId(_x7) {
|
|
1086
|
+
return _SetTenantId.apply(this, arguments);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
return SetTenantId;
|
|
1090
|
+
}()
|
|
977
1091
|
/**
|
|
978
1092
|
* Get the URL of the current user's profile image
|
|
979
1093
|
*
|
|
@@ -991,73 +1105,81 @@ function () {
|
|
|
991
1105
|
|
|
992
1106
|
}, {
|
|
993
1107
|
key: "UserProfileImage",
|
|
994
|
-
value: function
|
|
995
|
-
var
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1108
|
+
value: function () {
|
|
1109
|
+
var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
1110
|
+
var _ref11,
|
|
1111
|
+
address,
|
|
1112
|
+
height,
|
|
1113
|
+
walletAddress,
|
|
1114
|
+
_yield$this$UserWalle6,
|
|
1115
|
+
libraryId,
|
|
1116
|
+
objectId,
|
|
1117
|
+
_args14 = arguments;
|
|
1118
|
+
|
|
1119
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
1120
|
+
while (1) {
|
|
1121
|
+
switch (_context14.prev = _context14.next) {
|
|
1122
|
+
case 0:
|
|
1123
|
+
_ref11 = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {}, address = _ref11.address, height = _ref11.height;
|
|
1124
|
+
|
|
1125
|
+
if (!address) {
|
|
1126
|
+
_context14.next = 7;
|
|
1127
|
+
break;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
_context14.next = 4;
|
|
1131
|
+
return this.UserWalletAddress({
|
|
1132
|
+
address: address
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
case 4:
|
|
1136
|
+
walletAddress = _context14.sent;
|
|
1137
|
+
_context14.next = 9;
|
|
1012
1138
|
break;
|
|
1013
|
-
}
|
|
1014
1139
|
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
}));
|
|
1140
|
+
case 7:
|
|
1141
|
+
address = this.client.signer.address;
|
|
1142
|
+
walletAddress = this.walletAddress;
|
|
1019
1143
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1144
|
+
case 9:
|
|
1145
|
+
if (walletAddress) {
|
|
1146
|
+
_context14.next = 11;
|
|
1147
|
+
break;
|
|
1148
|
+
}
|
|
1024
1149
|
|
|
1025
|
-
|
|
1026
|
-
address = this.client.signer.address;
|
|
1027
|
-
walletAddress = this.walletAddress;
|
|
1150
|
+
return _context14.abrupt("return");
|
|
1028
1151
|
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1152
|
+
case 11:
|
|
1153
|
+
_context14.next = 13;
|
|
1154
|
+
return this.UserWalletObjectInfo({
|
|
1155
|
+
address: address
|
|
1156
|
+
});
|
|
1034
1157
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
height: height,
|
|
1051
|
-
imagePath: "public/profile_image"
|
|
1052
|
-
}));
|
|
1053
|
-
|
|
1054
|
-
case 17:
|
|
1055
|
-
case "end":
|
|
1056
|
-
return _context14.stop();
|
|
1158
|
+
case 13:
|
|
1159
|
+
_yield$this$UserWalle6 = _context14.sent;
|
|
1160
|
+
libraryId = _yield$this$UserWalle6.libraryId;
|
|
1161
|
+
objectId = _yield$this$UserWalle6.objectId;
|
|
1162
|
+
return _context14.abrupt("return", this.client.ContentObjectImageUrl({
|
|
1163
|
+
libraryId: libraryId,
|
|
1164
|
+
objectId: objectId,
|
|
1165
|
+
height: height,
|
|
1166
|
+
imagePath: "public/profile_image"
|
|
1167
|
+
}));
|
|
1168
|
+
|
|
1169
|
+
case 17:
|
|
1170
|
+
case "end":
|
|
1171
|
+
return _context14.stop();
|
|
1172
|
+
}
|
|
1057
1173
|
}
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1174
|
+
}, _callee14, this);
|
|
1175
|
+
}));
|
|
1176
|
+
|
|
1177
|
+
function UserProfileImage() {
|
|
1178
|
+
return _UserProfileImage.apply(this, arguments);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
return UserProfileImage;
|
|
1182
|
+
}()
|
|
1061
1183
|
/**
|
|
1062
1184
|
* Set a new profile image for the current user
|
|
1063
1185
|
*
|
|
@@ -1067,66 +1189,74 @@ function () {
|
|
|
1067
1189
|
|
|
1068
1190
|
}, {
|
|
1069
1191
|
key: "SetUserProfileImage",
|
|
1070
|
-
value: function
|
|
1071
|
-
var
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1192
|
+
value: function () {
|
|
1193
|
+
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref12) {
|
|
1194
|
+
var image, size, _yield$this$UserWalle7, libraryId, objectId, editRequest;
|
|
1195
|
+
|
|
1196
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
1197
|
+
while (1) {
|
|
1198
|
+
switch (_context15.prev = _context15.next) {
|
|
1199
|
+
case 0:
|
|
1200
|
+
image = _ref12.image;
|
|
1201
|
+
this.Log("Setting profile image for user ".concat(this.client.signer.address));
|
|
1202
|
+
size = image.length || image.byteLength || image.size;
|
|
1203
|
+
|
|
1204
|
+
if (!(size > 5000000)) {
|
|
1205
|
+
_context15.next = 5;
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
throw Error("Maximum profile image size is 5MB");
|
|
1210
|
+
|
|
1211
|
+
case 5:
|
|
1212
|
+
_context15.next = 7;
|
|
1213
|
+
return this.UserWalletObjectInfo();
|
|
1214
|
+
|
|
1215
|
+
case 7:
|
|
1216
|
+
_yield$this$UserWalle7 = _context15.sent;
|
|
1217
|
+
libraryId = _yield$this$UserWalle7.libraryId;
|
|
1218
|
+
objectId = _yield$this$UserWalle7.objectId;
|
|
1219
|
+
_context15.next = 12;
|
|
1220
|
+
return this.client.EditContentObject({
|
|
1221
|
+
libraryId: libraryId,
|
|
1222
|
+
objectId: objectId
|
|
1223
|
+
});
|
|
1224
|
+
|
|
1225
|
+
case 12:
|
|
1226
|
+
editRequest = _context15.sent;
|
|
1227
|
+
_context15.next = 15;
|
|
1228
|
+
return this.client.SetContentObjectImage({
|
|
1229
|
+
libraryId: libraryId,
|
|
1230
|
+
objectId: objectId,
|
|
1231
|
+
writeToken: editRequest.write_token,
|
|
1232
|
+
image: image,
|
|
1233
|
+
imageName: "profile_image",
|
|
1234
|
+
imagePath: "public/profile_image"
|
|
1235
|
+
});
|
|
1085
1236
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
objectId: objectId
|
|
1100
|
-
}));
|
|
1101
|
-
|
|
1102
|
-
case 12:
|
|
1103
|
-
editRequest = _context15.sent;
|
|
1104
|
-
_context15.next = 15;
|
|
1105
|
-
return _regeneratorRuntime.awrap(this.client.SetContentObjectImage({
|
|
1106
|
-
libraryId: libraryId,
|
|
1107
|
-
objectId: objectId,
|
|
1108
|
-
writeToken: editRequest.write_token,
|
|
1109
|
-
image: image,
|
|
1110
|
-
imageName: "profile_image",
|
|
1111
|
-
imagePath: "public/profile_image"
|
|
1112
|
-
}));
|
|
1113
|
-
|
|
1114
|
-
case 15:
|
|
1115
|
-
_context15.next = 17;
|
|
1116
|
-
return _regeneratorRuntime.awrap(this.client.FinalizeContentObject({
|
|
1117
|
-
libraryId: libraryId,
|
|
1118
|
-
objectId: objectId,
|
|
1119
|
-
writeToken: editRequest.write_token,
|
|
1120
|
-
commitMessage: "Set user profile image"
|
|
1121
|
-
}));
|
|
1122
|
-
|
|
1123
|
-
case 17:
|
|
1124
|
-
case "end":
|
|
1125
|
-
return _context15.stop();
|
|
1237
|
+
case 15:
|
|
1238
|
+
_context15.next = 17;
|
|
1239
|
+
return this.client.FinalizeContentObject({
|
|
1240
|
+
libraryId: libraryId,
|
|
1241
|
+
objectId: objectId,
|
|
1242
|
+
writeToken: editRequest.write_token,
|
|
1243
|
+
commitMessage: "Set user profile image"
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
case 17:
|
|
1247
|
+
case "end":
|
|
1248
|
+
return _context15.stop();
|
|
1249
|
+
}
|
|
1126
1250
|
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1251
|
+
}, _callee15, this);
|
|
1252
|
+
}));
|
|
1253
|
+
|
|
1254
|
+
function SetUserProfileImage(_x8) {
|
|
1255
|
+
return _SetUserProfileImage.apply(this, arguments);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
return SetUserProfileImage;
|
|
1259
|
+
}()
|
|
1130
1260
|
/**
|
|
1131
1261
|
* Get the accumulated tags for the current user
|
|
1132
1262
|
*
|
|
@@ -1139,229 +1269,253 @@ function () {
|
|
|
1139
1269
|
|
|
1140
1270
|
}, {
|
|
1141
1271
|
key: "CollectedTags",
|
|
1142
|
-
value: function
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
case 2:
|
|
1153
|
-
_context16.t0 = _context16.sent;
|
|
1154
|
-
|
|
1155
|
-
if (_context16.t0) {
|
|
1156
|
-
_context16.next = 5;
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1272
|
+
value: function () {
|
|
1273
|
+
var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
1274
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1275
|
+
while (1) {
|
|
1276
|
+
switch (_context16.prev = _context16.next) {
|
|
1277
|
+
case 0:
|
|
1278
|
+
_context16.next = 2;
|
|
1279
|
+
return this.UserMetadata({
|
|
1280
|
+
metadataSubtree: "collected_data"
|
|
1281
|
+
});
|
|
1159
1282
|
|
|
1160
|
-
|
|
1283
|
+
case 2:
|
|
1284
|
+
_context16.t0 = _context16.sent;
|
|
1161
1285
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1286
|
+
if (_context16.t0) {
|
|
1287
|
+
_context16.next = 5;
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
_context16.t0 = {};
|
|
1292
|
+
|
|
1293
|
+
case 5:
|
|
1294
|
+
return _context16.abrupt("return", _context16.t0);
|
|
1164
1295
|
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1296
|
+
case 6:
|
|
1297
|
+
case "end":
|
|
1298
|
+
return _context16.stop();
|
|
1299
|
+
}
|
|
1168
1300
|
}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1301
|
+
}, _callee16, this);
|
|
1302
|
+
}));
|
|
1303
|
+
|
|
1304
|
+
function CollectedTags() {
|
|
1305
|
+
return _CollectedTags.apply(this, arguments);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
return CollectedTags;
|
|
1309
|
+
}() // Ensure recording tags never causes action to fail
|
|
1172
1310
|
|
|
1173
1311
|
}, {
|
|
1174
1312
|
key: "RecordTags",
|
|
1175
|
-
value: function
|
|
1176
|
-
var
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1313
|
+
value: function () {
|
|
1314
|
+
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref13) {
|
|
1315
|
+
var libraryId, objectId, versionHash;
|
|
1316
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1317
|
+
while (1) {
|
|
1318
|
+
switch (_context17.prev = _context17.next) {
|
|
1319
|
+
case 0:
|
|
1320
|
+
libraryId = _ref13.libraryId, objectId = _ref13.objectId, versionHash = _ref13.versionHash;
|
|
1321
|
+
_context17.prev = 1;
|
|
1322
|
+
_context17.next = 4;
|
|
1323
|
+
return this.__RecordTags({
|
|
1324
|
+
libraryId: libraryId,
|
|
1325
|
+
objectId: objectId,
|
|
1326
|
+
versionHash: versionHash
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1329
|
+
case 4:
|
|
1330
|
+
_context17.next = 9;
|
|
1331
|
+
break;
|
|
1332
|
+
|
|
1333
|
+
case 6:
|
|
1334
|
+
_context17.prev = 6;
|
|
1335
|
+
_context17.t0 = _context17["catch"](1);
|
|
1336
|
+
// eslint-disable-next-line no-console
|
|
1337
|
+
console.error(_context17.t0);
|
|
1338
|
+
|
|
1339
|
+
case 9:
|
|
1340
|
+
case "end":
|
|
1341
|
+
return _context17.stop();
|
|
1342
|
+
}
|
|
1203
1343
|
}
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1344
|
+
}, _callee17, this, [[1, 6]]);
|
|
1345
|
+
}));
|
|
1346
|
+
|
|
1347
|
+
function RecordTags(_x9) {
|
|
1348
|
+
return _RecordTags.apply(this, arguments);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
return RecordTags;
|
|
1352
|
+
}()
|
|
1207
1353
|
}, {
|
|
1208
1354
|
key: "__RecordTags",
|
|
1209
|
-
value: function
|
|
1210
|
-
var
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
case 3:
|
|
1222
|
-
accessType = _context18.sent;
|
|
1223
|
-
|
|
1224
|
-
if (!(accessType !== "object")) {
|
|
1225
|
-
_context18.next = 6;
|
|
1226
|
-
break;
|
|
1227
|
-
}
|
|
1355
|
+
value: function () {
|
|
1356
|
+
var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref14) {
|
|
1357
|
+
var libraryId, objectId, versionHash, accessType, seen, walletObjectInfo, userLibraryId, userObjectId, editRequest, contentTags, userTags, formattedTags;
|
|
1358
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1359
|
+
while (1) {
|
|
1360
|
+
switch (_context18.prev = _context18.next) {
|
|
1361
|
+
case 0:
|
|
1362
|
+
libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash;
|
|
1363
|
+
_context18.next = 3;
|
|
1364
|
+
return this.client.AccessType({
|
|
1365
|
+
id: objectId
|
|
1366
|
+
});
|
|
1228
1367
|
|
|
1229
|
-
|
|
1368
|
+
case 3:
|
|
1369
|
+
accessType = _context18.sent;
|
|
1230
1370
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
}
|
|
1371
|
+
if (!(accessType !== "object")) {
|
|
1372
|
+
_context18.next = 6;
|
|
1373
|
+
break;
|
|
1374
|
+
}
|
|
1236
1375
|
|
|
1237
|
-
|
|
1238
|
-
return _regeneratorRuntime.awrap(this.client.ContentObjectLibraryId({
|
|
1239
|
-
objectId: objectId
|
|
1240
|
-
}));
|
|
1376
|
+
return _context18.abrupt("return");
|
|
1241
1377
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1378
|
+
case 6:
|
|
1379
|
+
if (!(!versionHash && !libraryId)) {
|
|
1380
|
+
_context18.next = 10;
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1244
1383
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
}
|
|
1384
|
+
_context18.next = 9;
|
|
1385
|
+
return this.client.ContentObjectLibraryId({
|
|
1386
|
+
objectId: objectId
|
|
1387
|
+
});
|
|
1250
1388
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
libraryId: libraryId,
|
|
1254
|
-
objectId: objectId
|
|
1255
|
-
}));
|
|
1389
|
+
case 9:
|
|
1390
|
+
libraryId = _context18.sent;
|
|
1256
1391
|
|
|
1257
|
-
|
|
1258
|
-
|
|
1392
|
+
case 10:
|
|
1393
|
+
if (versionHash) {
|
|
1394
|
+
_context18.next = 14;
|
|
1395
|
+
break;
|
|
1396
|
+
}
|
|
1259
1397
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1398
|
+
_context18.next = 13;
|
|
1399
|
+
return this.client.ContentObject({
|
|
1400
|
+
libraryId: libraryId,
|
|
1401
|
+
objectId: objectId
|
|
1402
|
+
});
|
|
1265
1403
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1404
|
+
case 13:
|
|
1405
|
+
versionHash = _context18.sent.hash;
|
|
1268
1406
|
|
|
1269
|
-
|
|
1270
|
-
_context18.next =
|
|
1271
|
-
|
|
1272
|
-
|
|
1407
|
+
case 14:
|
|
1408
|
+
_context18.next = 16;
|
|
1409
|
+
return this.UserMetadata({
|
|
1410
|
+
metadataSubtree: UrlJoin("accessed_content", versionHash)
|
|
1411
|
+
});
|
|
1273
1412
|
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
case 19:
|
|
1277
|
-
_context18.next = 21;
|
|
1278
|
-
return _regeneratorRuntime.awrap(this.UserWalletObjectInfo());
|
|
1279
|
-
|
|
1280
|
-
case 21:
|
|
1281
|
-
walletObjectInfo = _context18.sent;
|
|
1282
|
-
userLibraryId = walletObjectInfo.libraryId;
|
|
1283
|
-
userObjectId = walletObjectInfo.objectId; // Mark content as seen
|
|
1284
|
-
|
|
1285
|
-
_context18.next = 26;
|
|
1286
|
-
return _regeneratorRuntime.awrap(this.client.EditContentObject({
|
|
1287
|
-
libraryId: userLibraryId,
|
|
1288
|
-
objectId: userObjectId
|
|
1289
|
-
}));
|
|
1290
|
-
|
|
1291
|
-
case 26:
|
|
1292
|
-
editRequest = _context18.sent;
|
|
1293
|
-
_context18.next = 29;
|
|
1294
|
-
return _regeneratorRuntime.awrap(this.client.ReplaceMetadata({
|
|
1295
|
-
libraryId: userLibraryId,
|
|
1296
|
-
objectId: userObjectId,
|
|
1297
|
-
writeToken: editRequest.write_token,
|
|
1298
|
-
metadataSubtree: UrlJoin("accessed_content", versionHash),
|
|
1299
|
-
metadata: Date.now()
|
|
1300
|
-
}));
|
|
1301
|
-
|
|
1302
|
-
case 29:
|
|
1303
|
-
_context18.next = 31;
|
|
1304
|
-
return _regeneratorRuntime.awrap(this.client.ContentObjectMetadata({
|
|
1305
|
-
libraryId: libraryId,
|
|
1306
|
-
objectId: objectId,
|
|
1307
|
-
versionHash: versionHash,
|
|
1308
|
-
metadataSubtree: "video_tags"
|
|
1309
|
-
}));
|
|
1310
|
-
|
|
1311
|
-
case 31:
|
|
1312
|
-
contentTags = _context18.sent;
|
|
1313
|
-
|
|
1314
|
-
if (!(contentTags && contentTags.length > 0)) {
|
|
1315
|
-
_context18.next = 40;
|
|
1316
|
-
break;
|
|
1317
|
-
}
|
|
1413
|
+
case 16:
|
|
1414
|
+
seen = _context18.sent;
|
|
1318
1415
|
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
case 35:
|
|
1323
|
-
userTags = _context18.sent;
|
|
1324
|
-
formattedTags = this.__FormatVideoTags(contentTags);
|
|
1325
|
-
Object.keys(formattedTags).forEach(function (tag) {
|
|
1326
|
-
if (userTags[tag]) {
|
|
1327
|
-
// User has seen this tag before
|
|
1328
|
-
userTags[tag].occurrences += 1;
|
|
1329
|
-
userTags[tag].aggregate += formattedTags[tag];
|
|
1330
|
-
} else {
|
|
1331
|
-
// New tag
|
|
1332
|
-
userTags[tag] = {
|
|
1333
|
-
occurrences: 1,
|
|
1334
|
-
aggregate: formattedTags[tag]
|
|
1335
|
-
};
|
|
1416
|
+
if (!seen) {
|
|
1417
|
+
_context18.next = 19;
|
|
1418
|
+
break;
|
|
1336
1419
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1420
|
+
|
|
1421
|
+
return _context18.abrupt("return");
|
|
1422
|
+
|
|
1423
|
+
case 19:
|
|
1424
|
+
_context18.next = 21;
|
|
1425
|
+
return this.UserWalletObjectInfo();
|
|
1426
|
+
|
|
1427
|
+
case 21:
|
|
1428
|
+
walletObjectInfo = _context18.sent;
|
|
1429
|
+
userLibraryId = walletObjectInfo.libraryId;
|
|
1430
|
+
userObjectId = walletObjectInfo.objectId; // Mark content as seen
|
|
1431
|
+
|
|
1432
|
+
_context18.next = 26;
|
|
1433
|
+
return this.client.EditContentObject({
|
|
1434
|
+
libraryId: userLibraryId,
|
|
1435
|
+
objectId: userObjectId
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1438
|
+
case 26:
|
|
1439
|
+
editRequest = _context18.sent;
|
|
1440
|
+
_context18.next = 29;
|
|
1441
|
+
return this.client.ReplaceMetadata({
|
|
1442
|
+
libraryId: userLibraryId,
|
|
1443
|
+
objectId: userObjectId,
|
|
1444
|
+
writeToken: editRequest.write_token,
|
|
1445
|
+
metadataSubtree: UrlJoin("accessed_content", versionHash),
|
|
1446
|
+
metadata: Date.now()
|
|
1447
|
+
});
|
|
1448
|
+
|
|
1449
|
+
case 29:
|
|
1450
|
+
_context18.next = 31;
|
|
1451
|
+
return this.client.ContentObjectMetadata({
|
|
1452
|
+
libraryId: libraryId,
|
|
1453
|
+
objectId: objectId,
|
|
1454
|
+
versionHash: versionHash,
|
|
1455
|
+
metadataSubtree: "video_tags"
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1458
|
+
case 31:
|
|
1459
|
+
contentTags = _context18.sent;
|
|
1460
|
+
|
|
1461
|
+
if (!(contentTags && contentTags.length > 0)) {
|
|
1462
|
+
_context18.next = 40;
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
_context18.next = 35;
|
|
1467
|
+
return this.CollectedTags();
|
|
1468
|
+
|
|
1469
|
+
case 35:
|
|
1470
|
+
userTags = _context18.sent;
|
|
1471
|
+
formattedTags = this.__FormatVideoTags(contentTags);
|
|
1472
|
+
Object.keys(formattedTags).forEach(function (tag) {
|
|
1473
|
+
if (userTags[tag]) {
|
|
1474
|
+
// User has seen this tag before
|
|
1475
|
+
userTags[tag].occurrences += 1;
|
|
1476
|
+
userTags[tag].aggregate += formattedTags[tag];
|
|
1477
|
+
} else {
|
|
1478
|
+
// New tag
|
|
1479
|
+
userTags[tag] = {
|
|
1480
|
+
occurrences: 1,
|
|
1481
|
+
aggregate: formattedTags[tag]
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
}); // Update user tags
|
|
1485
|
+
|
|
1486
|
+
_context18.next = 40;
|
|
1487
|
+
return this.client.ReplaceMetadata({
|
|
1488
|
+
libraryId: userLibraryId,
|
|
1489
|
+
objectId: userObjectId,
|
|
1490
|
+
writeToken: editRequest.write_token,
|
|
1491
|
+
metadataSubtree: "collected_data",
|
|
1492
|
+
metadata: userTags
|
|
1493
|
+
});
|
|
1494
|
+
|
|
1495
|
+
case 40:
|
|
1496
|
+
_context18.next = 42;
|
|
1497
|
+
return this.client.FinalizeContentObject({
|
|
1498
|
+
libraryId: userLibraryId,
|
|
1499
|
+
objectId: userObjectId,
|
|
1500
|
+
writeToken: editRequest.write_token,
|
|
1501
|
+
commitMessage: "Record user tags",
|
|
1502
|
+
awaitCommitConfirmation: false
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
case 42:
|
|
1506
|
+
case "end":
|
|
1507
|
+
return _context18.stop();
|
|
1508
|
+
}
|
|
1361
1509
|
}
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1510
|
+
}, _callee18, this);
|
|
1511
|
+
}));
|
|
1512
|
+
|
|
1513
|
+
function __RecordTags(_x10) {
|
|
1514
|
+
return _RecordTags2.apply(this, arguments);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
return __RecordTags;
|
|
1518
|
+
}()
|
|
1365
1519
|
/*
|
|
1366
1520
|
Format video tags into an easier format and average scores
|
|
1367
1521
|
Example content tags:
|