@eluvio/elv-client-js 3.1.77 → 3.1.81
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 +2 -2
- package/dist/ElvClient-node-min.js +3 -3
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/src/AuthorizationClient.js +175 -142
- package/dist/src/ElvClient.js +12 -7
- package/dist/src/UserProfileClient.js +19 -12
- package/dist/src/client/ContentAccess.js +68 -58
- package/dist/src/client/ContentManagement.js +40 -17
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/AuthorizationClient.js +19 -1
- package/src/ElvClient.js +11 -5
- package/src/UserProfileClient.js +14 -6
- package/src/client/ContentAccess.js +28 -17
- package/src/client/ContentManagement.js +11 -0
- package/testScripts/CreateABRMezzanine.js +0 -1
- package/testScripts/OfferingRemoveDash.js +49 -0
- package/typeSpecs/DropEventSite.js +308 -105
- package/typeSpecs/EventTenant.js +1 -1
- package/typeSpecs/Marketplace.js +234 -148
- package/typeSpecs/NFTTemplate.js +26 -4
- package/typeSpecs/UpdateTypes.js +92 -0
- package/utilities/ChannelGetTestUrls.js +179 -0
- package/utilities/MezzanineCreate.js +0 -1
- package/typeSpecs/EventSite.js +0 -803
- package/utilities/ChannelGetLiveUrls.js +0 -136
package/dist/src/ElvClient.js
CHANGED
|
@@ -205,7 +205,9 @@ function () {
|
|
|
205
205
|
_ref$noCache = _ref.noCache,
|
|
206
206
|
noCache = _ref$noCache === void 0 ? false : _ref$noCache,
|
|
207
207
|
_ref$noAuth = _ref.noAuth,
|
|
208
|
-
noAuth = _ref$noAuth === void 0 ? false : _ref$noAuth
|
|
208
|
+
noAuth = _ref$noAuth === void 0 ? false : _ref$noAuth,
|
|
209
|
+
_ref$assumeV = _ref.assumeV3,
|
|
210
|
+
assumeV3 = _ref$assumeV === void 0 ? false : _ref$assumeV;
|
|
209
211
|
|
|
210
212
|
_classCallCheck(this, ElvClient);
|
|
211
213
|
|
|
@@ -224,6 +226,7 @@ function () {
|
|
|
224
226
|
this.trustAuthorityId = trustAuthorityId;
|
|
225
227
|
this.noCache = noCache;
|
|
226
228
|
this.noAuth = noAuth;
|
|
229
|
+
this.assumeV3 = assumeV3;
|
|
227
230
|
this.debug = false;
|
|
228
231
|
this.InitializeClients({
|
|
229
232
|
staticToken: staticToken
|
|
@@ -1500,13 +1503,13 @@ function () {
|
|
|
1500
1503
|
}, {
|
|
1501
1504
|
key: "FromNetworkName",
|
|
1502
1505
|
value: function FromNetworkName(_ref22) {
|
|
1503
|
-
var networkName, region, trustAuthorityId, staticToken, _ref22$ethereumContra, ethereumContractTimeout, _ref22$noCache, noCache, _ref22$noAuth, noAuth, configUrl;
|
|
1506
|
+
var networkName, region, trustAuthorityId, staticToken, _ref22$ethereumContra, ethereumContractTimeout, _ref22$noCache, noCache, _ref22$noAuth, noAuth, assumeV3, configUrl;
|
|
1504
1507
|
|
|
1505
1508
|
return _regeneratorRuntime.async(function FromNetworkName$(_context19) {
|
|
1506
1509
|
while (1) {
|
|
1507
1510
|
switch (_context19.prev = _context19.next) {
|
|
1508
1511
|
case 0:
|
|
1509
|
-
networkName = _ref22.networkName, region = _ref22.region, trustAuthorityId = _ref22.trustAuthorityId, staticToken = _ref22.staticToken, _ref22$ethereumContra = _ref22.ethereumContractTimeout, ethereumContractTimeout = _ref22$ethereumContra === void 0 ? 10 : _ref22$ethereumContra, _ref22$noCache = _ref22.noCache, noCache = _ref22$noCache === void 0 ? false : _ref22$noCache, _ref22$noAuth = _ref22.noAuth, noAuth = _ref22$noAuth === void 0 ? false : _ref22$noAuth;
|
|
1512
|
+
networkName = _ref22.networkName, region = _ref22.region, trustAuthorityId = _ref22.trustAuthorityId, staticToken = _ref22.staticToken, _ref22$ethereumContra = _ref22.ethereumContractTimeout, ethereumContractTimeout = _ref22$ethereumContra === void 0 ? 10 : _ref22$ethereumContra, _ref22$noCache = _ref22.noCache, noCache = _ref22$noCache === void 0 ? false : _ref22$noCache, _ref22$noAuth = _ref22.noAuth, noAuth = _ref22$noAuth === void 0 ? false : _ref22$noAuth, assumeV3 = _ref22.assumeV3;
|
|
1510
1513
|
configUrl = networks[networkName];
|
|
1511
1514
|
|
|
1512
1515
|
if (configUrl) {
|
|
@@ -1525,7 +1528,8 @@ function () {
|
|
|
1525
1528
|
staticToken: staticToken,
|
|
1526
1529
|
ethereumContractTimeout: ethereumContractTimeout,
|
|
1527
1530
|
noCache: noCache,
|
|
1528
|
-
noAuth: noAuth
|
|
1531
|
+
noAuth: noAuth,
|
|
1532
|
+
assumeV3: assumeV3
|
|
1529
1533
|
}));
|
|
1530
1534
|
|
|
1531
1535
|
case 6:
|
|
@@ -1557,13 +1561,13 @@ function () {
|
|
|
1557
1561
|
}, {
|
|
1558
1562
|
key: "FromConfigurationUrl",
|
|
1559
1563
|
value: function FromConfigurationUrl(_ref23) {
|
|
1560
|
-
var configUrl, region, trustAuthorityId, staticToken, _ref23$ethereumContra, ethereumContractTimeout, _ref23$noCache, noCache, _ref23$noAuth, noAuth, _ref24, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion, client;
|
|
1564
|
+
var configUrl, region, trustAuthorityId, staticToken, _ref23$ethereumContra, ethereumContractTimeout, _ref23$noCache, noCache, _ref23$noAuth, noAuth, _ref23$assumeV, assumeV3, _ref24, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion, client;
|
|
1561
1565
|
|
|
1562
1566
|
return _regeneratorRuntime.async(function FromConfigurationUrl$(_context20) {
|
|
1563
1567
|
while (1) {
|
|
1564
1568
|
switch (_context20.prev = _context20.next) {
|
|
1565
1569
|
case 0:
|
|
1566
|
-
configUrl = _ref23.configUrl, region = _ref23.region, trustAuthorityId = _ref23.trustAuthorityId, staticToken = _ref23.staticToken, _ref23$ethereumContra = _ref23.ethereumContractTimeout, ethereumContractTimeout = _ref23$ethereumContra === void 0 ? 10 : _ref23$ethereumContra, _ref23$noCache = _ref23.noCache, noCache = _ref23$noCache === void 0 ? false : _ref23$noCache, _ref23$noAuth = _ref23.noAuth, noAuth = _ref23$noAuth === void 0 ? false : _ref23$noAuth;
|
|
1570
|
+
configUrl = _ref23.configUrl, region = _ref23.region, trustAuthorityId = _ref23.trustAuthorityId, staticToken = _ref23.staticToken, _ref23$ethereumContra = _ref23.ethereumContractTimeout, ethereumContractTimeout = _ref23$ethereumContra === void 0 ? 10 : _ref23$ethereumContra, _ref23$noCache = _ref23.noCache, noCache = _ref23$noCache === void 0 ? false : _ref23$noCache, _ref23$noAuth = _ref23.noAuth, noAuth = _ref23$noAuth === void 0 ? false : _ref23$noAuth, _ref23$assumeV = _ref23.assumeV3, assumeV3 = _ref23$assumeV === void 0 ? false : _ref23$assumeV;
|
|
1567
1571
|
_context20.next = 3;
|
|
1568
1572
|
return _regeneratorRuntime.awrap(ElvClient.Configuration({
|
|
1569
1573
|
configUrl: configUrl,
|
|
@@ -1591,7 +1595,8 @@ function () {
|
|
|
1591
1595
|
trustAuthorityId: trustAuthorityId,
|
|
1592
1596
|
staticToken: staticToken,
|
|
1593
1597
|
noCache: noCache,
|
|
1594
|
-
noAuth: noAuth
|
|
1598
|
+
noAuth: noAuth,
|
|
1599
|
+
assumeV3: assumeV3
|
|
1595
1600
|
});
|
|
1596
1601
|
client.configUrl = configUrl;
|
|
1597
1602
|
return _context20.abrupt("return", client);
|
|
@@ -78,6 +78,8 @@ function () {
|
|
|
78
78
|
this.client = client;
|
|
79
79
|
this.debug = debug;
|
|
80
80
|
this.userWalletAddresses = {};
|
|
81
|
+
this.walletAddress = undefined;
|
|
82
|
+
this.walletAddressRetrieved = false;
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
_createClass(UserProfileClient, [{
|
|
@@ -242,7 +244,7 @@ function () {
|
|
|
242
244
|
case 0:
|
|
243
245
|
autoCreate = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : true;
|
|
244
246
|
|
|
245
|
-
if (!this.walletAddress) {
|
|
247
|
+
if (!(this.walletAddress || this.walletAddressRetrieved)) {
|
|
246
248
|
_context2.next = 3;
|
|
247
249
|
break;
|
|
248
250
|
}
|
|
@@ -250,14 +252,18 @@ function () {
|
|
|
250
252
|
return _context2.abrupt("return", this.walletAddress);
|
|
251
253
|
|
|
252
254
|
case 3:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
if (!this.walletAddressPromise) {
|
|
256
|
+
this.walletAddressPromise = this.client.CallContractMethod({
|
|
257
|
+
contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
|
|
258
|
+
methodName: "userWallets",
|
|
259
|
+
methodArgs: [this.client.signer.address]
|
|
260
|
+
});
|
|
261
|
+
}
|
|
259
262
|
|
|
260
|
-
|
|
263
|
+
_context2.next = 6;
|
|
264
|
+
return _regeneratorRuntime.awrap(this.walletAddressPromise);
|
|
265
|
+
|
|
266
|
+
case 6:
|
|
261
267
|
walletAddress = _context2.sent;
|
|
262
268
|
|
|
263
269
|
if (!Utils.EqualAddress(walletAddress, Utils.nullAddress)) {
|
|
@@ -265,17 +271,18 @@ function () {
|
|
|
265
271
|
}
|
|
266
272
|
|
|
267
273
|
if (!(!this.walletAddress && autoCreate)) {
|
|
268
|
-
_context2.next =
|
|
274
|
+
_context2.next = 11;
|
|
269
275
|
break;
|
|
270
276
|
}
|
|
271
277
|
|
|
272
|
-
_context2.next =
|
|
278
|
+
_context2.next = 11;
|
|
273
279
|
return _regeneratorRuntime.awrap(this.CreateWallet());
|
|
274
280
|
|
|
275
|
-
case
|
|
281
|
+
case 11:
|
|
282
|
+
this.walletAddressRetrieved = true;
|
|
276
283
|
return _context2.abrupt("return", this.walletAddress);
|
|
277
284
|
|
|
278
|
-
case
|
|
285
|
+
case 13:
|
|
279
286
|
case "end":
|
|
280
287
|
return _context2.stop();
|
|
281
288
|
}
|
|
@@ -1326,13 +1326,13 @@ exports.ContentObjectLibraryId = function _callee19(_ref14) {
|
|
|
1326
1326
|
exports.ProduceMetadataLinks = function _callee22(_ref15) {
|
|
1327
1327
|
var _this7 = this;
|
|
1328
1328
|
|
|
1329
|
-
var libraryId, objectId, versionHash, _ref15$path, path, metadata, authorizationToken, result;
|
|
1329
|
+
var libraryId, objectId, versionHash, _ref15$path, path, metadata, authorizationToken, noAuth, result;
|
|
1330
1330
|
|
|
1331
1331
|
return _regeneratorRuntime.async(function _callee22$(_context22) {
|
|
1332
1332
|
while (1) {
|
|
1333
1333
|
switch (_context22.prev = _context22.next) {
|
|
1334
1334
|
case 0:
|
|
1335
|
-
libraryId = _ref15.libraryId, objectId = _ref15.objectId, versionHash = _ref15.versionHash, _ref15$path = _ref15.path, path = _ref15$path === void 0 ? "/" : _ref15$path, metadata = _ref15.metadata, authorizationToken = _ref15.authorizationToken;
|
|
1335
|
+
libraryId = _ref15.libraryId, objectId = _ref15.objectId, versionHash = _ref15.versionHash, _ref15$path = _ref15.path, path = _ref15$path === void 0 ? "/" : _ref15$path, metadata = _ref15.metadata, authorizationToken = _ref15.authorizationToken, noAuth = _ref15.noAuth;
|
|
1336
1336
|
|
|
1337
1337
|
if (!(!metadata || _typeof(metadata) !== "object")) {
|
|
1338
1338
|
_context22.next = 3;
|
|
@@ -1360,7 +1360,8 @@ exports.ProduceMetadataLinks = function _callee22(_ref15) {
|
|
|
1360
1360
|
versionHash: versionHash,
|
|
1361
1361
|
path: UrlJoin(path, i.toString()),
|
|
1362
1362
|
metadata: entry,
|
|
1363
|
-
authorizationToken: authorizationToken
|
|
1363
|
+
authorizationToken: authorizationToken,
|
|
1364
|
+
noAuth: noAuth
|
|
1364
1365
|
}));
|
|
1365
1366
|
|
|
1366
1367
|
case 2:
|
|
@@ -1417,7 +1418,8 @@ exports.ProduceMetadataLinks = function _callee22(_ref15) {
|
|
|
1417
1418
|
versionHash: versionHash,
|
|
1418
1419
|
path: UrlJoin(path, key),
|
|
1419
1420
|
metadata: metadata[key],
|
|
1420
|
-
authorizationToken: authorizationToken
|
|
1421
|
+
authorizationToken: authorizationToken,
|
|
1422
|
+
noAuth: noAuth
|
|
1421
1423
|
}));
|
|
1422
1424
|
|
|
1423
1425
|
case 2:
|
|
@@ -1443,13 +1445,13 @@ exports.ProduceMetadataLinks = function _callee22(_ref15) {
|
|
|
1443
1445
|
};
|
|
1444
1446
|
|
|
1445
1447
|
exports.MetadataAuth = function _callee23(_ref16) {
|
|
1446
|
-
var libraryId, objectId, versionHash, _ref16$path, path, _ref16$channelAuth, channelAuth,
|
|
1448
|
+
var libraryId, objectId, versionHash, _ref16$path, path, _ref16$channelAuth, channelAuth, _ref16$noAuth, noAuth, isPublic, accessType, visibility, kmsAddress;
|
|
1447
1449
|
|
|
1448
1450
|
return _regeneratorRuntime.async(function _callee23$(_context23) {
|
|
1449
1451
|
while (1) {
|
|
1450
1452
|
switch (_context23.prev = _context23.next) {
|
|
1451
1453
|
case 0:
|
|
1452
|
-
libraryId = _ref16.libraryId, objectId = _ref16.objectId, versionHash = _ref16.versionHash, _ref16$path = _ref16.path, path = _ref16$path === void 0 ? "/" : _ref16$path, _ref16$channelAuth = _ref16.channelAuth, channelAuth = _ref16$channelAuth === void 0 ? false : _ref16$channelAuth;
|
|
1454
|
+
libraryId = _ref16.libraryId, objectId = _ref16.objectId, versionHash = _ref16.versionHash, _ref16$path = _ref16.path, path = _ref16$path === void 0 ? "/" : _ref16$path, _ref16$channelAuth = _ref16.channelAuth, channelAuth = _ref16$channelAuth === void 0 ? false : _ref16$channelAuth, _ref16$noAuth = _ref16.noAuth, noAuth = _ref16$noAuth === void 0 ? false : _ref16$noAuth;
|
|
1453
1455
|
ValidateParameters({
|
|
1454
1456
|
libraryId: libraryId,
|
|
1455
1457
|
objectId: objectId,
|
|
@@ -1460,43 +1462,52 @@ exports.MetadataAuth = function _callee23(_ref16) {
|
|
|
1460
1462
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1461
1463
|
}
|
|
1462
1464
|
|
|
1463
|
-
|
|
1465
|
+
noAuth = this.noAuth || noAuth;
|
|
1466
|
+
isPublic = noAuth;
|
|
1467
|
+
|
|
1468
|
+
if (noAuth) {
|
|
1469
|
+
_context23.next = 14;
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
_context23.next = 8;
|
|
1464
1474
|
return _regeneratorRuntime.awrap(this.Visibility({
|
|
1465
1475
|
id: objectId
|
|
1466
1476
|
}));
|
|
1467
1477
|
|
|
1468
|
-
case
|
|
1478
|
+
case 8:
|
|
1469
1479
|
visibility = _context23.sent;
|
|
1470
|
-
_context23.next =
|
|
1480
|
+
_context23.next = 11;
|
|
1471
1481
|
return _regeneratorRuntime.awrap(this.AccessType({
|
|
1472
1482
|
id: objectId
|
|
1473
1483
|
}));
|
|
1474
1484
|
|
|
1475
|
-
case
|
|
1485
|
+
case 11:
|
|
1476
1486
|
accessType = _context23.sent;
|
|
1477
1487
|
isPublic = (path || "").replace(/^\/+/, "").startsWith("public");
|
|
1478
1488
|
noAuth = visibility >= 10 || isPublic && visibility >= 1;
|
|
1479
1489
|
|
|
1490
|
+
case 14:
|
|
1480
1491
|
if (!this.oauthToken) {
|
|
1481
|
-
_context23.next =
|
|
1492
|
+
_context23.next = 22;
|
|
1482
1493
|
break;
|
|
1483
1494
|
}
|
|
1484
1495
|
|
|
1485
|
-
_context23.next =
|
|
1496
|
+
_context23.next = 17;
|
|
1486
1497
|
return _regeneratorRuntime.awrap(this.authClient.KMSAddress({
|
|
1487
1498
|
objectId: objectId,
|
|
1488
1499
|
versionHash: versionHash
|
|
1489
1500
|
}));
|
|
1490
1501
|
|
|
1491
|
-
case
|
|
1502
|
+
case 17:
|
|
1492
1503
|
kmsAddress = _context23.sent;
|
|
1493
1504
|
|
|
1494
1505
|
if (!(kmsAddress && !this.utils.EqualAddress(kmsAddress, this.utils.nullAddress))) {
|
|
1495
|
-
_context23.next =
|
|
1506
|
+
_context23.next = 22;
|
|
1496
1507
|
break;
|
|
1497
1508
|
}
|
|
1498
1509
|
|
|
1499
|
-
_context23.next =
|
|
1510
|
+
_context23.next = 21;
|
|
1500
1511
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationToken({
|
|
1501
1512
|
libraryId: libraryId,
|
|
1502
1513
|
objectId: objectId,
|
|
@@ -1505,35 +1516,35 @@ exports.MetadataAuth = function _callee23(_ref16) {
|
|
|
1505
1516
|
oauthToken: this.oauthToken
|
|
1506
1517
|
}));
|
|
1507
1518
|
|
|
1508
|
-
case
|
|
1519
|
+
case 21:
|
|
1509
1520
|
return _context23.abrupt("return", _context23.sent);
|
|
1510
1521
|
|
|
1511
|
-
case
|
|
1522
|
+
case 22:
|
|
1512
1523
|
if (!(!this.inaccessibleLibraries[libraryId] && isPublic && accessType === this.authClient.ACCESS_TYPES.OBJECT && !channelAuth)) {
|
|
1513
|
-
_context23.next =
|
|
1524
|
+
_context23.next = 50;
|
|
1514
1525
|
break;
|
|
1515
1526
|
}
|
|
1516
1527
|
|
|
1517
|
-
_context23.prev =
|
|
1528
|
+
_context23.prev = 23;
|
|
1518
1529
|
_context23.t0 = _regeneratorRuntime;
|
|
1519
1530
|
_context23.t1 = this.authClient;
|
|
1520
1531
|
_context23.t2 = libraryId;
|
|
1521
1532
|
|
|
1522
1533
|
if (_context23.t2) {
|
|
1523
|
-
_context23.next =
|
|
1534
|
+
_context23.next = 31;
|
|
1524
1535
|
break;
|
|
1525
1536
|
}
|
|
1526
1537
|
|
|
1527
|
-
_context23.next =
|
|
1538
|
+
_context23.next = 30;
|
|
1528
1539
|
return _regeneratorRuntime.awrap(this.ContentObjectLibraryId({
|
|
1529
1540
|
objectId: objectId,
|
|
1530
1541
|
versionHash: versionHash
|
|
1531
1542
|
}));
|
|
1532
1543
|
|
|
1533
|
-
case
|
|
1544
|
+
case 30:
|
|
1534
1545
|
_context23.t2 = _context23.sent;
|
|
1535
1546
|
|
|
1536
|
-
case
|
|
1547
|
+
case 31:
|
|
1537
1548
|
_context23.t3 = _context23.t2;
|
|
1538
1549
|
_context23.t4 = noAuth;
|
|
1539
1550
|
_context23.t5 = {
|
|
@@ -1541,23 +1552,23 @@ exports.MetadataAuth = function _callee23(_ref16) {
|
|
|
1541
1552
|
noAuth: _context23.t4
|
|
1542
1553
|
};
|
|
1543
1554
|
_context23.t6 = _context23.t1.AuthorizationToken.call(_context23.t1, _context23.t5);
|
|
1544
|
-
_context23.next =
|
|
1555
|
+
_context23.next = 37;
|
|
1545
1556
|
return _context23.t0.awrap.call(_context23.t0, _context23.t6);
|
|
1546
1557
|
|
|
1547
|
-
case
|
|
1558
|
+
case 37:
|
|
1548
1559
|
return _context23.abrupt("return", _context23.sent);
|
|
1549
1560
|
|
|
1550
|
-
case
|
|
1551
|
-
_context23.prev =
|
|
1552
|
-
_context23.t7 = _context23["catch"](
|
|
1561
|
+
case 40:
|
|
1562
|
+
_context23.prev = 40;
|
|
1563
|
+
_context23.t7 = _context23["catch"](23);
|
|
1553
1564
|
|
|
1554
1565
|
if (!(_context23.t7.message && _context23.t7.message.toLowerCase().startsWith("access denied"))) {
|
|
1555
|
-
_context23.next =
|
|
1566
|
+
_context23.next = 47;
|
|
1556
1567
|
break;
|
|
1557
1568
|
}
|
|
1558
1569
|
|
|
1559
1570
|
this.inaccessibleLibraries[libraryId] = true;
|
|
1560
|
-
_context23.next =
|
|
1571
|
+
_context23.next = 46;
|
|
1561
1572
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationToken({
|
|
1562
1573
|
libraryId: libraryId,
|
|
1563
1574
|
objectId: objectId,
|
|
@@ -1566,18 +1577,18 @@ exports.MetadataAuth = function _callee23(_ref16) {
|
|
|
1566
1577
|
channelAuth: channelAuth
|
|
1567
1578
|
}));
|
|
1568
1579
|
|
|
1569
|
-
case
|
|
1580
|
+
case 46:
|
|
1570
1581
|
return _context23.abrupt("return", _context23.sent);
|
|
1571
1582
|
|
|
1572
|
-
case
|
|
1583
|
+
case 47:
|
|
1573
1584
|
throw _context23.t7;
|
|
1574
1585
|
|
|
1575
|
-
case
|
|
1576
|
-
_context23.next =
|
|
1586
|
+
case 48:
|
|
1587
|
+
_context23.next = 53;
|
|
1577
1588
|
break;
|
|
1578
1589
|
|
|
1579
|
-
case
|
|
1580
|
-
_context23.next =
|
|
1590
|
+
case 50:
|
|
1591
|
+
_context23.next = 52;
|
|
1581
1592
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationToken({
|
|
1582
1593
|
libraryId: libraryId,
|
|
1583
1594
|
objectId: objectId,
|
|
@@ -1586,15 +1597,15 @@ exports.MetadataAuth = function _callee23(_ref16) {
|
|
|
1586
1597
|
channelAuth: channelAuth
|
|
1587
1598
|
}));
|
|
1588
1599
|
|
|
1589
|
-
case
|
|
1600
|
+
case 52:
|
|
1590
1601
|
return _context23.abrupt("return", _context23.sent);
|
|
1591
1602
|
|
|
1592
|
-
case
|
|
1603
|
+
case 53:
|
|
1593
1604
|
case "end":
|
|
1594
1605
|
return _context23.stop();
|
|
1595
1606
|
}
|
|
1596
1607
|
}
|
|
1597
|
-
}, null, this, [[
|
|
1608
|
+
}, null, this, [[23, 40]]);
|
|
1598
1609
|
};
|
|
1599
1610
|
/**
|
|
1600
1611
|
* Get the metadata of a content object
|
|
@@ -1611,6 +1622,7 @@ exports.MetadataAuth = function _callee23(_ref16) {
|
|
|
1611
1622
|
* - Note: Selection is relative to "metadataSubtree". For example, metadataSubtree="public" and select=["name", "description"] would select "public/name" and "public/description"
|
|
1612
1623
|
* @param {Array<string>=} remove - Exclude the specified items from the retrieved metadata
|
|
1613
1624
|
* @param {string=} authorizationToken - Additional authorization token for this request
|
|
1625
|
+
* @param {string=} noAuth=false - If specified, the normal authorization flow will be skipped. Useful if you know the metadata you're retrieving is publicly accessible
|
|
1614
1626
|
* @param {boolean=} resolveLinks=false - If specified, links in the metadata will be resolved
|
|
1615
1627
|
* @param {boolean=} resolveIncludeSource=false - If specified, resolved links will include the hash of the link at the root of the metadata
|
|
1616
1628
|
|
|
@@ -1638,13 +1650,13 @@ exports.MetadataAuth = function _callee23(_ref16) {
|
|
|
1638
1650
|
|
|
1639
1651
|
|
|
1640
1652
|
exports.ContentObjectMetadata = function _callee24(_ref17) {
|
|
1641
|
-
var libraryId, objectId, versionHash, writeToken, _ref17$metadataSubtre, metadataSubtree, _ref17$queryParams, queryParams, _ref17$select, select, _ref17$remove, remove, authorizationToken, _ref17$resolveLinks, resolveLinks, _ref17$resolveInclude, resolveIncludeSource, _ref17$resolveIgnoreE, resolveIgnoreErrors, _ref17$linkDepthLimit, linkDepthLimit, _ref17$produceLinkUrl, produceLinkUrls, path, defaultAuthToken, authTokens, metadata;
|
|
1653
|
+
var libraryId, objectId, versionHash, writeToken, _ref17$metadataSubtre, metadataSubtree, _ref17$queryParams, queryParams, _ref17$select, select, _ref17$remove, remove, authorizationToken, _ref17$noAuth, noAuth, _ref17$resolveLinks, resolveLinks, _ref17$resolveInclude, resolveIncludeSource, _ref17$resolveIgnoreE, resolveIgnoreErrors, _ref17$linkDepthLimit, linkDepthLimit, _ref17$produceLinkUrl, produceLinkUrls, path, defaultAuthToken, authTokens, metadata;
|
|
1642
1654
|
|
|
1643
1655
|
return _regeneratorRuntime.async(function _callee24$(_context24) {
|
|
1644
1656
|
while (1) {
|
|
1645
1657
|
switch (_context24.prev = _context24.next) {
|
|
1646
1658
|
case 0:
|
|
1647
|
-
libraryId = _ref17.libraryId, objectId = _ref17.objectId, versionHash = _ref17.versionHash, writeToken = _ref17.writeToken, _ref17$metadataSubtre = _ref17.metadataSubtree, metadataSubtree = _ref17$metadataSubtre === void 0 ? "/" : _ref17$metadataSubtre, _ref17$queryParams = _ref17.queryParams, queryParams = _ref17$queryParams === void 0 ? {} : _ref17$queryParams, _ref17$select = _ref17.select, select = _ref17$select === void 0 ? [] : _ref17$select, _ref17$remove = _ref17.remove, remove = _ref17$remove === void 0 ? [] : _ref17$remove, authorizationToken = _ref17.authorizationToken, _ref17$resolveLinks = _ref17.resolveLinks, resolveLinks = _ref17$resolveLinks === void 0 ? false : _ref17$resolveLinks, _ref17$resolveInclude = _ref17.resolveIncludeSource, resolveIncludeSource = _ref17$resolveInclude === void 0 ? false : _ref17$resolveInclude, _ref17$resolveIgnoreE = _ref17.resolveIgnoreErrors, resolveIgnoreErrors = _ref17$resolveIgnoreE === void 0 ? false : _ref17$resolveIgnoreE, _ref17$linkDepthLimit = _ref17.linkDepthLimit, linkDepthLimit = _ref17$linkDepthLimit === void 0 ? 1 : _ref17$linkDepthLimit, _ref17$produceLinkUrl = _ref17.produceLinkUrls, produceLinkUrls = _ref17$produceLinkUrl === void 0 ? false : _ref17$produceLinkUrl;
|
|
1659
|
+
libraryId = _ref17.libraryId, objectId = _ref17.objectId, versionHash = _ref17.versionHash, writeToken = _ref17.writeToken, _ref17$metadataSubtre = _ref17.metadataSubtree, metadataSubtree = _ref17$metadataSubtre === void 0 ? "/" : _ref17$metadataSubtre, _ref17$queryParams = _ref17.queryParams, queryParams = _ref17$queryParams === void 0 ? {} : _ref17$queryParams, _ref17$select = _ref17.select, select = _ref17$select === void 0 ? [] : _ref17$select, _ref17$remove = _ref17.remove, remove = _ref17$remove === void 0 ? [] : _ref17$remove, authorizationToken = _ref17.authorizationToken, _ref17$noAuth = _ref17.noAuth, noAuth = _ref17$noAuth === void 0 ? false : _ref17$noAuth, _ref17$resolveLinks = _ref17.resolveLinks, resolveLinks = _ref17$resolveLinks === void 0 ? false : _ref17$resolveLinks, _ref17$resolveInclude = _ref17.resolveIncludeSource, resolveIncludeSource = _ref17$resolveInclude === void 0 ? false : _ref17$resolveInclude, _ref17$resolveIgnoreE = _ref17.resolveIgnoreErrors, resolveIgnoreErrors = _ref17$resolveIgnoreE === void 0 ? false : _ref17$resolveIgnoreE, _ref17$linkDepthLimit = _ref17.linkDepthLimit, linkDepthLimit = _ref17$linkDepthLimit === void 0 ? 1 : _ref17$linkDepthLimit, _ref17$produceLinkUrl = _ref17.produceLinkUrls, produceLinkUrls = _ref17$produceLinkUrl === void 0 ? false : _ref17$produceLinkUrl;
|
|
1648
1660
|
ValidateParameters({
|
|
1649
1661
|
libraryId: libraryId,
|
|
1650
1662
|
objectId: objectId,
|
|
@@ -1664,7 +1676,8 @@ exports.ContentObjectMetadata = function _callee24(_ref17) {
|
|
|
1664
1676
|
libraryId: libraryId,
|
|
1665
1677
|
objectId: objectId,
|
|
1666
1678
|
versionHash: versionHash,
|
|
1667
|
-
path: metadataSubtree
|
|
1679
|
+
path: metadataSubtree,
|
|
1680
|
+
noAuth: noAuth
|
|
1668
1681
|
}));
|
|
1669
1682
|
|
|
1670
1683
|
case 8:
|
|
@@ -1729,7 +1742,8 @@ exports.ContentObjectMetadata = function _callee24(_ref17) {
|
|
|
1729
1742
|
versionHash: versionHash,
|
|
1730
1743
|
path: metadataSubtree,
|
|
1731
1744
|
metadata: metadata,
|
|
1732
|
-
authorizationToken: authorizationToken
|
|
1745
|
+
authorizationToken: authorizationToken,
|
|
1746
|
+
noAuth: noAuth
|
|
1733
1747
|
}));
|
|
1734
1748
|
|
|
1735
1749
|
case 26:
|
|
@@ -1769,13 +1783,13 @@ exports.ContentObjectMetadata = function _callee24(_ref17) {
|
|
|
1769
1783
|
exports.AssetMetadata = function _callee25(_ref18) {
|
|
1770
1784
|
var _this8 = this;
|
|
1771
1785
|
|
|
1772
|
-
var libraryId, objectId, versionHash, metadata, localization, _ref18$produceLinkUrl, produceLinkUrls, mergedMetadata;
|
|
1786
|
+
var libraryId, objectId, versionHash, metadata, localization, noAuth, _ref18$produceLinkUrl, produceLinkUrls, mergedMetadata;
|
|
1773
1787
|
|
|
1774
1788
|
return _regeneratorRuntime.async(function _callee25$(_context25) {
|
|
1775
1789
|
while (1) {
|
|
1776
1790
|
switch (_context25.prev = _context25.next) {
|
|
1777
1791
|
case 0:
|
|
1778
|
-
libraryId = _ref18.libraryId, objectId = _ref18.objectId, versionHash = _ref18.versionHash, metadata = _ref18.metadata, localization = _ref18.localization, _ref18$produceLinkUrl = _ref18.produceLinkUrls, produceLinkUrls = _ref18$produceLinkUrl === void 0 ? false : _ref18$produceLinkUrl;
|
|
1792
|
+
libraryId = _ref18.libraryId, objectId = _ref18.objectId, versionHash = _ref18.versionHash, metadata = _ref18.metadata, localization = _ref18.localization, noAuth = _ref18.noAuth, _ref18$produceLinkUrl = _ref18.produceLinkUrls, produceLinkUrls = _ref18$produceLinkUrl === void 0 ? false : _ref18$produceLinkUrl;
|
|
1779
1793
|
ValidateParameters({
|
|
1780
1794
|
libraryId: libraryId,
|
|
1781
1795
|
objectId: objectId,
|
|
@@ -1800,7 +1814,8 @@ exports.AssetMetadata = function _callee25(_ref18) {
|
|
|
1800
1814
|
resolveLinks: true,
|
|
1801
1815
|
linkDepthLimit: 2,
|
|
1802
1816
|
resolveIgnoreErrors: true,
|
|
1803
|
-
produceLinkUrls: produceLinkUrls
|
|
1817
|
+
produceLinkUrls: produceLinkUrls,
|
|
1818
|
+
noAuth: noAuth
|
|
1804
1819
|
}));
|
|
1805
1820
|
|
|
1806
1821
|
case 6:
|
|
@@ -1830,7 +1845,8 @@ exports.AssetMetadata = function _callee25(_ref18) {
|
|
|
1830
1845
|
objectId: objectId,
|
|
1831
1846
|
versionHash: versionHash,
|
|
1832
1847
|
path: UrlJoin("public", "asset_metadata"),
|
|
1833
|
-
metadata: metadata
|
|
1848
|
+
metadata: metadata,
|
|
1849
|
+
noAuth: noAuth
|
|
1834
1850
|
}));
|
|
1835
1851
|
|
|
1836
1852
|
case 15:
|
|
@@ -3961,28 +3977,22 @@ exports.LinkUrl = function _callee44(_ref37) {
|
|
|
3961
3977
|
}
|
|
3962
3978
|
|
|
3963
3979
|
authorization = [authorizationToken];
|
|
3964
|
-
|
|
3965
|
-
if (noAuth) {
|
|
3966
|
-
_context44.next = 14;
|
|
3967
|
-
break;
|
|
3968
|
-
}
|
|
3969
|
-
|
|
3970
3980
|
_context44.t0 = authorization;
|
|
3971
|
-
_context44.next =
|
|
3981
|
+
_context44.next = 11;
|
|
3972
3982
|
return _regeneratorRuntime.awrap(this.MetadataAuth({
|
|
3973
3983
|
libraryId: libraryId,
|
|
3974
3984
|
objectId: objectId,
|
|
3975
3985
|
versionHash: versionHash,
|
|
3976
3986
|
path: linkPath,
|
|
3977
|
-
channelAuth: channelAuth
|
|
3987
|
+
channelAuth: channelAuth,
|
|
3988
|
+
noAuth: noAuth
|
|
3978
3989
|
}));
|
|
3979
3990
|
|
|
3980
|
-
case
|
|
3991
|
+
case 11:
|
|
3981
3992
|
_context44.t1 = _context44.sent;
|
|
3982
3993
|
|
|
3983
3994
|
_context44.t0.push.call(_context44.t0, _context44.t1);
|
|
3984
3995
|
|
|
3985
|
-
case 14:
|
|
3986
3996
|
if (queryParams.authorization) {
|
|
3987
3997
|
authorization.push(queryParams.authorization);
|
|
3988
3998
|
}
|
|
@@ -4003,7 +4013,7 @@ exports.LinkUrl = function _callee44(_ref37) {
|
|
|
4003
4013
|
queryParams: queryParams
|
|
4004
4014
|
}));
|
|
4005
4015
|
|
|
4006
|
-
case
|
|
4016
|
+
case 17:
|
|
4007
4017
|
case "end":
|
|
4008
4018
|
return _context44.stop();
|
|
4009
4019
|
}
|
|
@@ -880,7 +880,7 @@ exports.RemoveLibraryContentType = function _callee9(_ref12) {
|
|
|
880
880
|
|
|
881
881
|
|
|
882
882
|
exports.CreateContentObject = function _callee10(_ref13) {
|
|
883
|
-
var libraryId, objectId, _ref13$options, options, typeId, type, _ref14, contractAddress, path, createResponse;
|
|
883
|
+
var libraryId, objectId, _ref13$options, options, typeId, type, currentAccountAddress, canContribute, _ref14, contractAddress, path, createResponse;
|
|
884
884
|
|
|
885
885
|
return _regeneratorRuntime.async(function _callee10$(_context11) {
|
|
886
886
|
while (1) {
|
|
@@ -957,65 +957,88 @@ exports.CreateContentObject = function _callee10(_ref13) {
|
|
|
957
957
|
|
|
958
958
|
case 26:
|
|
959
959
|
if (objectId) {
|
|
960
|
-
_context11.next =
|
|
960
|
+
_context11.next = 44;
|
|
961
961
|
break;
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
+
_context11.next = 29;
|
|
965
|
+
return _regeneratorRuntime.awrap(this.CurrentAccountAddress());
|
|
966
|
+
|
|
967
|
+
case 29:
|
|
968
|
+
currentAccountAddress = _context11.sent;
|
|
969
|
+
_context11.next = 32;
|
|
970
|
+
return _regeneratorRuntime.awrap(this.CallContractMethod({
|
|
971
|
+
contractAddress: this.utils.HashToAddress(libraryId),
|
|
972
|
+
methodName: "canContribute",
|
|
973
|
+
methodArgs: [currentAccountAddress]
|
|
974
|
+
}));
|
|
975
|
+
|
|
976
|
+
case 32:
|
|
977
|
+
canContribute = _context11.sent;
|
|
978
|
+
|
|
979
|
+
if (canContribute) {
|
|
980
|
+
_context11.next = 35;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
throw Error("Current user does not have permission to create content in library ".concat(libraryId));
|
|
985
|
+
|
|
986
|
+
case 35:
|
|
964
987
|
this.Log("Deploying contract...");
|
|
965
|
-
_context11.next =
|
|
988
|
+
_context11.next = 38;
|
|
966
989
|
return _regeneratorRuntime.awrap(this.authClient.CreateContentObject({
|
|
967
990
|
libraryId: libraryId,
|
|
968
991
|
typeId: typeId
|
|
969
992
|
}));
|
|
970
993
|
|
|
971
|
-
case
|
|
994
|
+
case 38:
|
|
972
995
|
_ref14 = _context11.sent;
|
|
973
996
|
contractAddress = _ref14.contractAddress;
|
|
974
997
|
objectId = this.utils.AddressToObjectId(contractAddress);
|
|
975
998
|
this.Log("Contract deployed: ".concat(contractAddress, " ").concat(objectId));
|
|
976
|
-
_context11.next =
|
|
999
|
+
_context11.next = 51;
|
|
977
1000
|
break;
|
|
978
1001
|
|
|
979
|
-
case
|
|
1002
|
+
case 44:
|
|
980
1003
|
_context11.t0 = this;
|
|
981
1004
|
_context11.t1 = "Contract already deployed for contract type: ";
|
|
982
|
-
_context11.next =
|
|
1005
|
+
_context11.next = 48;
|
|
983
1006
|
return _regeneratorRuntime.awrap(this.AccessType({
|
|
984
1007
|
id: objectId
|
|
985
1008
|
}));
|
|
986
1009
|
|
|
987
|
-
case
|
|
1010
|
+
case 48:
|
|
988
1011
|
_context11.t2 = _context11.sent;
|
|
989
1012
|
_context11.t3 = _context11.t1.concat.call(_context11.t1, _context11.t2);
|
|
990
1013
|
|
|
991
1014
|
_context11.t0.Log.call(_context11.t0, _context11.t3);
|
|
992
1015
|
|
|
993
|
-
case
|
|
1016
|
+
case 51:
|
|
994
1017
|
if (!options.visibility) {
|
|
995
|
-
_context11.next =
|
|
1018
|
+
_context11.next = 55;
|
|
996
1019
|
break;
|
|
997
1020
|
}
|
|
998
1021
|
|
|
999
1022
|
this.Log("Setting visibility to ".concat(options.visibility));
|
|
1000
|
-
_context11.next =
|
|
1023
|
+
_context11.next = 55;
|
|
1001
1024
|
return _regeneratorRuntime.awrap(this.SetVisibility({
|
|
1002
1025
|
id: objectId,
|
|
1003
1026
|
visibility: options.visibility
|
|
1004
1027
|
}));
|
|
1005
1028
|
|
|
1006
|
-
case
|
|
1029
|
+
case 55:
|
|
1007
1030
|
path = UrlJoin("qid", objectId);
|
|
1008
1031
|
_context11.t4 = _regeneratorRuntime;
|
|
1009
1032
|
_context11.t5 = this.utils;
|
|
1010
1033
|
_context11.t6 = this.HttpClient;
|
|
1011
|
-
_context11.next =
|
|
1034
|
+
_context11.next = 61;
|
|
1012
1035
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationHeader({
|
|
1013
1036
|
libraryId: libraryId,
|
|
1014
1037
|
objectId: objectId,
|
|
1015
1038
|
update: true
|
|
1016
1039
|
}));
|
|
1017
1040
|
|
|
1018
|
-
case
|
|
1041
|
+
case 61:
|
|
1019
1042
|
_context11.t7 = _context11.sent;
|
|
1020
1043
|
_context11.t8 = path;
|
|
1021
1044
|
_context11.t9 = options;
|
|
@@ -1027,10 +1050,10 @@ exports.CreateContentObject = function _callee10(_ref13) {
|
|
|
1027
1050
|
};
|
|
1028
1051
|
_context11.t11 = _context11.t6.Request.call(_context11.t6, _context11.t10);
|
|
1029
1052
|
_context11.t12 = _context11.t5.ResponseToJson.call(_context11.t5, _context11.t11);
|
|
1030
|
-
_context11.next =
|
|
1053
|
+
_context11.next = 69;
|
|
1031
1054
|
return _context11.t4.awrap.call(_context11.t4, _context11.t12);
|
|
1032
1055
|
|
|
1033
|
-
case
|
|
1056
|
+
case 69:
|
|
1034
1057
|
createResponse = _context11.sent;
|
|
1035
1058
|
// Record the node used in creating this write token
|
|
1036
1059
|
this.HttpClient.RecordWriteToken(createResponse.write_token);
|
|
@@ -1038,7 +1061,7 @@ exports.CreateContentObject = function _callee10(_ref13) {
|
|
|
1038
1061
|
createResponse.objectId = createResponse.id;
|
|
1039
1062
|
return _context11.abrupt("return", createResponse);
|
|
1040
1063
|
|
|
1041
|
-
case
|
|
1064
|
+
case 74:
|
|
1042
1065
|
case "end":
|
|
1043
1066
|
return _context11.stop();
|
|
1044
1067
|
}
|
package/package-lock.json
CHANGED