@eluvio/elv-client-js 3.1.75 → 3.1.79
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/README.md +2 -1
- package/dist/ElvClient-min.js +5 -5
- package/dist/ElvClient-node-min.js +9 -9
- package/dist/ElvFrameClient-min.js +4 -4
- package/dist/src/AuthorizationClient.js +24 -14
- package/dist/src/EthClient.js +21 -11
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/client/ABRPublishing.js +30 -9
- package/dist/src/client/ContentAccess.js +36 -27
- package/dist/src/client/ContentManagement.js +404 -305
- package/dist/src/client/Files.js +72 -50
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/AuthorizationClient.js +4 -1
- package/src/EthClient.js +2 -0
- package/src/FrameClient.js +1 -0
- package/src/client/ABRPublishing.js +18 -3
- package/src/client/ContentAccess.js +5 -3
- package/src/client/ContentManagement.js +63 -1
- package/src/client/Files.js +4 -1
- package/testScripts/logo2.png +0 -0
- package/typeSpecs/DropEventSite.js +204 -39
- package/typeSpecs/NFTTemplate.js +11 -3
- package/utilities/MezzanineCreate.js +2 -2
|
@@ -32,7 +32,8 @@ var _require = require("../Validation"),
|
|
|
32
32
|
ValidateVersion = _require.ValidateVersion,
|
|
33
33
|
ValidateWriteToken = _require.ValidateWriteToken,
|
|
34
34
|
ValidateParameters = _require.ValidateParameters,
|
|
35
|
-
ValidatePresence = _require.ValidatePresence
|
|
35
|
+
ValidatePresence = _require.ValidatePresence,
|
|
36
|
+
ValidateAddress = _require.ValidateAddress;
|
|
36
37
|
|
|
37
38
|
exports.SetVisibility = function _callee(_ref) {
|
|
38
39
|
var id, visibility, hasSetVisibility, event;
|
|
@@ -1214,6 +1215,104 @@ exports.CopyContentObject = function _callee12(_ref15) {
|
|
|
1214
1215
|
}
|
|
1215
1216
|
}, null, this);
|
|
1216
1217
|
};
|
|
1218
|
+
/**
|
|
1219
|
+
* Create a non-owner cap key using the specified public key and address
|
|
1220
|
+
*
|
|
1221
|
+
* @methodGroup Access Requests
|
|
1222
|
+
* @namedParams
|
|
1223
|
+
* @param {string} libraryId - ID of the library
|
|
1224
|
+
* @param {string} objectId - ID of the object
|
|
1225
|
+
* @param {string} publicKey - Public key for the target cap
|
|
1226
|
+
* @param {string} publicAddress - Public address for the target cap key
|
|
1227
|
+
* @param {string} writeToken - Write token for the content object - If specified, info will be retrieved from the write draft instead of creating a new draft and finalizing
|
|
1228
|
+
*
|
|
1229
|
+
* @returns {Promise<Object>}
|
|
1230
|
+
*/
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
exports.CreateNonOwnerCap = function _callee13(_ref17) {
|
|
1234
|
+
var objectId, libraryId, publicKey, publicAddress, writeToken, userCapKey, userCapValue, userConk, targetUserCapKey, targetUserCapValue, finalize;
|
|
1235
|
+
return _regeneratorRuntime.async(function _callee13$(_context14) {
|
|
1236
|
+
while (1) {
|
|
1237
|
+
switch (_context14.prev = _context14.next) {
|
|
1238
|
+
case 0:
|
|
1239
|
+
objectId = _ref17.objectId, libraryId = _ref17.libraryId, publicKey = _ref17.publicKey, publicAddress = _ref17.publicAddress, writeToken = _ref17.writeToken;
|
|
1240
|
+
publicAddress = ValidateAddress(publicAddress);
|
|
1241
|
+
userCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
1242
|
+
_context14.next = 5;
|
|
1243
|
+
return _regeneratorRuntime.awrap(this.ContentObjectMetadata({
|
|
1244
|
+
objectId: objectId,
|
|
1245
|
+
libraryId: libraryId,
|
|
1246
|
+
metadataSubtree: userCapKey
|
|
1247
|
+
}));
|
|
1248
|
+
|
|
1249
|
+
case 5:
|
|
1250
|
+
userCapValue = _context14.sent;
|
|
1251
|
+
|
|
1252
|
+
if (userCapValue) {
|
|
1253
|
+
_context14.next = 8;
|
|
1254
|
+
break;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
throw Error("No user cap found for current user");
|
|
1258
|
+
|
|
1259
|
+
case 8:
|
|
1260
|
+
_context14.next = 10;
|
|
1261
|
+
return _regeneratorRuntime.awrap(this.Crypto.DecryptCap(userCapValue, this.signer.signingKey.privateKey));
|
|
1262
|
+
|
|
1263
|
+
case 10:
|
|
1264
|
+
userConk = _context14.sent;
|
|
1265
|
+
targetUserCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(publicAddress));
|
|
1266
|
+
_context14.next = 14;
|
|
1267
|
+
return _regeneratorRuntime.awrap(this.Crypto.EncryptConk(userConk, publicKey));
|
|
1268
|
+
|
|
1269
|
+
case 14:
|
|
1270
|
+
targetUserCapValue = _context14.sent;
|
|
1271
|
+
finalize = !writeToken;
|
|
1272
|
+
|
|
1273
|
+
if (writeToken) {
|
|
1274
|
+
_context14.next = 20;
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
_context14.next = 19;
|
|
1279
|
+
return _regeneratorRuntime.awrap(this.EditContentObject({
|
|
1280
|
+
libraryId: libraryId,
|
|
1281
|
+
objectId: objectId
|
|
1282
|
+
}).writeToken);
|
|
1283
|
+
|
|
1284
|
+
case 19:
|
|
1285
|
+
writeToken = _context14.sent;
|
|
1286
|
+
|
|
1287
|
+
case 20:
|
|
1288
|
+
this.ReplaceMetadata({
|
|
1289
|
+
libraryId: libraryId,
|
|
1290
|
+
objectId: objectId,
|
|
1291
|
+
writeToken: writeToken,
|
|
1292
|
+
metadataSubtree: targetUserCapKey,
|
|
1293
|
+
metadata: targetUserCapValue
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
if (!finalize) {
|
|
1297
|
+
_context14.next = 24;
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
_context14.next = 24;
|
|
1302
|
+
return _regeneratorRuntime.awrap(this.FinalizeContentObject({
|
|
1303
|
+
libraryId: libraryId,
|
|
1304
|
+
objectId: objectId,
|
|
1305
|
+
writeToken: writeToken,
|
|
1306
|
+
commitMessage: "Create non-owner cap"
|
|
1307
|
+
}));
|
|
1308
|
+
|
|
1309
|
+
case 24:
|
|
1310
|
+
case "end":
|
|
1311
|
+
return _context14.stop();
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
}, null, this);
|
|
1315
|
+
};
|
|
1217
1316
|
/**
|
|
1218
1317
|
* Create a new content object draft from an existing object.
|
|
1219
1318
|
*
|
|
@@ -1229,14 +1328,14 @@ exports.CopyContentObject = function _callee12(_ref15) {
|
|
|
1229
1328
|
*/
|
|
1230
1329
|
|
|
1231
1330
|
|
|
1232
|
-
exports.EditContentObject = function
|
|
1233
|
-
var libraryId, objectId,
|
|
1331
|
+
exports.EditContentObject = function _callee14(_ref18) {
|
|
1332
|
+
var libraryId, objectId, _ref18$options, options, path, editResponse;
|
|
1234
1333
|
|
|
1235
|
-
return _regeneratorRuntime.async(function
|
|
1334
|
+
return _regeneratorRuntime.async(function _callee14$(_context15) {
|
|
1236
1335
|
while (1) {
|
|
1237
|
-
switch (
|
|
1336
|
+
switch (_context15.prev = _context15.next) {
|
|
1238
1337
|
case 0:
|
|
1239
|
-
libraryId =
|
|
1338
|
+
libraryId = _ref18.libraryId, objectId = _ref18.objectId, _ref18$options = _ref18.options, options = _ref18$options === void 0 ? {} : _ref18$options;
|
|
1240
1339
|
ValidateParameters({
|
|
1241
1340
|
libraryId: libraryId,
|
|
1242
1341
|
objectId: objectId
|
|
@@ -1244,55 +1343,55 @@ exports.EditContentObject = function _callee13(_ref17) {
|
|
|
1244
1343
|
this.Log("Opening content draft: ".concat(libraryId, " ").concat(objectId));
|
|
1245
1344
|
|
|
1246
1345
|
if (!("type" in options && options.type)) {
|
|
1247
|
-
|
|
1346
|
+
_context15.next = 23;
|
|
1248
1347
|
break;
|
|
1249
1348
|
}
|
|
1250
1349
|
|
|
1251
1350
|
if (!options.type.startsWith("hq__")) {
|
|
1252
|
-
|
|
1351
|
+
_context15.next = 10;
|
|
1253
1352
|
break;
|
|
1254
1353
|
}
|
|
1255
1354
|
|
|
1256
|
-
|
|
1355
|
+
_context15.next = 7;
|
|
1257
1356
|
return _regeneratorRuntime.awrap(this.ContentType({
|
|
1258
1357
|
versionHash: options.type
|
|
1259
1358
|
}));
|
|
1260
1359
|
|
|
1261
1360
|
case 7:
|
|
1262
|
-
options.type =
|
|
1263
|
-
|
|
1361
|
+
options.type = _context15.sent.hash;
|
|
1362
|
+
_context15.next = 23;
|
|
1264
1363
|
break;
|
|
1265
1364
|
|
|
1266
1365
|
case 10:
|
|
1267
1366
|
if (!options.type.startsWith("iq__")) {
|
|
1268
|
-
|
|
1367
|
+
_context15.next = 16;
|
|
1269
1368
|
break;
|
|
1270
1369
|
}
|
|
1271
1370
|
|
|
1272
|
-
|
|
1371
|
+
_context15.next = 13;
|
|
1273
1372
|
return _regeneratorRuntime.awrap(this.ContentType({
|
|
1274
1373
|
typeId: options.type
|
|
1275
1374
|
}));
|
|
1276
1375
|
|
|
1277
1376
|
case 13:
|
|
1278
|
-
options.type =
|
|
1279
|
-
|
|
1377
|
+
options.type = _context15.sent.hash;
|
|
1378
|
+
_context15.next = 23;
|
|
1280
1379
|
break;
|
|
1281
1380
|
|
|
1282
1381
|
case 16:
|
|
1283
1382
|
if (!options.type) {
|
|
1284
|
-
|
|
1383
|
+
_context15.next = 22;
|
|
1285
1384
|
break;
|
|
1286
1385
|
}
|
|
1287
1386
|
|
|
1288
|
-
|
|
1387
|
+
_context15.next = 19;
|
|
1289
1388
|
return _regeneratorRuntime.awrap(this.ContentType({
|
|
1290
1389
|
name: options.type
|
|
1291
1390
|
}));
|
|
1292
1391
|
|
|
1293
1392
|
case 19:
|
|
1294
|
-
options.type =
|
|
1295
|
-
|
|
1393
|
+
options.type = _context15.sent.hash;
|
|
1394
|
+
_context15.next = 23;
|
|
1296
1395
|
break;
|
|
1297
1396
|
|
|
1298
1397
|
case 22:
|
|
@@ -1300,10 +1399,10 @@ exports.EditContentObject = function _callee13(_ref17) {
|
|
|
1300
1399
|
|
|
1301
1400
|
case 23:
|
|
1302
1401
|
path = UrlJoin("qid", objectId);
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1402
|
+
_context15.t0 = _regeneratorRuntime;
|
|
1403
|
+
_context15.t1 = this.utils;
|
|
1404
|
+
_context15.t2 = this.HttpClient;
|
|
1405
|
+
_context15.next = 29;
|
|
1307
1406
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationHeader({
|
|
1308
1407
|
libraryId: libraryId,
|
|
1309
1408
|
objectId: objectId,
|
|
@@ -1311,31 +1410,31 @@ exports.EditContentObject = function _callee13(_ref17) {
|
|
|
1311
1410
|
}));
|
|
1312
1411
|
|
|
1313
1412
|
case 29:
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
headers:
|
|
1413
|
+
_context15.t3 = _context15.sent;
|
|
1414
|
+
_context15.t4 = path;
|
|
1415
|
+
_context15.t5 = options;
|
|
1416
|
+
_context15.t6 = {
|
|
1417
|
+
headers: _context15.t3,
|
|
1319
1418
|
method: "POST",
|
|
1320
|
-
path:
|
|
1321
|
-
body:
|
|
1419
|
+
path: _context15.t4,
|
|
1420
|
+
body: _context15.t5
|
|
1322
1421
|
};
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
return
|
|
1422
|
+
_context15.t7 = _context15.t2.Request.call(_context15.t2, _context15.t6);
|
|
1423
|
+
_context15.t8 = _context15.t1.ResponseToJson.call(_context15.t1, _context15.t7);
|
|
1424
|
+
_context15.next = 37;
|
|
1425
|
+
return _context15.t0.awrap.call(_context15.t0, _context15.t8);
|
|
1327
1426
|
|
|
1328
1427
|
case 37:
|
|
1329
|
-
editResponse =
|
|
1428
|
+
editResponse = _context15.sent;
|
|
1330
1429
|
// Record the node used in creating this write token
|
|
1331
1430
|
this.HttpClient.RecordWriteToken(editResponse.write_token);
|
|
1332
1431
|
editResponse.writeToken = editResponse.write_token;
|
|
1333
1432
|
editResponse.objectId = editResponse.id;
|
|
1334
|
-
return
|
|
1433
|
+
return _context15.abrupt("return", editResponse);
|
|
1335
1434
|
|
|
1336
1435
|
case 42:
|
|
1337
1436
|
case "end":
|
|
1338
|
-
return
|
|
1437
|
+
return _context15.stop();
|
|
1339
1438
|
}
|
|
1340
1439
|
}
|
|
1341
1440
|
}, null, this);
|
|
@@ -1368,37 +1467,37 @@ exports.EditContentObject = function _callee13(_ref17) {
|
|
|
1368
1467
|
*/
|
|
1369
1468
|
|
|
1370
1469
|
|
|
1371
|
-
exports.CreateAndFinalizeContentObject = function
|
|
1372
|
-
var libraryId, callback,
|
|
1470
|
+
exports.CreateAndFinalizeContentObject = function _callee15(_ref19) {
|
|
1471
|
+
var libraryId, callback, _ref19$options, options, _ref19$commitMessage, commitMessage, _ref19$publish, publish, _ref19$awaitCommitCon, awaitCommitConfirmation, args, id, writeToken;
|
|
1373
1472
|
|
|
1374
|
-
return _regeneratorRuntime.async(function
|
|
1473
|
+
return _regeneratorRuntime.async(function _callee15$(_context16) {
|
|
1375
1474
|
while (1) {
|
|
1376
|
-
switch (
|
|
1475
|
+
switch (_context16.prev = _context16.next) {
|
|
1377
1476
|
case 0:
|
|
1378
|
-
libraryId =
|
|
1379
|
-
|
|
1477
|
+
libraryId = _ref19.libraryId, callback = _ref19.callback, _ref19$options = _ref19.options, options = _ref19$options === void 0 ? {} : _ref19$options, _ref19$commitMessage = _ref19.commitMessage, commitMessage = _ref19$commitMessage === void 0 ? "" : _ref19$commitMessage, _ref19$publish = _ref19.publish, publish = _ref19$publish === void 0 ? true : _ref19$publish, _ref19$awaitCommitCon = _ref19.awaitCommitConfirmation, awaitCommitConfirmation = _ref19$awaitCommitCon === void 0 ? true : _ref19$awaitCommitCon;
|
|
1478
|
+
_context16.next = 3;
|
|
1380
1479
|
return _regeneratorRuntime.awrap(this.CreateContentObject({
|
|
1381
1480
|
libraryId: libraryId,
|
|
1382
1481
|
options: options
|
|
1383
1482
|
}));
|
|
1384
1483
|
|
|
1385
1484
|
case 3:
|
|
1386
|
-
args =
|
|
1485
|
+
args = _context16.sent;
|
|
1387
1486
|
id = args.id, writeToken = args.writeToken;
|
|
1388
1487
|
|
|
1389
1488
|
if (!callback) {
|
|
1390
|
-
|
|
1489
|
+
_context16.next = 8;
|
|
1391
1490
|
break;
|
|
1392
1491
|
}
|
|
1393
1492
|
|
|
1394
|
-
|
|
1493
|
+
_context16.next = 8;
|
|
1395
1494
|
return _regeneratorRuntime.awrap(callback({
|
|
1396
1495
|
objectId: id,
|
|
1397
1496
|
writeToken: writeToken
|
|
1398
1497
|
}));
|
|
1399
1498
|
|
|
1400
1499
|
case 8:
|
|
1401
|
-
|
|
1500
|
+
_context16.next = 10;
|
|
1402
1501
|
return _regeneratorRuntime.awrap(this.FinalizeContentObject({
|
|
1403
1502
|
libraryId: libraryId,
|
|
1404
1503
|
objectId: id,
|
|
@@ -1409,11 +1508,11 @@ exports.CreateAndFinalizeContentObject = function _callee14(_ref18) {
|
|
|
1409
1508
|
}));
|
|
1410
1509
|
|
|
1411
1510
|
case 10:
|
|
1412
|
-
return
|
|
1511
|
+
return _context16.abrupt("return", _context16.sent);
|
|
1413
1512
|
|
|
1414
1513
|
case 11:
|
|
1415
1514
|
case "end":
|
|
1416
|
-
return
|
|
1515
|
+
return _context16.stop();
|
|
1417
1516
|
}
|
|
1418
1517
|
}
|
|
1419
1518
|
}, null, this);
|
|
@@ -1447,15 +1546,15 @@ exports.CreateAndFinalizeContentObject = function _callee14(_ref18) {
|
|
|
1447
1546
|
*/
|
|
1448
1547
|
|
|
1449
1548
|
|
|
1450
|
-
exports.EditAndFinalizeContentObject = function
|
|
1451
|
-
var libraryId, objectId, callback,
|
|
1549
|
+
exports.EditAndFinalizeContentObject = function _callee16(_ref20) {
|
|
1550
|
+
var libraryId, objectId, callback, _ref20$options, options, _ref20$commitMessage, commitMessage, _ref20$publish, publish, _ref20$awaitCommitCon, awaitCommitConfirmation, _ref21, writeToken;
|
|
1452
1551
|
|
|
1453
|
-
return _regeneratorRuntime.async(function
|
|
1552
|
+
return _regeneratorRuntime.async(function _callee16$(_context17) {
|
|
1454
1553
|
while (1) {
|
|
1455
|
-
switch (
|
|
1554
|
+
switch (_context17.prev = _context17.next) {
|
|
1456
1555
|
case 0:
|
|
1457
|
-
libraryId =
|
|
1458
|
-
|
|
1556
|
+
libraryId = _ref20.libraryId, objectId = _ref20.objectId, callback = _ref20.callback, _ref20$options = _ref20.options, options = _ref20$options === void 0 ? {} : _ref20$options, _ref20$commitMessage = _ref20.commitMessage, commitMessage = _ref20$commitMessage === void 0 ? "" : _ref20$commitMessage, _ref20$publish = _ref20.publish, publish = _ref20$publish === void 0 ? true : _ref20$publish, _ref20$awaitCommitCon = _ref20.awaitCommitConfirmation, awaitCommitConfirmation = _ref20$awaitCommitCon === void 0 ? true : _ref20$awaitCommitCon;
|
|
1557
|
+
_context17.next = 3;
|
|
1459
1558
|
return _regeneratorRuntime.awrap(this.EditContentObject({
|
|
1460
1559
|
libraryId: libraryId,
|
|
1461
1560
|
objectId: objectId,
|
|
@@ -1463,21 +1562,21 @@ exports.EditAndFinalizeContentObject = function _callee15(_ref19) {
|
|
|
1463
1562
|
}));
|
|
1464
1563
|
|
|
1465
1564
|
case 3:
|
|
1466
|
-
|
|
1467
|
-
writeToken =
|
|
1565
|
+
_ref21 = _context17.sent;
|
|
1566
|
+
writeToken = _ref21.writeToken;
|
|
1468
1567
|
|
|
1469
1568
|
if (!callback) {
|
|
1470
|
-
|
|
1569
|
+
_context17.next = 8;
|
|
1471
1570
|
break;
|
|
1472
1571
|
}
|
|
1473
1572
|
|
|
1474
|
-
|
|
1573
|
+
_context17.next = 8;
|
|
1475
1574
|
return _regeneratorRuntime.awrap(callback({
|
|
1476
1575
|
writeToken: writeToken
|
|
1477
1576
|
}));
|
|
1478
1577
|
|
|
1479
1578
|
case 8:
|
|
1480
|
-
|
|
1579
|
+
_context17.next = 10;
|
|
1481
1580
|
return _regeneratorRuntime.awrap(this.FinalizeContentObject({
|
|
1482
1581
|
libraryId: libraryId,
|
|
1483
1582
|
objectId: objectId,
|
|
@@ -1488,116 +1587,116 @@ exports.EditAndFinalizeContentObject = function _callee15(_ref19) {
|
|
|
1488
1587
|
}));
|
|
1489
1588
|
|
|
1490
1589
|
case 10:
|
|
1491
|
-
return
|
|
1590
|
+
return _context17.abrupt("return", _context17.sent);
|
|
1492
1591
|
|
|
1493
1592
|
case 11:
|
|
1494
1593
|
case "end":
|
|
1495
|
-
return
|
|
1594
|
+
return _context17.stop();
|
|
1496
1595
|
}
|
|
1497
1596
|
}
|
|
1498
1597
|
}, null, this);
|
|
1499
1598
|
};
|
|
1500
1599
|
|
|
1501
|
-
exports.AwaitPending = function
|
|
1600
|
+
exports.AwaitPending = function _callee17(objectId) {
|
|
1502
1601
|
var _this3 = this;
|
|
1503
1602
|
|
|
1504
1603
|
var PendingHash, pending, isWallet, timeout, i;
|
|
1505
|
-
return _regeneratorRuntime.async(function
|
|
1604
|
+
return _regeneratorRuntime.async(function _callee17$(_context19) {
|
|
1506
1605
|
while (1) {
|
|
1507
|
-
switch (
|
|
1606
|
+
switch (_context19.prev = _context19.next) {
|
|
1508
1607
|
case 0:
|
|
1509
1608
|
PendingHash = function PendingHash() {
|
|
1510
|
-
return _regeneratorRuntime.async(function PendingHash$(
|
|
1609
|
+
return _regeneratorRuntime.async(function PendingHash$(_context18) {
|
|
1511
1610
|
while (1) {
|
|
1512
|
-
switch (
|
|
1611
|
+
switch (_context18.prev = _context18.next) {
|
|
1513
1612
|
case 0:
|
|
1514
|
-
|
|
1613
|
+
_context18.next = 2;
|
|
1515
1614
|
return _regeneratorRuntime.awrap(_this3.CallContractMethod({
|
|
1516
1615
|
contractAddress: _this3.utils.HashToAddress(objectId),
|
|
1517
1616
|
methodName: "pendingHash"
|
|
1518
1617
|
}));
|
|
1519
1618
|
|
|
1520
1619
|
case 2:
|
|
1521
|
-
return
|
|
1620
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1522
1621
|
|
|
1523
1622
|
case 3:
|
|
1524
1623
|
case "end":
|
|
1525
|
-
return
|
|
1624
|
+
return _context18.stop();
|
|
1526
1625
|
}
|
|
1527
1626
|
}
|
|
1528
1627
|
});
|
|
1529
1628
|
};
|
|
1530
1629
|
|
|
1531
1630
|
this.Log("Checking for pending commit");
|
|
1532
|
-
|
|
1631
|
+
_context19.next = 4;
|
|
1533
1632
|
return _regeneratorRuntime.awrap(PendingHash());
|
|
1534
1633
|
|
|
1535
1634
|
case 4:
|
|
1536
|
-
pending =
|
|
1635
|
+
pending = _context19.sent;
|
|
1537
1636
|
|
|
1538
1637
|
if (pending) {
|
|
1539
|
-
|
|
1638
|
+
_context19.next = 7;
|
|
1540
1639
|
break;
|
|
1541
1640
|
}
|
|
1542
1641
|
|
|
1543
|
-
return
|
|
1642
|
+
return _context19.abrupt("return");
|
|
1544
1643
|
|
|
1545
1644
|
case 7:
|
|
1546
|
-
|
|
1645
|
+
_context19.next = 9;
|
|
1547
1646
|
return _regeneratorRuntime.awrap(this.authClient.AccessType(objectId));
|
|
1548
1647
|
|
|
1549
1648
|
case 9:
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
isWallet =
|
|
1649
|
+
_context19.t0 = _context19.sent;
|
|
1650
|
+
_context19.t1 = this.authClient.ACCESS_TYPES.WALLET;
|
|
1651
|
+
isWallet = _context19.t0 === _context19.t1;
|
|
1553
1652
|
timeout = isWallet ? 3 : 10;
|
|
1554
1653
|
this.Log("Waiting for pending commit to clear for ".concat(objectId));
|
|
1555
1654
|
i = 0;
|
|
1556
1655
|
|
|
1557
1656
|
case 15:
|
|
1558
1657
|
if (!(i < timeout)) {
|
|
1559
|
-
|
|
1658
|
+
_context19.next = 25;
|
|
1560
1659
|
break;
|
|
1561
1660
|
}
|
|
1562
1661
|
|
|
1563
|
-
|
|
1662
|
+
_context19.next = 18;
|
|
1564
1663
|
return _regeneratorRuntime.awrap(new Promise(function (resolve) {
|
|
1565
1664
|
return setTimeout(resolve, 1000);
|
|
1566
1665
|
}));
|
|
1567
1666
|
|
|
1568
1667
|
case 18:
|
|
1569
|
-
|
|
1668
|
+
_context19.next = 20;
|
|
1570
1669
|
return _regeneratorRuntime.awrap(PendingHash());
|
|
1571
1670
|
|
|
1572
1671
|
case 20:
|
|
1573
|
-
if (
|
|
1574
|
-
|
|
1672
|
+
if (_context19.sent) {
|
|
1673
|
+
_context19.next = 22;
|
|
1575
1674
|
break;
|
|
1576
1675
|
}
|
|
1577
1676
|
|
|
1578
|
-
return
|
|
1677
|
+
return _context19.abrupt("return");
|
|
1579
1678
|
|
|
1580
1679
|
case 22:
|
|
1581
1680
|
i++;
|
|
1582
|
-
|
|
1681
|
+
_context19.next = 15;
|
|
1583
1682
|
break;
|
|
1584
1683
|
|
|
1585
1684
|
case 25:
|
|
1586
1685
|
if (!isWallet) {
|
|
1587
|
-
|
|
1686
|
+
_context19.next = 31;
|
|
1588
1687
|
break;
|
|
1589
1688
|
}
|
|
1590
1689
|
|
|
1591
1690
|
this.Log("Clearing stuck wallet commit", true); // Clear pending commit, it's probably stuck
|
|
1592
1691
|
|
|
1593
|
-
|
|
1692
|
+
_context19.next = 29;
|
|
1594
1693
|
return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
|
|
1595
1694
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
1596
1695
|
methodName: "clearPending"
|
|
1597
1696
|
}));
|
|
1598
1697
|
|
|
1599
1698
|
case 29:
|
|
1600
|
-
|
|
1699
|
+
_context19.next = 32;
|
|
1601
1700
|
break;
|
|
1602
1701
|
|
|
1603
1702
|
case 31:
|
|
@@ -1605,7 +1704,7 @@ exports.AwaitPending = function _callee16(objectId) {
|
|
|
1605
1704
|
|
|
1606
1705
|
case 32:
|
|
1607
1706
|
case "end":
|
|
1608
|
-
return
|
|
1707
|
+
return _context19.stop();
|
|
1609
1708
|
}
|
|
1610
1709
|
}
|
|
1611
1710
|
}, null, this);
|
|
@@ -1625,72 +1724,72 @@ exports.AwaitPending = function _callee16(objectId) {
|
|
|
1625
1724
|
*/
|
|
1626
1725
|
|
|
1627
1726
|
|
|
1628
|
-
exports.FinalizeContentObject = function
|
|
1629
|
-
var libraryId, objectId, writeToken,
|
|
1727
|
+
exports.FinalizeContentObject = function _callee18(_ref22) {
|
|
1728
|
+
var libraryId, objectId, writeToken, _ref22$commitMessage, commitMessage, _ref22$publish, publish, _ref22$awaitCommitCon, awaitCommitConfirmation, path, finalizeResponse;
|
|
1630
1729
|
|
|
1631
|
-
return _regeneratorRuntime.async(function
|
|
1730
|
+
return _regeneratorRuntime.async(function _callee18$(_context20) {
|
|
1632
1731
|
while (1) {
|
|
1633
|
-
switch (
|
|
1732
|
+
switch (_context20.prev = _context20.next) {
|
|
1634
1733
|
case 0:
|
|
1635
|
-
libraryId =
|
|
1734
|
+
libraryId = _ref22.libraryId, objectId = _ref22.objectId, writeToken = _ref22.writeToken, _ref22$commitMessage = _ref22.commitMessage, commitMessage = _ref22$commitMessage === void 0 ? "" : _ref22$commitMessage, _ref22$publish = _ref22.publish, publish = _ref22$publish === void 0 ? true : _ref22$publish, _ref22$awaitCommitCon = _ref22.awaitCommitConfirmation, awaitCommitConfirmation = _ref22$awaitCommitCon === void 0 ? true : _ref22$awaitCommitCon;
|
|
1636
1735
|
ValidateParameters({
|
|
1637
1736
|
libraryId: libraryId,
|
|
1638
1737
|
objectId: objectId
|
|
1639
1738
|
});
|
|
1640
1739
|
ValidateWriteToken(writeToken);
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1740
|
+
_context20.t0 = _regeneratorRuntime;
|
|
1741
|
+
_context20.t1 = this;
|
|
1742
|
+
_context20.t2 = libraryId;
|
|
1743
|
+
_context20.t3 = objectId;
|
|
1744
|
+
_context20.t4 = writeToken;
|
|
1745
|
+
_context20.t5 = commitMessage;
|
|
1746
|
+
_context20.next = 11;
|
|
1648
1747
|
return _regeneratorRuntime.awrap(this.userProfileClient.UserMetadata({
|
|
1649
1748
|
metadataSubtree: "public/name"
|
|
1650
1749
|
}));
|
|
1651
1750
|
|
|
1652
1751
|
case 11:
|
|
1653
|
-
|
|
1752
|
+
_context20.t6 = _context20.sent;
|
|
1654
1753
|
|
|
1655
|
-
if (
|
|
1656
|
-
|
|
1754
|
+
if (_context20.t6) {
|
|
1755
|
+
_context20.next = 14;
|
|
1657
1756
|
break;
|
|
1658
1757
|
}
|
|
1659
1758
|
|
|
1660
|
-
|
|
1759
|
+
_context20.t6 = this.CurrentAccountAddress();
|
|
1661
1760
|
|
|
1662
1761
|
case 14:
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
message:
|
|
1668
|
-
author:
|
|
1669
|
-
author_address:
|
|
1670
|
-
timestamp:
|
|
1762
|
+
_context20.t7 = _context20.t6;
|
|
1763
|
+
_context20.t8 = this.CurrentAccountAddress();
|
|
1764
|
+
_context20.t9 = new Date().toISOString();
|
|
1765
|
+
_context20.t10 = {
|
|
1766
|
+
message: _context20.t5,
|
|
1767
|
+
author: _context20.t7,
|
|
1768
|
+
author_address: _context20.t8,
|
|
1769
|
+
timestamp: _context20.t9
|
|
1671
1770
|
};
|
|
1672
|
-
|
|
1673
|
-
libraryId:
|
|
1674
|
-
objectId:
|
|
1675
|
-
writeToken:
|
|
1771
|
+
_context20.t11 = {
|
|
1772
|
+
libraryId: _context20.t2,
|
|
1773
|
+
objectId: _context20.t3,
|
|
1774
|
+
writeToken: _context20.t4,
|
|
1676
1775
|
metadataSubtree: "commit",
|
|
1677
|
-
metadata:
|
|
1776
|
+
metadata: _context20.t10
|
|
1678
1777
|
};
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
return
|
|
1778
|
+
_context20.t12 = _context20.t1.ReplaceMetadata.call(_context20.t1, _context20.t11);
|
|
1779
|
+
_context20.next = 22;
|
|
1780
|
+
return _context20.t0.awrap.call(_context20.t0, _context20.t12);
|
|
1682
1781
|
|
|
1683
1782
|
case 22:
|
|
1684
1783
|
this.Log("Finalizing content draft: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
|
|
1685
|
-
|
|
1784
|
+
_context20.next = 25;
|
|
1686
1785
|
return _regeneratorRuntime.awrap(this.AwaitPending(objectId));
|
|
1687
1786
|
|
|
1688
1787
|
case 25:
|
|
1689
1788
|
path = UrlJoin("q", writeToken);
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1789
|
+
_context20.t13 = _regeneratorRuntime;
|
|
1790
|
+
_context20.t14 = this.utils;
|
|
1791
|
+
_context20.t15 = this.HttpClient;
|
|
1792
|
+
_context20.next = 31;
|
|
1694
1793
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationHeader({
|
|
1695
1794
|
libraryId: libraryId,
|
|
1696
1795
|
objectId: objectId,
|
|
@@ -1698,29 +1797,29 @@ exports.FinalizeContentObject = function _callee17(_ref21) {
|
|
|
1698
1797
|
}));
|
|
1699
1798
|
|
|
1700
1799
|
case 31:
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
headers:
|
|
1800
|
+
_context20.t16 = _context20.sent;
|
|
1801
|
+
_context20.t17 = path;
|
|
1802
|
+
_context20.t18 = {
|
|
1803
|
+
headers: _context20.t16,
|
|
1705
1804
|
method: "POST",
|
|
1706
|
-
path:
|
|
1805
|
+
path: _context20.t17,
|
|
1707
1806
|
failover: false
|
|
1708
1807
|
};
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
return
|
|
1808
|
+
_context20.t19 = _context20.t15.Request.call(_context20.t15, _context20.t18);
|
|
1809
|
+
_context20.t20 = _context20.t14.ResponseToJson.call(_context20.t14, _context20.t19);
|
|
1810
|
+
_context20.next = 38;
|
|
1811
|
+
return _context20.t13.awrap.call(_context20.t13, _context20.t20);
|
|
1713
1812
|
|
|
1714
1813
|
case 38:
|
|
1715
|
-
finalizeResponse =
|
|
1814
|
+
finalizeResponse = _context20.sent;
|
|
1716
1815
|
this.Log("Finalized: ".concat(finalizeResponse.hash));
|
|
1717
1816
|
|
|
1718
1817
|
if (!publish) {
|
|
1719
|
-
|
|
1818
|
+
_context20.next = 43;
|
|
1720
1819
|
break;
|
|
1721
1820
|
}
|
|
1722
1821
|
|
|
1723
|
-
|
|
1822
|
+
_context20.next = 43;
|
|
1724
1823
|
return _regeneratorRuntime.awrap(this.PublishContentVersion({
|
|
1725
1824
|
objectId: objectId,
|
|
1726
1825
|
versionHash: finalizeResponse.hash,
|
|
@@ -1730,11 +1829,11 @@ exports.FinalizeContentObject = function _callee17(_ref21) {
|
|
|
1730
1829
|
case 43:
|
|
1731
1830
|
// Invalidate cached content type, if this is one.
|
|
1732
1831
|
delete this.contentTypes[objectId];
|
|
1733
|
-
return
|
|
1832
|
+
return _context20.abrupt("return", finalizeResponse);
|
|
1734
1833
|
|
|
1735
1834
|
case 45:
|
|
1736
1835
|
case "end":
|
|
1737
|
-
return
|
|
1836
|
+
return _context20.stop();
|
|
1738
1837
|
}
|
|
1739
1838
|
}
|
|
1740
1839
|
}, null, this);
|
|
@@ -1751,16 +1850,16 @@ exports.FinalizeContentObject = function _callee17(_ref21) {
|
|
|
1751
1850
|
*/
|
|
1752
1851
|
|
|
1753
1852
|
|
|
1754
|
-
exports.PublishContentVersion = function
|
|
1853
|
+
exports.PublishContentVersion = function _callee20(_ref23) {
|
|
1755
1854
|
var _this4 = this;
|
|
1756
1855
|
|
|
1757
|
-
var objectId, versionHash,
|
|
1856
|
+
var objectId, versionHash, _ref23$awaitCommitCon, awaitCommitConfirmation, commit, abi, fromBlock, objectHash, pendingHash;
|
|
1758
1857
|
|
|
1759
|
-
return _regeneratorRuntime.async(function
|
|
1858
|
+
return _regeneratorRuntime.async(function _callee20$(_context22) {
|
|
1760
1859
|
while (1) {
|
|
1761
|
-
switch (
|
|
1860
|
+
switch (_context22.prev = _context22.next) {
|
|
1762
1861
|
case 0:
|
|
1763
|
-
objectId =
|
|
1862
|
+
objectId = _ref23.objectId, versionHash = _ref23.versionHash, _ref23$awaitCommitCon = _ref23.awaitCommitConfirmation, awaitCommitConfirmation = _ref23$awaitCommitCon === void 0 ? true : _ref23$awaitCommitCon;
|
|
1764
1863
|
versionHash ? ValidateVersion(versionHash) : ValidateObject(objectId);
|
|
1765
1864
|
this.Log("Publishing: ".concat(objectId || versionHash));
|
|
1766
1865
|
|
|
@@ -1768,7 +1867,7 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1768
1867
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1769
1868
|
}
|
|
1770
1869
|
|
|
1771
|
-
|
|
1870
|
+
_context22.next = 6;
|
|
1772
1871
|
return _regeneratorRuntime.awrap(this.ethClient.CommitContent({
|
|
1773
1872
|
contentObjectAddress: this.utils.HashToAddress(objectId),
|
|
1774
1873
|
versionHash: versionHash,
|
|
@@ -1776,16 +1875,16 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1776
1875
|
}));
|
|
1777
1876
|
|
|
1778
1877
|
case 6:
|
|
1779
|
-
commit =
|
|
1780
|
-
|
|
1878
|
+
commit = _context22.sent;
|
|
1879
|
+
_context22.next = 9;
|
|
1781
1880
|
return _regeneratorRuntime.awrap(this.ContractAbi({
|
|
1782
1881
|
id: objectId
|
|
1783
1882
|
}));
|
|
1784
1883
|
|
|
1785
1884
|
case 9:
|
|
1786
|
-
abi =
|
|
1885
|
+
abi = _context22.sent;
|
|
1787
1886
|
fromBlock = commit.blockNumber + 1;
|
|
1788
|
-
|
|
1887
|
+
_context22.next = 13;
|
|
1789
1888
|
return _regeneratorRuntime.awrap(this.ExtractValueFromEvent({
|
|
1790
1889
|
abi: abi,
|
|
1791
1890
|
event: commit,
|
|
@@ -1794,18 +1893,18 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1794
1893
|
}));
|
|
1795
1894
|
|
|
1796
1895
|
case 13:
|
|
1797
|
-
objectHash =
|
|
1798
|
-
|
|
1896
|
+
objectHash = _context22.sent;
|
|
1897
|
+
_context22.next = 16;
|
|
1799
1898
|
return _regeneratorRuntime.awrap(this.CallContractMethod({
|
|
1800
1899
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
1801
1900
|
methodName: "pendingHash"
|
|
1802
1901
|
}));
|
|
1803
1902
|
|
|
1804
1903
|
case 16:
|
|
1805
|
-
pendingHash =
|
|
1904
|
+
pendingHash = _context22.sent;
|
|
1806
1905
|
|
|
1807
1906
|
if (!(pendingHash && pendingHash !== objectHash)) {
|
|
1808
|
-
|
|
1907
|
+
_context22.next = 19;
|
|
1809
1908
|
break;
|
|
1810
1909
|
}
|
|
1811
1910
|
|
|
@@ -1813,16 +1912,16 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1813
1912
|
|
|
1814
1913
|
case 19:
|
|
1815
1914
|
if (!awaitCommitConfirmation) {
|
|
1816
|
-
|
|
1915
|
+
_context22.next = 22;
|
|
1817
1916
|
break;
|
|
1818
1917
|
}
|
|
1819
1918
|
|
|
1820
|
-
|
|
1821
|
-
return _regeneratorRuntime.awrap(function
|
|
1919
|
+
_context22.next = 22;
|
|
1920
|
+
return _regeneratorRuntime.awrap(function _callee19() {
|
|
1822
1921
|
var pollingInterval, events, confirmEvent;
|
|
1823
|
-
return _regeneratorRuntime.async(function
|
|
1922
|
+
return _regeneratorRuntime.async(function _callee19$(_context21) {
|
|
1824
1923
|
while (1) {
|
|
1825
|
-
switch (
|
|
1924
|
+
switch (_context21.prev = _context21.next) {
|
|
1826
1925
|
case 0:
|
|
1827
1926
|
_this4.Log("Awaiting commit confirmation for ".concat(objectHash));
|
|
1828
1927
|
|
|
@@ -1830,17 +1929,17 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1830
1929
|
|
|
1831
1930
|
case 2:
|
|
1832
1931
|
if (!true) {
|
|
1833
|
-
|
|
1932
|
+
_context21.next = 14;
|
|
1834
1933
|
break;
|
|
1835
1934
|
}
|
|
1836
1935
|
|
|
1837
|
-
|
|
1936
|
+
_context21.next = 5;
|
|
1838
1937
|
return _regeneratorRuntime.awrap(new Promise(function (resolve) {
|
|
1839
1938
|
return setTimeout(resolve, pollingInterval);
|
|
1840
1939
|
}));
|
|
1841
1940
|
|
|
1842
1941
|
case 5:
|
|
1843
|
-
|
|
1942
|
+
_context21.next = 7;
|
|
1844
1943
|
return _regeneratorRuntime.awrap(_this4.ContractEvents({
|
|
1845
1944
|
contractAddress: _this4.utils.HashToAddress(objectId),
|
|
1846
1945
|
abi: abi,
|
|
@@ -1849,7 +1948,7 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1849
1948
|
}));
|
|
1850
1949
|
|
|
1851
1950
|
case 7:
|
|
1852
|
-
events =
|
|
1951
|
+
events = _context21.sent;
|
|
1853
1952
|
confirmEvent = events.find(function (blockEvents) {
|
|
1854
1953
|
return blockEvents.find(function (event) {
|
|
1855
1954
|
return objectHash === (event && event.values && event.values.objectHash);
|
|
@@ -1857,22 +1956,22 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1857
1956
|
});
|
|
1858
1957
|
|
|
1859
1958
|
if (!confirmEvent) {
|
|
1860
|
-
|
|
1959
|
+
_context21.next = 12;
|
|
1861
1960
|
break;
|
|
1862
1961
|
}
|
|
1863
1962
|
|
|
1864
1963
|
// Found confirmation
|
|
1865
1964
|
_this4.Log("Commit confirmed: ".concat(objectHash));
|
|
1866
1965
|
|
|
1867
|
-
return
|
|
1966
|
+
return _context21.abrupt("break", 14);
|
|
1868
1967
|
|
|
1869
1968
|
case 12:
|
|
1870
|
-
|
|
1969
|
+
_context21.next = 2;
|
|
1871
1970
|
break;
|
|
1872
1971
|
|
|
1873
1972
|
case 14:
|
|
1874
1973
|
case "end":
|
|
1875
|
-
return
|
|
1974
|
+
return _context21.stop();
|
|
1876
1975
|
}
|
|
1877
1976
|
}
|
|
1878
1977
|
});
|
|
@@ -1880,7 +1979,7 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1880
1979
|
|
|
1881
1980
|
case 22:
|
|
1882
1981
|
case "end":
|
|
1883
|
-
return
|
|
1982
|
+
return _context22.stop();
|
|
1884
1983
|
}
|
|
1885
1984
|
}
|
|
1886
1985
|
}, null, this);
|
|
@@ -1894,18 +1993,18 @@ exports.PublishContentVersion = function _callee19(_ref22) {
|
|
|
1894
1993
|
*/
|
|
1895
1994
|
|
|
1896
1995
|
|
|
1897
|
-
exports.DeleteContentVersion = function
|
|
1996
|
+
exports.DeleteContentVersion = function _callee21(_ref24) {
|
|
1898
1997
|
var versionHash, _this$utils$DecodeVer, objectId;
|
|
1899
1998
|
|
|
1900
|
-
return _regeneratorRuntime.async(function
|
|
1999
|
+
return _regeneratorRuntime.async(function _callee21$(_context23) {
|
|
1901
2000
|
while (1) {
|
|
1902
|
-
switch (
|
|
2001
|
+
switch (_context23.prev = _context23.next) {
|
|
1903
2002
|
case 0:
|
|
1904
|
-
versionHash =
|
|
2003
|
+
versionHash = _ref24.versionHash;
|
|
1905
2004
|
ValidateVersion(versionHash);
|
|
1906
2005
|
this.Log("Deleting content version: ".concat(versionHash));
|
|
1907
2006
|
_this$utils$DecodeVer = this.utils.DecodeVersionHash(versionHash), objectId = _this$utils$DecodeVer.objectId;
|
|
1908
|
-
|
|
2007
|
+
_context23.next = 6;
|
|
1909
2008
|
return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
|
|
1910
2009
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
1911
2010
|
methodName: "deleteVersion",
|
|
@@ -1914,7 +2013,7 @@ exports.DeleteContentVersion = function _callee20(_ref23) {
|
|
|
1914
2013
|
|
|
1915
2014
|
case 6:
|
|
1916
2015
|
case "end":
|
|
1917
|
-
return
|
|
2016
|
+
return _context23.stop();
|
|
1918
2017
|
}
|
|
1919
2018
|
}
|
|
1920
2019
|
}, null, this);
|
|
@@ -1929,19 +2028,19 @@ exports.DeleteContentVersion = function _callee20(_ref23) {
|
|
|
1929
2028
|
*/
|
|
1930
2029
|
|
|
1931
2030
|
|
|
1932
|
-
exports.DeleteContentObject = function
|
|
2031
|
+
exports.DeleteContentObject = function _callee22(_ref25) {
|
|
1933
2032
|
var libraryId, objectId;
|
|
1934
|
-
return _regeneratorRuntime.async(function
|
|
2033
|
+
return _regeneratorRuntime.async(function _callee22$(_context24) {
|
|
1935
2034
|
while (1) {
|
|
1936
|
-
switch (
|
|
2035
|
+
switch (_context24.prev = _context24.next) {
|
|
1937
2036
|
case 0:
|
|
1938
|
-
libraryId =
|
|
2037
|
+
libraryId = _ref25.libraryId, objectId = _ref25.objectId;
|
|
1939
2038
|
ValidateParameters({
|
|
1940
2039
|
libraryId: libraryId,
|
|
1941
2040
|
objectId: objectId
|
|
1942
2041
|
});
|
|
1943
2042
|
this.Log("Deleting content version: ".concat(libraryId, " ").concat(objectId));
|
|
1944
|
-
|
|
2043
|
+
_context24.next = 5;
|
|
1945
2044
|
return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
|
|
1946
2045
|
contractAddress: this.utils.HashToAddress(libraryId),
|
|
1947
2046
|
methodName: "deleteContent",
|
|
@@ -1950,7 +2049,7 @@ exports.DeleteContentObject = function _callee21(_ref24) {
|
|
|
1950
2049
|
|
|
1951
2050
|
case 5:
|
|
1952
2051
|
case "end":
|
|
1953
|
-
return
|
|
2052
|
+
return _context24.stop();
|
|
1954
2053
|
}
|
|
1955
2054
|
}
|
|
1956
2055
|
}, null, this);
|
|
@@ -1970,14 +2069,14 @@ exports.DeleteContentObject = function _callee21(_ref24) {
|
|
|
1970
2069
|
*/
|
|
1971
2070
|
|
|
1972
2071
|
|
|
1973
|
-
exports.MergeMetadata = function
|
|
1974
|
-
var libraryId, objectId, writeToken,
|
|
2072
|
+
exports.MergeMetadata = function _callee23(_ref26) {
|
|
2073
|
+
var libraryId, objectId, writeToken, _ref26$metadataSubtre, metadataSubtree, _ref26$metadata, metadata, path;
|
|
1975
2074
|
|
|
1976
|
-
return _regeneratorRuntime.async(function
|
|
2075
|
+
return _regeneratorRuntime.async(function _callee23$(_context25) {
|
|
1977
2076
|
while (1) {
|
|
1978
|
-
switch (
|
|
2077
|
+
switch (_context25.prev = _context25.next) {
|
|
1979
2078
|
case 0:
|
|
1980
|
-
libraryId =
|
|
2079
|
+
libraryId = _ref26.libraryId, objectId = _ref26.objectId, writeToken = _ref26.writeToken, _ref26$metadataSubtre = _ref26.metadataSubtree, metadataSubtree = _ref26$metadataSubtre === void 0 ? "/" : _ref26$metadataSubtre, _ref26$metadata = _ref26.metadata, metadata = _ref26$metadata === void 0 ? {} : _ref26$metadata;
|
|
1981
2080
|
ValidateParameters({
|
|
1982
2081
|
libraryId: libraryId,
|
|
1983
2082
|
objectId: objectId
|
|
@@ -1986,9 +2085,9 @@ exports.MergeMetadata = function _callee22(_ref25) {
|
|
|
1986
2085
|
this.Log("Merging metadata: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken, "\n Subtree: ").concat(metadataSubtree));
|
|
1987
2086
|
this.Log(metadata);
|
|
1988
2087
|
path = UrlJoin("q", writeToken, "meta", metadataSubtree);
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2088
|
+
_context25.t0 = _regeneratorRuntime;
|
|
2089
|
+
_context25.t1 = this.HttpClient;
|
|
2090
|
+
_context25.next = 10;
|
|
1992
2091
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationHeader({
|
|
1993
2092
|
libraryId: libraryId,
|
|
1994
2093
|
objectId: objectId,
|
|
@@ -1996,23 +2095,23 @@ exports.MergeMetadata = function _callee22(_ref25) {
|
|
|
1996
2095
|
}));
|
|
1997
2096
|
|
|
1998
2097
|
case 10:
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
headers:
|
|
2098
|
+
_context25.t2 = _context25.sent;
|
|
2099
|
+
_context25.t3 = path;
|
|
2100
|
+
_context25.t4 = metadata;
|
|
2101
|
+
_context25.t5 = {
|
|
2102
|
+
headers: _context25.t2,
|
|
2004
2103
|
method: "POST",
|
|
2005
|
-
path:
|
|
2006
|
-
body:
|
|
2104
|
+
path: _context25.t3,
|
|
2105
|
+
body: _context25.t4,
|
|
2007
2106
|
failover: false
|
|
2008
2107
|
};
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
return
|
|
2108
|
+
_context25.t6 = _context25.t1.Request.call(_context25.t1, _context25.t5);
|
|
2109
|
+
_context25.next = 17;
|
|
2110
|
+
return _context25.t0.awrap.call(_context25.t0, _context25.t6);
|
|
2012
2111
|
|
|
2013
2112
|
case 17:
|
|
2014
2113
|
case "end":
|
|
2015
|
-
return
|
|
2114
|
+
return _context25.stop();
|
|
2016
2115
|
}
|
|
2017
2116
|
}
|
|
2018
2117
|
}, null, this);
|
|
@@ -2030,14 +2129,14 @@ exports.MergeMetadata = function _callee22(_ref25) {
|
|
|
2030
2129
|
*/
|
|
2031
2130
|
|
|
2032
2131
|
|
|
2033
|
-
exports.ReplaceMetadata = function
|
|
2034
|
-
var libraryId, objectId, writeToken,
|
|
2132
|
+
exports.ReplaceMetadata = function _callee24(_ref27) {
|
|
2133
|
+
var libraryId, objectId, writeToken, _ref27$metadataSubtre, metadataSubtree, _ref27$metadata, metadata, path;
|
|
2035
2134
|
|
|
2036
|
-
return _regeneratorRuntime.async(function
|
|
2135
|
+
return _regeneratorRuntime.async(function _callee24$(_context26) {
|
|
2037
2136
|
while (1) {
|
|
2038
|
-
switch (
|
|
2137
|
+
switch (_context26.prev = _context26.next) {
|
|
2039
2138
|
case 0:
|
|
2040
|
-
libraryId =
|
|
2139
|
+
libraryId = _ref27.libraryId, objectId = _ref27.objectId, writeToken = _ref27.writeToken, _ref27$metadataSubtre = _ref27.metadataSubtree, metadataSubtree = _ref27$metadataSubtre === void 0 ? "/" : _ref27$metadataSubtre, _ref27$metadata = _ref27.metadata, metadata = _ref27$metadata === void 0 ? {} : _ref27$metadata;
|
|
2041
2140
|
ValidateParameters({
|
|
2042
2141
|
libraryId: libraryId,
|
|
2043
2142
|
objectId: objectId
|
|
@@ -2046,9 +2145,9 @@ exports.ReplaceMetadata = function _callee23(_ref26) {
|
|
|
2046
2145
|
this.Log("Replacing metadata: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken, "\n Subtree: ").concat(metadataSubtree));
|
|
2047
2146
|
this.Log(metadata);
|
|
2048
2147
|
path = UrlJoin("q", writeToken, "meta", metadataSubtree);
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2148
|
+
_context26.t0 = _regeneratorRuntime;
|
|
2149
|
+
_context26.t1 = this.HttpClient;
|
|
2150
|
+
_context26.next = 10;
|
|
2052
2151
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationHeader({
|
|
2053
2152
|
libraryId: libraryId,
|
|
2054
2153
|
objectId: objectId,
|
|
@@ -2056,23 +2155,23 @@ exports.ReplaceMetadata = function _callee23(_ref26) {
|
|
|
2056
2155
|
}));
|
|
2057
2156
|
|
|
2058
2157
|
case 10:
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
headers:
|
|
2158
|
+
_context26.t2 = _context26.sent;
|
|
2159
|
+
_context26.t3 = path;
|
|
2160
|
+
_context26.t4 = metadata;
|
|
2161
|
+
_context26.t5 = {
|
|
2162
|
+
headers: _context26.t2,
|
|
2064
2163
|
method: "PUT",
|
|
2065
|
-
path:
|
|
2066
|
-
body:
|
|
2164
|
+
path: _context26.t3,
|
|
2165
|
+
body: _context26.t4,
|
|
2067
2166
|
failover: false
|
|
2068
2167
|
};
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
return
|
|
2168
|
+
_context26.t6 = _context26.t1.Request.call(_context26.t1, _context26.t5);
|
|
2169
|
+
_context26.next = 17;
|
|
2170
|
+
return _context26.t0.awrap.call(_context26.t0, _context26.t6);
|
|
2072
2171
|
|
|
2073
2172
|
case 17:
|
|
2074
2173
|
case "end":
|
|
2075
|
-
return
|
|
2174
|
+
return _context26.stop();
|
|
2076
2175
|
}
|
|
2077
2176
|
}
|
|
2078
2177
|
}, null, this);
|
|
@@ -2090,14 +2189,14 @@ exports.ReplaceMetadata = function _callee23(_ref26) {
|
|
|
2090
2189
|
*/
|
|
2091
2190
|
|
|
2092
2191
|
|
|
2093
|
-
exports.DeleteMetadata = function
|
|
2094
|
-
var libraryId, objectId, writeToken,
|
|
2192
|
+
exports.DeleteMetadata = function _callee25(_ref28) {
|
|
2193
|
+
var libraryId, objectId, writeToken, _ref28$metadataSubtre, metadataSubtree, path;
|
|
2095
2194
|
|
|
2096
|
-
return _regeneratorRuntime.async(function
|
|
2195
|
+
return _regeneratorRuntime.async(function _callee25$(_context27) {
|
|
2097
2196
|
while (1) {
|
|
2098
|
-
switch (
|
|
2197
|
+
switch (_context27.prev = _context27.next) {
|
|
2099
2198
|
case 0:
|
|
2100
|
-
libraryId =
|
|
2199
|
+
libraryId = _ref28.libraryId, objectId = _ref28.objectId, writeToken = _ref28.writeToken, _ref28$metadataSubtre = _ref28.metadataSubtree, metadataSubtree = _ref28$metadataSubtre === void 0 ? "/" : _ref28$metadataSubtre;
|
|
2101
2200
|
ValidateParameters({
|
|
2102
2201
|
libraryId: libraryId,
|
|
2103
2202
|
objectId: objectId
|
|
@@ -2106,9 +2205,9 @@ exports.DeleteMetadata = function _callee24(_ref27) {
|
|
|
2106
2205
|
this.Log("Deleting metadata: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken, "\n Subtree: ").concat(metadataSubtree));
|
|
2107
2206
|
this.Log("Subtree: ".concat(metadataSubtree));
|
|
2108
2207
|
path = UrlJoin("q", writeToken, "meta", metadataSubtree);
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2208
|
+
_context27.t0 = _regeneratorRuntime;
|
|
2209
|
+
_context27.t1 = this.HttpClient;
|
|
2210
|
+
_context27.next = 10;
|
|
2112
2211
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationHeader({
|
|
2113
2212
|
libraryId: libraryId,
|
|
2114
2213
|
objectId: objectId,
|
|
@@ -2116,21 +2215,21 @@ exports.DeleteMetadata = function _callee24(_ref27) {
|
|
|
2116
2215
|
}));
|
|
2117
2216
|
|
|
2118
2217
|
case 10:
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
headers:
|
|
2218
|
+
_context27.t2 = _context27.sent;
|
|
2219
|
+
_context27.t3 = path;
|
|
2220
|
+
_context27.t4 = {
|
|
2221
|
+
headers: _context27.t2,
|
|
2123
2222
|
method: "DELETE",
|
|
2124
|
-
path:
|
|
2223
|
+
path: _context27.t3,
|
|
2125
2224
|
failover: false
|
|
2126
2225
|
};
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
return
|
|
2226
|
+
_context27.t5 = _context27.t1.Request.call(_context27.t1, _context27.t4);
|
|
2227
|
+
_context27.next = 16;
|
|
2228
|
+
return _context27.t0.awrap.call(_context27.t0, _context27.t5);
|
|
2130
2229
|
|
|
2131
2230
|
case 16:
|
|
2132
2231
|
case "end":
|
|
2133
|
-
return
|
|
2232
|
+
return _context27.stop();
|
|
2134
2233
|
}
|
|
2135
2234
|
}
|
|
2136
2235
|
}, null, this);
|
|
@@ -2145,16 +2244,16 @@ exports.DeleteMetadata = function _callee24(_ref27) {
|
|
|
2145
2244
|
*/
|
|
2146
2245
|
|
|
2147
2246
|
|
|
2148
|
-
exports.SetAccessCharge = function
|
|
2247
|
+
exports.SetAccessCharge = function _callee26(_ref29) {
|
|
2149
2248
|
var objectId, accessCharge;
|
|
2150
|
-
return _regeneratorRuntime.async(function
|
|
2249
|
+
return _regeneratorRuntime.async(function _callee26$(_context28) {
|
|
2151
2250
|
while (1) {
|
|
2152
|
-
switch (
|
|
2251
|
+
switch (_context28.prev = _context28.next) {
|
|
2153
2252
|
case 0:
|
|
2154
|
-
objectId =
|
|
2253
|
+
objectId = _ref29.objectId, accessCharge = _ref29.accessCharge;
|
|
2155
2254
|
ValidateObject(objectId);
|
|
2156
2255
|
this.Log("Setting access charge: ".concat(objectId, " ").concat(accessCharge));
|
|
2157
|
-
|
|
2256
|
+
_context28.next = 5;
|
|
2158
2257
|
return _regeneratorRuntime.awrap(this.ethClient.CallContractMethodAndWait({
|
|
2159
2258
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
2160
2259
|
methodName: "setAccessCharge",
|
|
@@ -2163,7 +2262,7 @@ exports.SetAccessCharge = function _callee25(_ref28) {
|
|
|
2163
2262
|
|
|
2164
2263
|
case 5:
|
|
2165
2264
|
case "end":
|
|
2166
|
-
return
|
|
2265
|
+
return _context28.stop();
|
|
2167
2266
|
}
|
|
2168
2267
|
}
|
|
2169
2268
|
}, null, this);
|
|
@@ -2183,16 +2282,16 @@ exports.SetAccessCharge = function _callee25(_ref28) {
|
|
|
2183
2282
|
*/
|
|
2184
2283
|
|
|
2185
2284
|
|
|
2186
|
-
exports.UpdateContentObjectGraph = function
|
|
2285
|
+
exports.UpdateContentObjectGraph = function _callee28(_ref30) {
|
|
2187
2286
|
var _this5 = this;
|
|
2188
2287
|
|
|
2189
2288
|
var libraryId, objectId, versionHash, callback, total, completed, _loop, _ret;
|
|
2190
2289
|
|
|
2191
|
-
return _regeneratorRuntime.async(function
|
|
2290
|
+
return _regeneratorRuntime.async(function _callee28$(_context31) {
|
|
2192
2291
|
while (1) {
|
|
2193
|
-
switch (
|
|
2292
|
+
switch (_context31.prev = _context31.next) {
|
|
2194
2293
|
case 0:
|
|
2195
|
-
libraryId =
|
|
2294
|
+
libraryId = _ref30.libraryId, objectId = _ref30.objectId, versionHash = _ref30.versionHash, callback = _ref30.callback;
|
|
2196
2295
|
ValidateParameters({
|
|
2197
2296
|
libraryId: libraryId,
|
|
2198
2297
|
objectId: objectId,
|
|
@@ -2207,13 +2306,13 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2207
2306
|
completed = 0; // eslint-disable-next-line no-constant-condition
|
|
2208
2307
|
|
|
2209
2308
|
_loop = function _loop() {
|
|
2210
|
-
var graph, currentHash, links, details, name, currentLibraryId, currentObjectId,
|
|
2309
|
+
var graph, currentHash, links, details, name, currentLibraryId, currentObjectId, _ref31, write_token, _ref33, hash;
|
|
2211
2310
|
|
|
2212
|
-
return _regeneratorRuntime.async(function _loop$(
|
|
2311
|
+
return _regeneratorRuntime.async(function _loop$(_context30) {
|
|
2213
2312
|
while (1) {
|
|
2214
|
-
switch (
|
|
2313
|
+
switch (_context30.prev = _context30.next) {
|
|
2215
2314
|
case 0:
|
|
2216
|
-
|
|
2315
|
+
_context30.next = 2;
|
|
2217
2316
|
return _regeneratorRuntime.awrap(_this5.ContentObjectGraph({
|
|
2218
2317
|
libraryId: libraryId,
|
|
2219
2318
|
objectId: objectId,
|
|
@@ -2223,16 +2322,16 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2223
2322
|
}));
|
|
2224
2323
|
|
|
2225
2324
|
case 2:
|
|
2226
|
-
graph =
|
|
2325
|
+
graph = _context30.sent;
|
|
2227
2326
|
|
|
2228
2327
|
if (!(Object.keys(graph.auto_updates).length === 0)) {
|
|
2229
|
-
|
|
2328
|
+
_context30.next = 6;
|
|
2230
2329
|
break;
|
|
2231
2330
|
}
|
|
2232
2331
|
|
|
2233
2332
|
_this5.Log("No more updates required");
|
|
2234
2333
|
|
|
2235
|
-
return
|
|
2334
|
+
return _context30.abrupt("return", {
|
|
2236
2335
|
v: void 0
|
|
2237
2336
|
});
|
|
2238
2337
|
|
|
@@ -2245,13 +2344,13 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2245
2344
|
links = graph.auto_updates.links[currentHash];
|
|
2246
2345
|
details = graph.details[currentHash].meta || {};
|
|
2247
2346
|
name = details["public"] && details["public"].asset_metadata && details["public"].asset_metadata.display_title || details["public"] && details["public"].name || details.name || versionHash || objectId;
|
|
2248
|
-
|
|
2347
|
+
_context30.next = 13;
|
|
2249
2348
|
return _regeneratorRuntime.awrap(_this5.ContentObjectLibraryId({
|
|
2250
2349
|
versionHash: currentHash
|
|
2251
2350
|
}));
|
|
2252
2351
|
|
|
2253
2352
|
case 13:
|
|
2254
|
-
currentLibraryId =
|
|
2353
|
+
currentLibraryId = _context30.sent;
|
|
2255
2354
|
currentObjectId = _this5.utils.DecodeVersionHash(currentHash).objectId;
|
|
2256
2355
|
|
|
2257
2356
|
if (callback) {
|
|
@@ -2264,24 +2363,24 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2264
2363
|
|
|
2265
2364
|
_this5.Log("Updating links for ".concat(name, " (").concat(currentObjectId, " / ").concat(currentHash, ")"));
|
|
2266
2365
|
|
|
2267
|
-
|
|
2366
|
+
_context30.next = 19;
|
|
2268
2367
|
return _regeneratorRuntime.awrap(_this5.EditContentObject({
|
|
2269
2368
|
libraryId: currentLibraryId,
|
|
2270
2369
|
objectId: currentObjectId
|
|
2271
2370
|
}));
|
|
2272
2371
|
|
|
2273
2372
|
case 19:
|
|
2274
|
-
|
|
2275
|
-
write_token =
|
|
2276
|
-
|
|
2277
|
-
return _regeneratorRuntime.awrap(Promise.all(links.map(function
|
|
2373
|
+
_ref31 = _context30.sent;
|
|
2374
|
+
write_token = _ref31.write_token;
|
|
2375
|
+
_context30.next = 23;
|
|
2376
|
+
return _regeneratorRuntime.awrap(Promise.all(links.map(function _callee27(_ref32) {
|
|
2278
2377
|
var path, updated;
|
|
2279
|
-
return _regeneratorRuntime.async(function
|
|
2378
|
+
return _regeneratorRuntime.async(function _callee27$(_context29) {
|
|
2280
2379
|
while (1) {
|
|
2281
|
-
switch (
|
|
2380
|
+
switch (_context29.prev = _context29.next) {
|
|
2282
2381
|
case 0:
|
|
2283
|
-
path =
|
|
2284
|
-
|
|
2382
|
+
path = _ref32.path, updated = _ref32.updated;
|
|
2383
|
+
_context29.next = 3;
|
|
2285
2384
|
return _regeneratorRuntime.awrap(_this5.ReplaceMetadata({
|
|
2286
2385
|
libraryId: currentLibraryId,
|
|
2287
2386
|
objectId: currentObjectId,
|
|
@@ -2292,14 +2391,14 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2292
2391
|
|
|
2293
2392
|
case 3:
|
|
2294
2393
|
case "end":
|
|
2295
|
-
return
|
|
2394
|
+
return _context29.stop();
|
|
2296
2395
|
}
|
|
2297
2396
|
}
|
|
2298
2397
|
});
|
|
2299
2398
|
})));
|
|
2300
2399
|
|
|
2301
2400
|
case 23:
|
|
2302
|
-
|
|
2401
|
+
_context30.next = 25;
|
|
2303
2402
|
return _regeneratorRuntime.awrap(_this5.FinalizeContentObject({
|
|
2304
2403
|
libraryId: currentLibraryId,
|
|
2305
2404
|
objectId: currentObjectId,
|
|
@@ -2308,8 +2407,8 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2308
2407
|
}));
|
|
2309
2408
|
|
|
2310
2409
|
case 25:
|
|
2311
|
-
|
|
2312
|
-
hash =
|
|
2410
|
+
_ref33 = _context30.sent;
|
|
2411
|
+
hash = _ref33.hash;
|
|
2313
2412
|
|
|
2314
2413
|
// If root object was specified by hash and updated, update hash
|
|
2315
2414
|
if (currentHash === versionHash) {
|
|
@@ -2320,7 +2419,7 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2320
2419
|
|
|
2321
2420
|
case 29:
|
|
2322
2421
|
case "end":
|
|
2323
|
-
return
|
|
2422
|
+
return _context30.stop();
|
|
2324
2423
|
}
|
|
2325
2424
|
}
|
|
2326
2425
|
});
|
|
@@ -2328,30 +2427,30 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2328
2427
|
|
|
2329
2428
|
case 6:
|
|
2330
2429
|
if (!1) {
|
|
2331
|
-
|
|
2430
|
+
_context31.next = 14;
|
|
2332
2431
|
break;
|
|
2333
2432
|
}
|
|
2334
2433
|
|
|
2335
|
-
|
|
2434
|
+
_context31.next = 9;
|
|
2336
2435
|
return _regeneratorRuntime.awrap(_loop());
|
|
2337
2436
|
|
|
2338
2437
|
case 9:
|
|
2339
|
-
_ret =
|
|
2438
|
+
_ret = _context31.sent;
|
|
2340
2439
|
|
|
2341
2440
|
if (!(_typeof(_ret) === "object")) {
|
|
2342
|
-
|
|
2441
|
+
_context31.next = 12;
|
|
2343
2442
|
break;
|
|
2344
2443
|
}
|
|
2345
2444
|
|
|
2346
|
-
return
|
|
2445
|
+
return _context31.abrupt("return", _ret.v);
|
|
2347
2446
|
|
|
2348
2447
|
case 12:
|
|
2349
|
-
|
|
2448
|
+
_context31.next = 6;
|
|
2350
2449
|
break;
|
|
2351
2450
|
|
|
2352
2451
|
case 14:
|
|
2353
2452
|
case "end":
|
|
2354
|
-
return
|
|
2453
|
+
return _context31.stop();
|
|
2355
2454
|
}
|
|
2356
2455
|
}
|
|
2357
2456
|
}, null, this);
|
|
@@ -2382,27 +2481,27 @@ exports.UpdateContentObjectGraph = function _callee27(_ref29) {
|
|
|
2382
2481
|
*/
|
|
2383
2482
|
|
|
2384
2483
|
|
|
2385
|
-
exports.CreateLinks = function
|
|
2484
|
+
exports.CreateLinks = function _callee30(_ref34) {
|
|
2386
2485
|
var _this6 = this;
|
|
2387
2486
|
|
|
2388
|
-
var libraryId, objectId, writeToken,
|
|
2487
|
+
var libraryId, objectId, writeToken, _ref34$links, links;
|
|
2389
2488
|
|
|
2390
|
-
return _regeneratorRuntime.async(function
|
|
2489
|
+
return _regeneratorRuntime.async(function _callee30$(_context33) {
|
|
2391
2490
|
while (1) {
|
|
2392
|
-
switch (
|
|
2491
|
+
switch (_context33.prev = _context33.next) {
|
|
2393
2492
|
case 0:
|
|
2394
|
-
libraryId =
|
|
2493
|
+
libraryId = _ref34.libraryId, objectId = _ref34.objectId, writeToken = _ref34.writeToken, _ref34$links = _ref34.links, links = _ref34$links === void 0 ? [] : _ref34$links;
|
|
2395
2494
|
ValidateParameters({
|
|
2396
2495
|
libraryId: libraryId,
|
|
2397
2496
|
objectId: objectId
|
|
2398
2497
|
});
|
|
2399
2498
|
ValidateWriteToken(writeToken);
|
|
2400
|
-
|
|
2401
|
-
return _regeneratorRuntime.awrap(this.utils.LimitedMap(10, links, function
|
|
2499
|
+
_context33.next = 5;
|
|
2500
|
+
return _regeneratorRuntime.awrap(this.utils.LimitedMap(10, links, function _callee29(info) {
|
|
2402
2501
|
var path, type, target, link;
|
|
2403
|
-
return _regeneratorRuntime.async(function
|
|
2502
|
+
return _regeneratorRuntime.async(function _callee29$(_context32) {
|
|
2404
2503
|
while (1) {
|
|
2405
|
-
switch (
|
|
2504
|
+
switch (_context32.prev = _context32.next) {
|
|
2406
2505
|
case 0:
|
|
2407
2506
|
path = info.path.replace(/^(\/|\.)+/, "");
|
|
2408
2507
|
type = (info.type || "file") === "file" ? "files" : info.type;
|
|
@@ -2431,7 +2530,7 @@ exports.CreateLinks = function _callee29(_ref33) {
|
|
|
2431
2530
|
};
|
|
2432
2531
|
}
|
|
2433
2532
|
|
|
2434
|
-
|
|
2533
|
+
_context32.next = 9;
|
|
2435
2534
|
return _regeneratorRuntime.awrap(_this6.ReplaceMetadata({
|
|
2436
2535
|
libraryId: libraryId,
|
|
2437
2536
|
objectId: objectId,
|
|
@@ -2442,7 +2541,7 @@ exports.CreateLinks = function _callee29(_ref33) {
|
|
|
2442
2541
|
|
|
2443
2542
|
case 9:
|
|
2444
2543
|
case "end":
|
|
2445
|
-
return
|
|
2544
|
+
return _context32.stop();
|
|
2446
2545
|
}
|
|
2447
2546
|
}
|
|
2448
2547
|
});
|
|
@@ -2450,7 +2549,7 @@ exports.CreateLinks = function _callee29(_ref33) {
|
|
|
2450
2549
|
|
|
2451
2550
|
case 5:
|
|
2452
2551
|
case "end":
|
|
2453
|
-
return
|
|
2552
|
+
return _context33.stop();
|
|
2454
2553
|
}
|
|
2455
2554
|
}
|
|
2456
2555
|
}, null, this);
|
|
@@ -2471,14 +2570,14 @@ exports.CreateLinks = function _callee29(_ref33) {
|
|
|
2471
2570
|
*/
|
|
2472
2571
|
|
|
2473
2572
|
|
|
2474
|
-
exports.InitializeAuthPolicy = function
|
|
2475
|
-
var libraryId, objectId, writeToken,
|
|
2573
|
+
exports.InitializeAuthPolicy = function _callee31(_ref35) {
|
|
2574
|
+
var libraryId, objectId, writeToken, _ref35$target, target, body, version, description, id, authPolicy, string;
|
|
2476
2575
|
|
|
2477
|
-
return _regeneratorRuntime.async(function
|
|
2576
|
+
return _regeneratorRuntime.async(function _callee31$(_context34) {
|
|
2478
2577
|
while (1) {
|
|
2479
|
-
switch (
|
|
2578
|
+
switch (_context34.prev = _context34.next) {
|
|
2480
2579
|
case 0:
|
|
2481
|
-
libraryId =
|
|
2580
|
+
libraryId = _ref35.libraryId, objectId = _ref35.objectId, writeToken = _ref35.writeToken, _ref35$target = _ref35.target, target = _ref35$target === void 0 ? "auth_policy_spec" : _ref35$target, body = _ref35.body, version = _ref35.version, description = _ref35.description, id = _ref35.id;
|
|
2482
2581
|
authPolicy = {
|
|
2483
2582
|
type: "epl-ast",
|
|
2484
2583
|
version: version,
|
|
@@ -2491,14 +2590,14 @@ exports.InitializeAuthPolicy = function _callee30(_ref34) {
|
|
|
2491
2590
|
id: id || ""
|
|
2492
2591
|
};
|
|
2493
2592
|
string = "".concat(authPolicy.type, "|").concat(authPolicy.version, "|").concat(authPolicy.body, "|").concat(authPolicy.data["/"]);
|
|
2494
|
-
|
|
2495
|
-
|
|
2593
|
+
_context34.t0 = this.utils;
|
|
2594
|
+
_context34.next = 6;
|
|
2496
2595
|
return _regeneratorRuntime.awrap(this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string))));
|
|
2497
2596
|
|
|
2498
2597
|
case 6:
|
|
2499
|
-
|
|
2500
|
-
authPolicy.signature =
|
|
2501
|
-
|
|
2598
|
+
_context34.t1 = _context34.sent;
|
|
2599
|
+
authPolicy.signature = _context34.t0.FormatSignature.call(_context34.t0, _context34.t1);
|
|
2600
|
+
_context34.next = 10;
|
|
2502
2601
|
return _regeneratorRuntime.awrap(this.ReplaceMetadata({
|
|
2503
2602
|
libraryId: libraryId,
|
|
2504
2603
|
objectId: objectId,
|
|
@@ -2508,7 +2607,7 @@ exports.InitializeAuthPolicy = function _callee30(_ref34) {
|
|
|
2508
2607
|
}));
|
|
2509
2608
|
|
|
2510
2609
|
case 10:
|
|
2511
|
-
|
|
2610
|
+
_context34.next = 12;
|
|
2512
2611
|
return _regeneratorRuntime.awrap(this.SetAuthPolicy({
|
|
2513
2612
|
objectId: objectId,
|
|
2514
2613
|
policyId: objectId
|
|
@@ -2516,7 +2615,7 @@ exports.InitializeAuthPolicy = function _callee30(_ref34) {
|
|
|
2516
2615
|
|
|
2517
2616
|
case 12:
|
|
2518
2617
|
case "end":
|
|
2519
|
-
return
|
|
2618
|
+
return _context34.stop();
|
|
2520
2619
|
}
|
|
2521
2620
|
}
|
|
2522
2621
|
}, null, this);
|
|
@@ -2531,14 +2630,14 @@ exports.InitializeAuthPolicy = function _callee30(_ref34) {
|
|
|
2531
2630
|
*/
|
|
2532
2631
|
|
|
2533
2632
|
|
|
2534
|
-
exports.SetAuthPolicy = function
|
|
2633
|
+
exports.SetAuthPolicy = function _callee32(_ref36) {
|
|
2535
2634
|
var objectId, policyId;
|
|
2536
|
-
return _regeneratorRuntime.async(function
|
|
2635
|
+
return _regeneratorRuntime.async(function _callee32$(_context35) {
|
|
2537
2636
|
while (1) {
|
|
2538
|
-
switch (
|
|
2637
|
+
switch (_context35.prev = _context35.next) {
|
|
2539
2638
|
case 0:
|
|
2540
|
-
objectId =
|
|
2541
|
-
|
|
2639
|
+
objectId = _ref36.objectId, policyId = _ref36.policyId;
|
|
2640
|
+
_context35.next = 3;
|
|
2542
2641
|
return _regeneratorRuntime.awrap(this.MergeContractMetadata({
|
|
2543
2642
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
2544
2643
|
metadataKey: "_AUTH_CONTEXT",
|
|
@@ -2549,7 +2648,7 @@ exports.SetAuthPolicy = function _callee31(_ref35) {
|
|
|
2549
2648
|
|
|
2550
2649
|
case 3:
|
|
2551
2650
|
case "end":
|
|
2552
|
-
return
|
|
2651
|
+
return _context35.stop();
|
|
2553
2652
|
}
|
|
2554
2653
|
}
|
|
2555
2654
|
}, null, this);
|