@eluvio/elv-client-js 4.2.33 → 4.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +41 -32
- package/dist/src/ElvClient.js +391 -285
- package/dist/src/EthClient.js +3 -2
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +59 -52
- package/dist/src/client/ABRPublishing.js +71 -60
- package/dist/src/client/ContentAccess.js +585 -207
- package/dist/src/client/ContentManagement.js +667 -67
- package/dist/src/client/Files.js +1400 -844
- package/dist/src/client/LiveConf.js +66 -45
- package/dist/src/client/LiveStream.js +1649 -1194
- package/package.json +1 -1
- package/src/HttpClient.js +9 -2
- package/src/client/ContentAccess.js +6 -2
- package/src/client/ContentManagement.js +7 -5
- package/src/client/LiveConf.js +19 -13
- package/src/client/LiveStream.js +66 -12
- package/testScripts/Test.js +2 -14
|
@@ -15,13 +15,15 @@ var UrlJoin = require("url-join");
|
|
|
15
15
|
var objectPath = require("object-path");
|
|
16
16
|
var HttpClient = require("../HttpClient");
|
|
17
17
|
var ContentObjectAudit = require("../ContentObjectAudit");
|
|
18
|
+
var bs58 = require("bs58");
|
|
18
19
|
var _require = require("../Validation"),
|
|
19
20
|
ValidateLibrary = _require.ValidateLibrary,
|
|
20
21
|
ValidateObject = _require.ValidateObject,
|
|
21
22
|
ValidateVersion = _require.ValidateVersion,
|
|
22
23
|
ValidatePartHash = _require.ValidatePartHash,
|
|
23
24
|
ValidateWriteToken = _require.ValidateWriteToken,
|
|
24
|
-
ValidateParameters = _require.ValidateParameters
|
|
25
|
+
ValidateParameters = _require.ValidateParameters,
|
|
26
|
+
ValidatePresence = _require.ValidatePresence;
|
|
25
27
|
var MergeWith = require("lodash/mergeWith");
|
|
26
28
|
var LodashSet = require("lodash/set");
|
|
27
29
|
var LodashGet = require("lodash/get");
|
|
@@ -2963,16 +2965,18 @@ exports.MakeFileServiceRequest = /*#__PURE__*/function () {
|
|
|
2963
2965
|
* @param {boolean=} constant=true - If specified, a GET request authenticated with an AccessRequest will be made.
|
|
2964
2966
|
* Otherwise, a POST with an UpdateRequest will be performed
|
|
2965
2967
|
* @param {string=} format=json - The format of the response
|
|
2968
|
+
* @param {string=} nodeUrl - If specified, the call is made directly to this fabric node instead of
|
|
2969
|
+
* the client's currently configured node(s)
|
|
2966
2970
|
*
|
|
2967
2971
|
* @returns {Promise<format>} - The response from the call in the specified format
|
|
2968
2972
|
*/
|
|
2969
2973
|
exports.CallBitcodeMethod = /*#__PURE__*/function () {
|
|
2970
2974
|
var _ref63 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(_ref62) {
|
|
2971
|
-
var libraryId, objectId, versionHash, writeToken, method, verb, _ref62$queryParams, queryParams, _ref62$body, body, _ref62$headers, headers, _ref62$constant, constant, _ref62$format, format, path, authHeader;
|
|
2975
|
+
var libraryId, objectId, versionHash, writeToken, method, verb, _ref62$queryParams, queryParams, _ref62$body, body, _ref62$headers, headers, _ref62$constant, constant, _ref62$format, format, nodeUrl, path, authHeader;
|
|
2972
2976
|
return _regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
2973
2977
|
while (1) switch (_context35.prev = _context35.next) {
|
|
2974
2978
|
case 0:
|
|
2975
|
-
libraryId = _ref62.libraryId, objectId = _ref62.objectId, versionHash = _ref62.versionHash, writeToken = _ref62.writeToken, method = _ref62.method, verb = _ref62.verb, _ref62$queryParams = _ref62.queryParams, queryParams = _ref62$queryParams === void 0 ? {} : _ref62$queryParams, _ref62$body = _ref62.body, body = _ref62$body === void 0 ? {} : _ref62$body, _ref62$headers = _ref62.headers, headers = _ref62$headers === void 0 ? {} : _ref62$headers, _ref62$constant = _ref62.constant, constant = _ref62$constant === void 0 ? true : _ref62$constant, _ref62$format = _ref62.format, format = _ref62$format === void 0 ? "json" : _ref62$format;
|
|
2979
|
+
libraryId = _ref62.libraryId, objectId = _ref62.objectId, versionHash = _ref62.versionHash, writeToken = _ref62.writeToken, method = _ref62.method, verb = _ref62.verb, _ref62$queryParams = _ref62.queryParams, queryParams = _ref62$queryParams === void 0 ? {} : _ref62$queryParams, _ref62$body = _ref62.body, body = _ref62$body === void 0 ? {} : _ref62$body, _ref62$headers = _ref62.headers, headers = _ref62$headers === void 0 ? {} : _ref62$headers, _ref62$constant = _ref62.constant, constant = _ref62$constant === void 0 ? true : _ref62$constant, _ref62$format = _ref62.format, format = _ref62$format === void 0 ? "json" : _ref62$format, nodeUrl = _ref62.nodeUrl;
|
|
2976
2980
|
ValidateParameters({
|
|
2977
2981
|
libraryId: libraryId,
|
|
2978
2982
|
objectId: objectId,
|
|
@@ -3016,7 +3020,8 @@ exports.CallBitcodeMethod = /*#__PURE__*/function () {
|
|
|
3016
3020
|
method: verb,
|
|
3017
3021
|
path: path,
|
|
3018
3022
|
queryParams: queryParams,
|
|
3019
|
-
allowFailover: false
|
|
3023
|
+
allowFailover: false,
|
|
3024
|
+
nodeUrl: nodeUrl
|
|
3020
3025
|
});
|
|
3021
3026
|
case 18:
|
|
3022
3027
|
_context35.t2 = _context35.sent;
|
|
@@ -4307,6 +4312,98 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
|
|
|
4307
4312
|
};
|
|
4308
4313
|
}();
|
|
4309
4314
|
|
|
4315
|
+
/**
|
|
4316
|
+
* Encrypt the owner encryption key using the new user details provided
|
|
4317
|
+
*
|
|
4318
|
+
* @methodGroup Encryption
|
|
4319
|
+
* @namedParams
|
|
4320
|
+
* @param {string=} libraryId - ID of a library
|
|
4321
|
+
* @param {string=} objectId - ID of an object
|
|
4322
|
+
* @param {string=} versionHash - Hash of an object version
|
|
4323
|
+
* @param {string=} writeToken - The write token for the object
|
|
4324
|
+
* @param {Object=} newEncodedUserPublicKey - raw public key or base-58 encoded publicKey of the new user prefixed 'kupk'
|
|
4325
|
+
*/
|
|
4326
|
+
exports.MigrateEncryptionConkForUserProvided = /*#__PURE__*/function () {
|
|
4327
|
+
var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref87) {
|
|
4328
|
+
var libraryId, objectId, versionHash, writeToken, newEncodedUserPublicKey, publicKey, publicKeyBytes, existingCapKey, existingUserCap, encryptedConk, newUserCap;
|
|
4329
|
+
return _regeneratorRuntime.wrap(function _callee48$(_context48) {
|
|
4330
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4331
|
+
case 0:
|
|
4332
|
+
libraryId = _ref87.libraryId, objectId = _ref87.objectId, versionHash = _ref87.versionHash, writeToken = _ref87.writeToken, newEncodedUserPublicKey = _ref87.newEncodedUserPublicKey;
|
|
4333
|
+
if (!this.signer.remoteSigner) {
|
|
4334
|
+
_context48.next = 3;
|
|
4335
|
+
break;
|
|
4336
|
+
}
|
|
4337
|
+
return _context48.abrupt("return");
|
|
4338
|
+
case 3:
|
|
4339
|
+
ValidateParameters({
|
|
4340
|
+
libraryId: libraryId,
|
|
4341
|
+
objectId: objectId,
|
|
4342
|
+
versionHash: versionHash
|
|
4343
|
+
});
|
|
4344
|
+
ValidateWriteToken(writeToken);
|
|
4345
|
+
if (!objectId) {
|
|
4346
|
+
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
4347
|
+
}
|
|
4348
|
+
ValidatePresence("newEncodedUserPublicKey", newEncodedUserPublicKey);
|
|
4349
|
+
if (!newEncodedUserPublicKey.startsWith("kupk")) {
|
|
4350
|
+
publicKey = newEncodedUserPublicKey;
|
|
4351
|
+
} else {
|
|
4352
|
+
publicKeyBytes = bs58.decode(newEncodedUserPublicKey.slice(4));
|
|
4353
|
+
if (publicKeyBytes.length !== 65) {
|
|
4354
|
+
publicKey = "0x" + Buffer.concat([Buffer.from([0x04]), publicKeyBytes]).toString("hex");
|
|
4355
|
+
} else {
|
|
4356
|
+
publicKey = "0x" + publicKeyBytes.toString("hex");
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
|
|
4360
|
+
// Decrypt using existing user key
|
|
4361
|
+
existingCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
4362
|
+
_context48.next = 11;
|
|
4363
|
+
return this.ContentObjectMetadata({
|
|
4364
|
+
libraryId: libraryId,
|
|
4365
|
+
objectId: objectId,
|
|
4366
|
+
writeToken: writeToken,
|
|
4367
|
+
metadataSubtree: existingCapKey
|
|
4368
|
+
});
|
|
4369
|
+
case 11:
|
|
4370
|
+
existingUserCap = _context48.sent;
|
|
4371
|
+
if (existingUserCap) {
|
|
4372
|
+
_context48.next = 14;
|
|
4373
|
+
break;
|
|
4374
|
+
}
|
|
4375
|
+
throw "No encryption conk present for ".concat(objectId, " for user ").concat(this.signer.address);
|
|
4376
|
+
case 14:
|
|
4377
|
+
_context48.next = 16;
|
|
4378
|
+
return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
|
|
4379
|
+
case 16:
|
|
4380
|
+
this.encryptionConks[objectId] = _context48.sent;
|
|
4381
|
+
_context48.next = 19;
|
|
4382
|
+
return this.Crypto.EncryptConk(this.encryptionConks[objectId], publicKey);
|
|
4383
|
+
case 19:
|
|
4384
|
+
encryptedConk = _context48.sent;
|
|
4385
|
+
newUserCap = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.utils.PublicKeyToAddress(publicKey)));
|
|
4386
|
+
_context48.next = 23;
|
|
4387
|
+
return this.ReplaceMetadata({
|
|
4388
|
+
libraryId: libraryId,
|
|
4389
|
+
objectId: objectId,
|
|
4390
|
+
writeToken: writeToken,
|
|
4391
|
+
metadataSubtree: newUserCap,
|
|
4392
|
+
metadata: encryptedConk
|
|
4393
|
+
});
|
|
4394
|
+
case 23:
|
|
4395
|
+
return _context48.abrupt("return", this.encryptionConks[objectId]);
|
|
4396
|
+
case 24:
|
|
4397
|
+
case "end":
|
|
4398
|
+
return _context48.stop();
|
|
4399
|
+
}
|
|
4400
|
+
}, _callee48, this);
|
|
4401
|
+
}));
|
|
4402
|
+
return function (_x44) {
|
|
4403
|
+
return _ref88.apply(this, arguments);
|
|
4404
|
+
};
|
|
4405
|
+
}();
|
|
4406
|
+
|
|
4310
4407
|
/**
|
|
4311
4408
|
* Retrieve the encryption conk for the specified object. If one has not yet been created
|
|
4312
4409
|
* and a writeToken has been specified, this method will create a new conk and
|
|
@@ -4325,12 +4422,12 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
|
|
|
4325
4422
|
* @return Promise<Object> - The encryption conk for the object
|
|
4326
4423
|
*/
|
|
4327
4424
|
exports.EncryptionConk = /*#__PURE__*/function () {
|
|
4328
|
-
var
|
|
4329
|
-
var libraryId, objectId, versionHash, writeToken,
|
|
4330
|
-
return _regeneratorRuntime.wrap(function
|
|
4331
|
-
while (1) switch (
|
|
4425
|
+
var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(_ref89) {
|
|
4426
|
+
var libraryId, objectId, versionHash, writeToken, _ref89$download, download, owner, ownerCapKey, ownerCap, capKey, existingUserCap;
|
|
4427
|
+
return _regeneratorRuntime.wrap(function _callee49$(_context49) {
|
|
4428
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4332
4429
|
case 0:
|
|
4333
|
-
libraryId =
|
|
4430
|
+
libraryId = _ref89.libraryId, objectId = _ref89.objectId, versionHash = _ref89.versionHash, writeToken = _ref89.writeToken, _ref89$download = _ref89.download, download = _ref89$download === void 0 ? false : _ref89$download;
|
|
4334
4431
|
ValidateParameters({
|
|
4335
4432
|
libraryId: libraryId,
|
|
4336
4433
|
objectId: objectId,
|
|
@@ -4342,14 +4439,14 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4342
4439
|
if (!objectId) {
|
|
4343
4440
|
objectId = client.DecodeVersionHash(versionHash).objectId;
|
|
4344
4441
|
}
|
|
4345
|
-
|
|
4442
|
+
_context49.next = 6;
|
|
4346
4443
|
return this.authClient.Owner({
|
|
4347
4444
|
id: objectId
|
|
4348
4445
|
});
|
|
4349
4446
|
case 6:
|
|
4350
|
-
owner =
|
|
4447
|
+
owner = _context49.sent;
|
|
4351
4448
|
ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
4352
|
-
|
|
4449
|
+
_context49.next = 10;
|
|
4353
4450
|
return this.ContentObjectMetadata({
|
|
4354
4451
|
libraryId: libraryId,
|
|
4355
4452
|
objectId: objectId,
|
|
@@ -4358,39 +4455,39 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4358
4455
|
metadataSubtree: ownerCapKey
|
|
4359
4456
|
});
|
|
4360
4457
|
case 10:
|
|
4361
|
-
ownerCap =
|
|
4458
|
+
ownerCap = _context49.sent;
|
|
4362
4459
|
if (!(!this.utils.EqualAddress(owner, this.signer.address) && !ownerCap)) {
|
|
4363
|
-
|
|
4460
|
+
_context49.next = 21;
|
|
4364
4461
|
break;
|
|
4365
4462
|
}
|
|
4366
4463
|
if (!download) {
|
|
4367
|
-
|
|
4464
|
+
_context49.next = 18;
|
|
4368
4465
|
break;
|
|
4369
4466
|
}
|
|
4370
|
-
|
|
4467
|
+
_context49.next = 15;
|
|
4371
4468
|
return this.authClient.ReEncryptionConk({
|
|
4372
4469
|
libraryId: libraryId,
|
|
4373
4470
|
objectId: objectId,
|
|
4374
4471
|
versionHash: versionHash
|
|
4375
4472
|
});
|
|
4376
4473
|
case 15:
|
|
4377
|
-
return
|
|
4474
|
+
return _context49.abrupt("return", _context49.sent);
|
|
4378
4475
|
case 18:
|
|
4379
|
-
|
|
4476
|
+
_context49.next = 20;
|
|
4380
4477
|
return this.authClient.EncryptionConk({
|
|
4381
4478
|
libraryId: libraryId,
|
|
4382
4479
|
objectId: objectId,
|
|
4383
4480
|
versionHash: versionHash
|
|
4384
4481
|
});
|
|
4385
4482
|
case 20:
|
|
4386
|
-
return
|
|
4483
|
+
return _context49.abrupt("return", _context49.sent);
|
|
4387
4484
|
case 21:
|
|
4388
4485
|
if (this.encryptionConks[objectId]) {
|
|
4389
|
-
|
|
4486
|
+
_context49.next = 38;
|
|
4390
4487
|
break;
|
|
4391
4488
|
}
|
|
4392
4489
|
capKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
4393
|
-
|
|
4490
|
+
_context49.next = 25;
|
|
4394
4491
|
return this.ContentObjectMetadata({
|
|
4395
4492
|
libraryId: libraryId,
|
|
4396
4493
|
objectId: objectId,
|
|
@@ -4400,23 +4497,23 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4400
4497
|
metadataSubtree: capKey
|
|
4401
4498
|
});
|
|
4402
4499
|
case 25:
|
|
4403
|
-
existingUserCap =
|
|
4500
|
+
existingUserCap = _context49.sent;
|
|
4404
4501
|
if (!existingUserCap) {
|
|
4405
|
-
|
|
4502
|
+
_context49.next = 32;
|
|
4406
4503
|
break;
|
|
4407
4504
|
}
|
|
4408
|
-
|
|
4505
|
+
_context49.next = 29;
|
|
4409
4506
|
return this.Crypto.DecryptCap(existingUserCap, this.signer);
|
|
4410
4507
|
case 29:
|
|
4411
|
-
this.encryptionConks[objectId] =
|
|
4412
|
-
|
|
4508
|
+
this.encryptionConks[objectId] = _context49.sent;
|
|
4509
|
+
_context49.next = 38;
|
|
4413
4510
|
break;
|
|
4414
4511
|
case 32:
|
|
4415
4512
|
if (!writeToken) {
|
|
4416
|
-
|
|
4513
|
+
_context49.next = 37;
|
|
4417
4514
|
break;
|
|
4418
4515
|
}
|
|
4419
|
-
|
|
4516
|
+
_context49.next = 35;
|
|
4420
4517
|
return this.CreateEncryptionConk({
|
|
4421
4518
|
libraryId: libraryId,
|
|
4422
4519
|
objectId: objectId,
|
|
@@ -4425,20 +4522,20 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4425
4522
|
createKMSConk: false
|
|
4426
4523
|
});
|
|
4427
4524
|
case 35:
|
|
4428
|
-
|
|
4525
|
+
_context49.next = 38;
|
|
4429
4526
|
break;
|
|
4430
4527
|
case 37:
|
|
4431
4528
|
throw "No encryption conk present for " + objectId;
|
|
4432
4529
|
case 38:
|
|
4433
|
-
return
|
|
4530
|
+
return _context49.abrupt("return", this.encryptionConks[objectId]);
|
|
4434
4531
|
case 39:
|
|
4435
4532
|
case "end":
|
|
4436
|
-
return
|
|
4533
|
+
return _context49.stop();
|
|
4437
4534
|
}
|
|
4438
|
-
},
|
|
4535
|
+
}, _callee49, this);
|
|
4439
4536
|
}));
|
|
4440
|
-
return function (
|
|
4441
|
-
return
|
|
4537
|
+
return function (_x45) {
|
|
4538
|
+
return _ref90.apply(this, arguments);
|
|
4442
4539
|
};
|
|
4443
4540
|
}();
|
|
4444
4541
|
|
|
@@ -4456,37 +4553,37 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4456
4553
|
* @return {Promise<ArrayBuffer>}
|
|
4457
4554
|
*/
|
|
4458
4555
|
exports.Encrypt = /*#__PURE__*/function () {
|
|
4459
|
-
var
|
|
4556
|
+
var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(_ref91) {
|
|
4460
4557
|
var libraryId, objectId, writeToken, chunk, conk, data;
|
|
4461
|
-
return _regeneratorRuntime.wrap(function
|
|
4462
|
-
while (1) switch (
|
|
4558
|
+
return _regeneratorRuntime.wrap(function _callee50$(_context50) {
|
|
4559
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4463
4560
|
case 0:
|
|
4464
|
-
libraryId =
|
|
4561
|
+
libraryId = _ref91.libraryId, objectId = _ref91.objectId, writeToken = _ref91.writeToken, chunk = _ref91.chunk;
|
|
4465
4562
|
ValidateParameters({
|
|
4466
4563
|
libraryId: libraryId,
|
|
4467
4564
|
objectId: objectId
|
|
4468
4565
|
});
|
|
4469
|
-
|
|
4566
|
+
_context50.next = 4;
|
|
4470
4567
|
return this.EncryptionConk({
|
|
4471
4568
|
libraryId: libraryId,
|
|
4472
4569
|
objectId: objectId,
|
|
4473
4570
|
writeToken: writeToken
|
|
4474
4571
|
});
|
|
4475
4572
|
case 4:
|
|
4476
|
-
conk =
|
|
4477
|
-
|
|
4573
|
+
conk = _context50.sent;
|
|
4574
|
+
_context50.next = 7;
|
|
4478
4575
|
return this.Crypto.Encrypt(conk, chunk);
|
|
4479
4576
|
case 7:
|
|
4480
|
-
data =
|
|
4481
|
-
return
|
|
4577
|
+
data = _context50.sent;
|
|
4578
|
+
return _context50.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
|
|
4482
4579
|
case 9:
|
|
4483
4580
|
case "end":
|
|
4484
|
-
return
|
|
4581
|
+
return _context50.stop();
|
|
4485
4582
|
}
|
|
4486
|
-
},
|
|
4583
|
+
}, _callee50, this);
|
|
4487
4584
|
}));
|
|
4488
|
-
return function (
|
|
4489
|
-
return
|
|
4585
|
+
return function (_x46) {
|
|
4586
|
+
return _ref92.apply(this, arguments);
|
|
4490
4587
|
};
|
|
4491
4588
|
}();
|
|
4492
4589
|
|
|
@@ -4504,17 +4601,17 @@ exports.Encrypt = /*#__PURE__*/function () {
|
|
|
4504
4601
|
* @return {Promise<ArrayBuffer>}
|
|
4505
4602
|
*/
|
|
4506
4603
|
exports.Decrypt = /*#__PURE__*/function () {
|
|
4507
|
-
var
|
|
4604
|
+
var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(_ref93) {
|
|
4508
4605
|
var libraryId, objectId, writeToken, chunk, conk, data;
|
|
4509
|
-
return _regeneratorRuntime.wrap(function
|
|
4510
|
-
while (1) switch (
|
|
4606
|
+
return _regeneratorRuntime.wrap(function _callee51$(_context51) {
|
|
4607
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4511
4608
|
case 0:
|
|
4512
|
-
libraryId =
|
|
4609
|
+
libraryId = _ref93.libraryId, objectId = _ref93.objectId, writeToken = _ref93.writeToken, chunk = _ref93.chunk;
|
|
4513
4610
|
ValidateParameters({
|
|
4514
4611
|
libraryId: libraryId,
|
|
4515
4612
|
objectId: objectId
|
|
4516
4613
|
});
|
|
4517
|
-
|
|
4614
|
+
_context51.next = 4;
|
|
4518
4615
|
return this.EncryptionConk({
|
|
4519
4616
|
libraryId: libraryId,
|
|
4520
4617
|
objectId: objectId,
|
|
@@ -4522,20 +4619,20 @@ exports.Decrypt = /*#__PURE__*/function () {
|
|
|
4522
4619
|
download: true
|
|
4523
4620
|
});
|
|
4524
4621
|
case 4:
|
|
4525
|
-
conk =
|
|
4526
|
-
|
|
4622
|
+
conk = _context51.sent;
|
|
4623
|
+
_context51.next = 7;
|
|
4527
4624
|
return this.Crypto.Decrypt(conk, chunk);
|
|
4528
4625
|
case 7:
|
|
4529
|
-
data =
|
|
4530
|
-
return
|
|
4626
|
+
data = _context51.sent;
|
|
4627
|
+
return _context51.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
|
|
4531
4628
|
case 9:
|
|
4532
4629
|
case "end":
|
|
4533
|
-
return
|
|
4630
|
+
return _context51.stop();
|
|
4534
4631
|
}
|
|
4535
|
-
},
|
|
4632
|
+
}, _callee51, this);
|
|
4536
4633
|
}));
|
|
4537
|
-
return function (
|
|
4538
|
-
return
|
|
4634
|
+
return function (_x47) {
|
|
4635
|
+
return _ref94.apply(this, arguments);
|
|
4539
4636
|
};
|
|
4540
4637
|
}();
|
|
4541
4638
|
|
|
@@ -4551,24 +4648,24 @@ exports.Decrypt = /*#__PURE__*/function () {
|
|
|
4551
4648
|
* @return {Promise<string>} - Contract type of the item - "space", "library", "type", "object", "wallet", "group", or "other"
|
|
4552
4649
|
*/
|
|
4553
4650
|
exports.AccessType = /*#__PURE__*/function () {
|
|
4554
|
-
var
|
|
4651
|
+
var _ref96 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(_ref95) {
|
|
4555
4652
|
var id;
|
|
4556
|
-
return _regeneratorRuntime.wrap(function
|
|
4557
|
-
while (1) switch (
|
|
4653
|
+
return _regeneratorRuntime.wrap(function _callee52$(_context52) {
|
|
4654
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4558
4655
|
case 0:
|
|
4559
|
-
id =
|
|
4560
|
-
|
|
4656
|
+
id = _ref95.id;
|
|
4657
|
+
_context52.next = 3;
|
|
4561
4658
|
return this.authClient.AccessType(id);
|
|
4562
4659
|
case 3:
|
|
4563
|
-
return
|
|
4660
|
+
return _context52.abrupt("return", _context52.sent);
|
|
4564
4661
|
case 4:
|
|
4565
4662
|
case "end":
|
|
4566
|
-
return
|
|
4663
|
+
return _context52.stop();
|
|
4567
4664
|
}
|
|
4568
|
-
},
|
|
4665
|
+
}, _callee52, this);
|
|
4569
4666
|
}));
|
|
4570
|
-
return function (
|
|
4571
|
-
return
|
|
4667
|
+
return function (_x48) {
|
|
4668
|
+
return _ref96.apply(this, arguments);
|
|
4572
4669
|
};
|
|
4573
4670
|
}();
|
|
4574
4671
|
|
|
@@ -4584,12 +4681,12 @@ exports.AccessType = /*#__PURE__*/function () {
|
|
|
4584
4681
|
*
|
|
4585
4682
|
* @return {Promise<Object>} - Info about the access charge and whether or not the object is accessible to the current user */
|
|
4586
4683
|
exports.AccessInfo = /*#__PURE__*/function () {
|
|
4587
|
-
var
|
|
4684
|
+
var _ref98 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(_ref97) {
|
|
4588
4685
|
var objectId, args, info;
|
|
4589
|
-
return _regeneratorRuntime.wrap(function
|
|
4590
|
-
while (1) switch (
|
|
4686
|
+
return _regeneratorRuntime.wrap(function _callee53$(_context53) {
|
|
4687
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4591
4688
|
case 0:
|
|
4592
|
-
objectId =
|
|
4689
|
+
objectId = _ref97.objectId, args = _ref97.args;
|
|
4593
4690
|
ValidateObject(objectId);
|
|
4594
4691
|
if (!args) {
|
|
4595
4692
|
args = [0,
|
|
@@ -4601,16 +4698,16 @@ exports.AccessInfo = /*#__PURE__*/function () {
|
|
|
4601
4698
|
}
|
|
4602
4699
|
|
|
4603
4700
|
this.Log("Retrieving access info: ".concat(objectId));
|
|
4604
|
-
|
|
4701
|
+
_context53.next = 6;
|
|
4605
4702
|
return this.ethClient.CallContractMethod({
|
|
4606
4703
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
4607
4704
|
methodName: "getAccessInfo",
|
|
4608
4705
|
methodArgs: args
|
|
4609
4706
|
});
|
|
4610
4707
|
case 6:
|
|
4611
|
-
info =
|
|
4708
|
+
info = _context53.sent;
|
|
4612
4709
|
this.Log(info);
|
|
4613
|
-
return
|
|
4710
|
+
return _context53.abrupt("return", {
|
|
4614
4711
|
visibilityCode: info[0],
|
|
4615
4712
|
visible: info[0] >= 1,
|
|
4616
4713
|
accessible: info[0] >= 10,
|
|
@@ -4621,12 +4718,12 @@ exports.AccessInfo = /*#__PURE__*/function () {
|
|
|
4621
4718
|
});
|
|
4622
4719
|
case 9:
|
|
4623
4720
|
case "end":
|
|
4624
|
-
return
|
|
4721
|
+
return _context53.stop();
|
|
4625
4722
|
}
|
|
4626
|
-
},
|
|
4723
|
+
}, _callee53, this);
|
|
4627
4724
|
}));
|
|
4628
|
-
return function (
|
|
4629
|
-
return
|
|
4725
|
+
return function (_x49) {
|
|
4726
|
+
return _ref98.apply(this, arguments);
|
|
4630
4727
|
};
|
|
4631
4728
|
}();
|
|
4632
4729
|
|
|
@@ -4654,12 +4751,12 @@ exports.AccessInfo = /*#__PURE__*/function () {
|
|
|
4654
4751
|
* @return {Promise<Object>} - Resultant AccessRequest or UpdateRequest event
|
|
4655
4752
|
*/
|
|
4656
4753
|
exports.AccessRequest = /*#__PURE__*/function () {
|
|
4657
|
-
var
|
|
4658
|
-
var libraryId, objectId, versionHash,
|
|
4659
|
-
return _regeneratorRuntime.wrap(function
|
|
4660
|
-
while (1) switch (
|
|
4754
|
+
var _ref100 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(_ref99) {
|
|
4755
|
+
var libraryId, objectId, versionHash, _ref99$args, args, _ref99$update, update, _ref99$noCache, noCache;
|
|
4756
|
+
return _regeneratorRuntime.wrap(function _callee54$(_context54) {
|
|
4757
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
4661
4758
|
case 0:
|
|
4662
|
-
libraryId =
|
|
4759
|
+
libraryId = _ref99.libraryId, objectId = _ref99.objectId, versionHash = _ref99.versionHash, _ref99$args = _ref99.args, args = _ref99$args === void 0 ? [] : _ref99$args, _ref99$update = _ref99.update, update = _ref99$update === void 0 ? false : _ref99$update, _ref99$noCache = _ref99.noCache, noCache = _ref99$noCache === void 0 ? false : _ref99$noCache;
|
|
4663
4760
|
ValidateParameters({
|
|
4664
4761
|
libraryId: libraryId,
|
|
4665
4762
|
objectId: objectId,
|
|
@@ -4668,7 +4765,7 @@ exports.AccessRequest = /*#__PURE__*/function () {
|
|
|
4668
4765
|
if (versionHash) {
|
|
4669
4766
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
4670
4767
|
}
|
|
4671
|
-
|
|
4768
|
+
_context54.next = 5;
|
|
4672
4769
|
return this.authClient.MakeAccessRequest({
|
|
4673
4770
|
libraryId: libraryId,
|
|
4674
4771
|
objectId: objectId,
|
|
@@ -4679,15 +4776,15 @@ exports.AccessRequest = /*#__PURE__*/function () {
|
|
|
4679
4776
|
noCache: noCache
|
|
4680
4777
|
});
|
|
4681
4778
|
case 5:
|
|
4682
|
-
return
|
|
4779
|
+
return _context54.abrupt("return", _context54.sent);
|
|
4683
4780
|
case 6:
|
|
4684
4781
|
case "end":
|
|
4685
|
-
return
|
|
4782
|
+
return _context54.stop();
|
|
4686
4783
|
}
|
|
4687
|
-
},
|
|
4784
|
+
}, _callee54, this);
|
|
4688
4785
|
}));
|
|
4689
|
-
return function (
|
|
4690
|
-
return
|
|
4786
|
+
return function (_x50) {
|
|
4787
|
+
return _ref100.apply(this, arguments);
|
|
4691
4788
|
};
|
|
4692
4789
|
}();
|
|
4693
4790
|
|
|
@@ -4699,8 +4796,8 @@ exports.AccessRequest = /*#__PURE__*/function () {
|
|
|
4699
4796
|
* @param {Object=} context - Additional context to include in state channel requests
|
|
4700
4797
|
* - Note: Context must be a map of string->string
|
|
4701
4798
|
*/
|
|
4702
|
-
exports.SetAuthContext = function (
|
|
4703
|
-
var context =
|
|
4799
|
+
exports.SetAuthContext = function (_ref101) {
|
|
4800
|
+
var context = _ref101.context;
|
|
4704
4801
|
if (context && Object.values(context).find(function (value) {
|
|
4705
4802
|
return typeof value !== "string";
|
|
4706
4803
|
})) {
|
|
@@ -4724,34 +4821,34 @@ exports.SetAuthContext = function (_ref99) {
|
|
|
4724
4821
|
* @return {Promise<string>} - The state channel token
|
|
4725
4822
|
*/
|
|
4726
4823
|
exports.GenerateStateChannelToken = /*#__PURE__*/function () {
|
|
4727
|
-
var
|
|
4728
|
-
var objectId, versionHash, context,
|
|
4729
|
-
return _regeneratorRuntime.wrap(function
|
|
4730
|
-
while (1) switch (
|
|
4824
|
+
var _ref103 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(_ref102) {
|
|
4825
|
+
var objectId, versionHash, context, _ref102$noCache, noCache;
|
|
4826
|
+
return _regeneratorRuntime.wrap(function _callee55$(_context55) {
|
|
4827
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
4731
4828
|
case 0:
|
|
4732
|
-
objectId =
|
|
4829
|
+
objectId = _ref102.objectId, versionHash = _ref102.versionHash, context = _ref102.context, _ref102$noCache = _ref102.noCache, noCache = _ref102$noCache === void 0 ? false : _ref102$noCache;
|
|
4733
4830
|
versionHash ? ValidateVersion(versionHash) : ValidateObject(objectId);
|
|
4734
4831
|
if (!versionHash) {
|
|
4735
|
-
|
|
4832
|
+
_context55.next = 6;
|
|
4736
4833
|
break;
|
|
4737
4834
|
}
|
|
4738
4835
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
4739
|
-
|
|
4836
|
+
_context55.next = 10;
|
|
4740
4837
|
break;
|
|
4741
4838
|
case 6:
|
|
4742
4839
|
if (this.stateChannelAccess[objectId]) {
|
|
4743
|
-
|
|
4840
|
+
_context55.next = 10;
|
|
4744
4841
|
break;
|
|
4745
4842
|
}
|
|
4746
|
-
|
|
4843
|
+
_context55.next = 9;
|
|
4747
4844
|
return this.LatestVersionHash({
|
|
4748
4845
|
objectId: objectId
|
|
4749
4846
|
});
|
|
4750
4847
|
case 9:
|
|
4751
|
-
versionHash =
|
|
4848
|
+
versionHash = _context55.sent;
|
|
4752
4849
|
case 10:
|
|
4753
4850
|
this.stateChannelAccess[objectId] = versionHash;
|
|
4754
|
-
|
|
4851
|
+
_context55.next = 13;
|
|
4755
4852
|
return this.authClient.AuthorizationToken({
|
|
4756
4853
|
objectId: objectId,
|
|
4757
4854
|
channelAuth: true,
|
|
@@ -4760,15 +4857,15 @@ exports.GenerateStateChannelToken = /*#__PURE__*/function () {
|
|
|
4760
4857
|
noCache: noCache
|
|
4761
4858
|
});
|
|
4762
4859
|
case 13:
|
|
4763
|
-
return
|
|
4860
|
+
return _context55.abrupt("return", _context55.sent);
|
|
4764
4861
|
case 14:
|
|
4765
4862
|
case "end":
|
|
4766
|
-
return
|
|
4863
|
+
return _context55.stop();
|
|
4767
4864
|
}
|
|
4768
|
-
},
|
|
4865
|
+
}, _callee55, this);
|
|
4769
4866
|
}));
|
|
4770
|
-
return function (
|
|
4771
|
-
return
|
|
4867
|
+
return function (_x51) {
|
|
4868
|
+
return _ref103.apply(this, arguments);
|
|
4772
4869
|
};
|
|
4773
4870
|
}();
|
|
4774
4871
|
|
|
@@ -4782,38 +4879,38 @@ exports.GenerateStateChannelToken = /*#__PURE__*/function () {
|
|
|
4782
4879
|
* @param {number} percentComplete - Completion percentage of the content
|
|
4783
4880
|
*/
|
|
4784
4881
|
exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
|
|
4785
|
-
var
|
|
4882
|
+
var _ref105 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(_ref104) {
|
|
4786
4883
|
var objectId, versionHash, percentComplete;
|
|
4787
|
-
return _regeneratorRuntime.wrap(function
|
|
4788
|
-
while (1) switch (
|
|
4884
|
+
return _regeneratorRuntime.wrap(function _callee56$(_context56) {
|
|
4885
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
4789
4886
|
case 0:
|
|
4790
|
-
objectId =
|
|
4887
|
+
objectId = _ref104.objectId, versionHash = _ref104.versionHash, percentComplete = _ref104.percentComplete;
|
|
4791
4888
|
versionHash ? ValidateVersion(versionHash) : ValidateObject(objectId);
|
|
4792
4889
|
if (!versionHash) {
|
|
4793
|
-
|
|
4890
|
+
_context56.next = 6;
|
|
4794
4891
|
break;
|
|
4795
4892
|
}
|
|
4796
4893
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
4797
|
-
|
|
4894
|
+
_context56.next = 13;
|
|
4798
4895
|
break;
|
|
4799
4896
|
case 6:
|
|
4800
4897
|
if (!this.stateChannelAccess[objectId]) {
|
|
4801
|
-
|
|
4898
|
+
_context56.next = 10;
|
|
4802
4899
|
break;
|
|
4803
4900
|
}
|
|
4804
4901
|
versionHash = this.stateChannelAccess[objectId];
|
|
4805
|
-
|
|
4902
|
+
_context56.next = 13;
|
|
4806
4903
|
break;
|
|
4807
4904
|
case 10:
|
|
4808
|
-
|
|
4905
|
+
_context56.next = 12;
|
|
4809
4906
|
return this.LatestVersionHash({
|
|
4810
4907
|
objectId: objectId
|
|
4811
4908
|
});
|
|
4812
4909
|
case 12:
|
|
4813
|
-
versionHash =
|
|
4910
|
+
versionHash = _context56.sent;
|
|
4814
4911
|
case 13:
|
|
4815
4912
|
this.stateChannelAccess[objectId] = undefined;
|
|
4816
|
-
|
|
4913
|
+
_context56.next = 16;
|
|
4817
4914
|
return this.authClient.ChannelContentFinalize({
|
|
4818
4915
|
objectId: objectId,
|
|
4819
4916
|
versionHash: versionHash,
|
|
@@ -4821,12 +4918,12 @@ exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
|
|
|
4821
4918
|
});
|
|
4822
4919
|
case 16:
|
|
4823
4920
|
case "end":
|
|
4824
|
-
return
|
|
4921
|
+
return _context56.stop();
|
|
4825
4922
|
}
|
|
4826
|
-
},
|
|
4923
|
+
}, _callee56, this);
|
|
4827
4924
|
}));
|
|
4828
|
-
return function (
|
|
4829
|
-
return
|
|
4925
|
+
return function (_x52) {
|
|
4926
|
+
return _ref105.apply(this, arguments);
|
|
4830
4927
|
};
|
|
4831
4928
|
}();
|
|
4832
4929
|
|
|
@@ -4843,34 +4940,34 @@ exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
|
|
|
4843
4940
|
* @returns {Promise<Object>} - Transaction log of the AccessComplete event
|
|
4844
4941
|
*/
|
|
4845
4942
|
exports.ContentObjectAccessComplete = /*#__PURE__*/function () {
|
|
4846
|
-
var
|
|
4847
|
-
var objectId,
|
|
4848
|
-
return _regeneratorRuntime.wrap(function
|
|
4849
|
-
while (1) switch (
|
|
4943
|
+
var _ref107 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(_ref106) {
|
|
4944
|
+
var objectId, _ref106$score, score;
|
|
4945
|
+
return _regeneratorRuntime.wrap(function _callee57$(_context57) {
|
|
4946
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
4850
4947
|
case 0:
|
|
4851
|
-
objectId =
|
|
4948
|
+
objectId = _ref106.objectId, _ref106$score = _ref106.score, score = _ref106$score === void 0 ? 100 : _ref106$score;
|
|
4852
4949
|
ValidateObject(objectId);
|
|
4853
4950
|
if (!(score < 0 || score > 100)) {
|
|
4854
|
-
|
|
4951
|
+
_context57.next = 4;
|
|
4855
4952
|
break;
|
|
4856
4953
|
}
|
|
4857
4954
|
throw Error("Invalid AccessComplete score: " + score);
|
|
4858
4955
|
case 4:
|
|
4859
|
-
|
|
4956
|
+
_context57.next = 6;
|
|
4860
4957
|
return this.authClient.AccessComplete({
|
|
4861
4958
|
id: objectId,
|
|
4862
4959
|
score: score
|
|
4863
4960
|
});
|
|
4864
4961
|
case 6:
|
|
4865
|
-
return
|
|
4962
|
+
return _context57.abrupt("return", _context57.sent);
|
|
4866
4963
|
case 7:
|
|
4867
4964
|
case "end":
|
|
4868
|
-
return
|
|
4965
|
+
return _context57.stop();
|
|
4869
4966
|
}
|
|
4870
|
-
},
|
|
4967
|
+
}, _callee57, this);
|
|
4871
4968
|
}));
|
|
4872
|
-
return function (
|
|
4873
|
-
return
|
|
4969
|
+
return function (_x53) {
|
|
4970
|
+
return _ref107.apply(this, arguments);
|
|
4874
4971
|
};
|
|
4875
4972
|
}();
|
|
4876
4973
|
|
|
@@ -4892,62 +4989,62 @@ exports.ContentObjectAccessComplete = /*#__PURE__*/function () {
|
|
|
4892
4989
|
* @return {Promise<Array<string>>} - List of addresses of available items
|
|
4893
4990
|
*/
|
|
4894
4991
|
exports.Collection = /*#__PURE__*/function () {
|
|
4895
|
-
var
|
|
4992
|
+
var _ref109 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(_ref108) {
|
|
4896
4993
|
var collectionType, validCollectionTypes, walletAddress;
|
|
4897
|
-
return _regeneratorRuntime.wrap(function
|
|
4898
|
-
while (1) switch (
|
|
4994
|
+
return _regeneratorRuntime.wrap(function _callee58$(_context58) {
|
|
4995
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
4899
4996
|
case 0:
|
|
4900
|
-
collectionType =
|
|
4997
|
+
collectionType = _ref108.collectionType;
|
|
4901
4998
|
validCollectionTypes = ["accessGroups", "contentObjects", "contentTypes", "contracts", "libraries"];
|
|
4902
4999
|
if (validCollectionTypes.includes(collectionType)) {
|
|
4903
|
-
|
|
5000
|
+
_context58.next = 4;
|
|
4904
5001
|
break;
|
|
4905
5002
|
}
|
|
4906
5003
|
throw new Error("Invalid collection type: " + collectionType);
|
|
4907
5004
|
case 4:
|
|
4908
5005
|
if (!this.signer) {
|
|
4909
|
-
|
|
5006
|
+
_context58.next = 10;
|
|
4910
5007
|
break;
|
|
4911
5008
|
}
|
|
4912
|
-
|
|
5009
|
+
_context58.next = 7;
|
|
4913
5010
|
return this.userProfileClient.WalletAddress();
|
|
4914
5011
|
case 7:
|
|
4915
|
-
|
|
4916
|
-
|
|
5012
|
+
_context58.t0 = _context58.sent;
|
|
5013
|
+
_context58.next = 11;
|
|
4917
5014
|
break;
|
|
4918
5015
|
case 10:
|
|
4919
|
-
|
|
5016
|
+
_context58.t0 = undefined;
|
|
4920
5017
|
case 11:
|
|
4921
|
-
walletAddress =
|
|
5018
|
+
walletAddress = _context58.t0;
|
|
4922
5019
|
if (walletAddress) {
|
|
4923
|
-
|
|
5020
|
+
_context58.next = 14;
|
|
4924
5021
|
break;
|
|
4925
5022
|
}
|
|
4926
5023
|
throw new Error("Unable to get collection: User wallet doesn't exist");
|
|
4927
5024
|
case 14:
|
|
4928
5025
|
this.Log("Retrieving ".concat(collectionType, " contract collection for user ").concat(this.signer.address));
|
|
4929
|
-
|
|
5026
|
+
_context58.next = 17;
|
|
4930
5027
|
return this.ethClient.MakeProviderCall({
|
|
4931
5028
|
methodName: "send",
|
|
4932
5029
|
args: ["elv_getWalletCollection", [this.contentSpaceId, "iusr".concat(this.utils.AddressToHash(this.signer.address)), collectionType]]
|
|
4933
5030
|
});
|
|
4934
5031
|
case 17:
|
|
4935
|
-
|
|
4936
|
-
if (
|
|
4937
|
-
|
|
5032
|
+
_context58.t1 = _context58.sent;
|
|
5033
|
+
if (_context58.t1) {
|
|
5034
|
+
_context58.next = 20;
|
|
4938
5035
|
break;
|
|
4939
5036
|
}
|
|
4940
|
-
|
|
5037
|
+
_context58.t1 = [];
|
|
4941
5038
|
case 20:
|
|
4942
|
-
return
|
|
5039
|
+
return _context58.abrupt("return", _context58.t1);
|
|
4943
5040
|
case 21:
|
|
4944
5041
|
case "end":
|
|
4945
|
-
return
|
|
5042
|
+
return _context58.stop();
|
|
4946
5043
|
}
|
|
4947
|
-
},
|
|
5044
|
+
}, _callee58, this);
|
|
4948
5045
|
}));
|
|
4949
|
-
return function (
|
|
4950
|
-
return
|
|
5046
|
+
return function (_x54) {
|
|
5047
|
+
return _ref109.apply(this, arguments);
|
|
4951
5048
|
};
|
|
4952
5049
|
}();
|
|
4953
5050
|
|
|
@@ -4968,13 +5065,13 @@ exports.Collection = /*#__PURE__*/function () {
|
|
|
4968
5065
|
* @returns {Promise<Object>} - Response describing audit results
|
|
4969
5066
|
*/
|
|
4970
5067
|
exports.AuditContentObject = /*#__PURE__*/function () {
|
|
4971
|
-
var
|
|
5068
|
+
var _ref111 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(_ref110) {
|
|
4972
5069
|
var libraryId, objectId, versionHash, salt, samples, authorizationToken;
|
|
4973
|
-
return _regeneratorRuntime.wrap(function
|
|
4974
|
-
while (1) switch (
|
|
5070
|
+
return _regeneratorRuntime.wrap(function _callee59$(_context59) {
|
|
5071
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
4975
5072
|
case 0:
|
|
4976
|
-
libraryId =
|
|
4977
|
-
|
|
5073
|
+
libraryId = _ref110.libraryId, objectId = _ref110.objectId, versionHash = _ref110.versionHash, salt = _ref110.salt, samples = _ref110.samples, authorizationToken = _ref110.authorizationToken;
|
|
5074
|
+
_context59.next = 3;
|
|
4978
5075
|
return ContentObjectAudit.AuditContentObject({
|
|
4979
5076
|
client: this,
|
|
4980
5077
|
libraryId: libraryId,
|
|
@@ -4985,15 +5082,15 @@ exports.AuditContentObject = /*#__PURE__*/function () {
|
|
|
4985
5082
|
authorizationToken: authorizationToken
|
|
4986
5083
|
});
|
|
4987
5084
|
case 3:
|
|
4988
|
-
return
|
|
5085
|
+
return _context59.abrupt("return", _context59.sent);
|
|
4989
5086
|
case 4:
|
|
4990
5087
|
case "end":
|
|
4991
|
-
return
|
|
5088
|
+
return _context59.stop();
|
|
4992
5089
|
}
|
|
4993
|
-
},
|
|
5090
|
+
}, _callee59, this);
|
|
4994
5091
|
}));
|
|
4995
|
-
return function (
|
|
4996
|
-
return
|
|
5092
|
+
return function (_x55) {
|
|
5093
|
+
return _ref111.apply(this, arguments);
|
|
4997
5094
|
};
|
|
4998
5095
|
}();
|
|
4999
5096
|
|
|
@@ -5010,12 +5107,12 @@ exports.AuditContentObject = /*#__PURE__*/function () {
|
|
|
5010
5107
|
* @returns {Promise<Object>} - Response containing proof information
|
|
5011
5108
|
*/
|
|
5012
5109
|
exports.Proofs = /*#__PURE__*/function () {
|
|
5013
|
-
var
|
|
5110
|
+
var _ref113 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(_ref112) {
|
|
5014
5111
|
var libraryId, objectId, versionHash, partHash, path;
|
|
5015
|
-
return _regeneratorRuntime.wrap(function
|
|
5016
|
-
while (1) switch (
|
|
5112
|
+
return _regeneratorRuntime.wrap(function _callee60$(_context60) {
|
|
5113
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5017
5114
|
case 0:
|
|
5018
|
-
libraryId =
|
|
5115
|
+
libraryId = _ref112.libraryId, objectId = _ref112.objectId, versionHash = _ref112.versionHash, partHash = _ref112.partHash;
|
|
5019
5116
|
ValidateParameters({
|
|
5020
5117
|
libraryId: libraryId,
|
|
5021
5118
|
objectId: objectId,
|
|
@@ -5026,32 +5123,32 @@ exports.Proofs = /*#__PURE__*/function () {
|
|
|
5026
5123
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
5027
5124
|
}
|
|
5028
5125
|
path = UrlJoin("q", versionHash || objectId, "data", partHash, "proofs");
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5126
|
+
_context60.t0 = this.utils;
|
|
5127
|
+
_context60.t1 = this.HttpClient;
|
|
5128
|
+
_context60.next = 9;
|
|
5032
5129
|
return this.authClient.AuthorizationHeader({
|
|
5033
5130
|
libraryId: libraryId,
|
|
5034
5131
|
objectId: objectId,
|
|
5035
5132
|
versionHash: versionHash
|
|
5036
5133
|
});
|
|
5037
5134
|
case 9:
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
headers:
|
|
5135
|
+
_context60.t2 = _context60.sent;
|
|
5136
|
+
_context60.t3 = path;
|
|
5137
|
+
_context60.t4 = {
|
|
5138
|
+
headers: _context60.t2,
|
|
5042
5139
|
method: "GET",
|
|
5043
|
-
path:
|
|
5140
|
+
path: _context60.t3
|
|
5044
5141
|
};
|
|
5045
|
-
|
|
5046
|
-
return
|
|
5142
|
+
_context60.t5 = _context60.t1.Request.call(_context60.t1, _context60.t4);
|
|
5143
|
+
return _context60.abrupt("return", _context60.t0.ResponseToJson.call(_context60.t0, _context60.t5));
|
|
5047
5144
|
case 14:
|
|
5048
5145
|
case "end":
|
|
5049
|
-
return
|
|
5146
|
+
return _context60.stop();
|
|
5050
5147
|
}
|
|
5051
|
-
},
|
|
5148
|
+
}, _callee60, this);
|
|
5052
5149
|
}));
|
|
5053
|
-
return function (
|
|
5054
|
-
return
|
|
5150
|
+
return function (_x56) {
|
|
5151
|
+
return _ref113.apply(this, arguments);
|
|
5055
5152
|
};
|
|
5056
5153
|
}();
|
|
5057
5154
|
|
|
@@ -5068,12 +5165,12 @@ exports.Proofs = /*#__PURE__*/function () {
|
|
|
5068
5165
|
* @returns {Promise<Format>} - Response containing the CBOR response in the specified format
|
|
5069
5166
|
*/
|
|
5070
5167
|
exports.QParts = /*#__PURE__*/function () {
|
|
5071
|
-
var
|
|
5072
|
-
var libraryId, objectId, partHash,
|
|
5073
|
-
return _regeneratorRuntime.wrap(function
|
|
5074
|
-
while (1) switch (
|
|
5168
|
+
var _ref115 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(_ref114) {
|
|
5169
|
+
var libraryId, objectId, partHash, _ref114$format, format, path;
|
|
5170
|
+
return _regeneratorRuntime.wrap(function _callee61$(_context61) {
|
|
5171
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5075
5172
|
case 0:
|
|
5076
|
-
libraryId =
|
|
5173
|
+
libraryId = _ref114.libraryId, objectId = _ref114.objectId, partHash = _ref114.partHash, _ref114$format = _ref114.format, format = _ref114$format === void 0 ? "blob" : _ref114$format;
|
|
5077
5174
|
ValidateParameters({
|
|
5078
5175
|
libraryId: libraryId,
|
|
5079
5176
|
objectId: objectId,
|
|
@@ -5081,32 +5178,313 @@ exports.QParts = /*#__PURE__*/function () {
|
|
|
5081
5178
|
});
|
|
5082
5179
|
ValidatePartHash(partHash);
|
|
5083
5180
|
path = UrlJoin("qparts", partHash);
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5181
|
+
_context61.t0 = this.utils;
|
|
5182
|
+
_context61.t1 = format;
|
|
5183
|
+
_context61.t2 = this.HttpClient;
|
|
5184
|
+
_context61.next = 9;
|
|
5088
5185
|
return this.authClient.AuthorizationHeader({
|
|
5089
5186
|
libraryId: libraryId,
|
|
5090
5187
|
objectId: objectId,
|
|
5091
5188
|
partHash: partHash
|
|
5092
5189
|
});
|
|
5093
5190
|
case 9:
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
headers:
|
|
5191
|
+
_context61.t3 = _context61.sent;
|
|
5192
|
+
_context61.t4 = path;
|
|
5193
|
+
_context61.t5 = {
|
|
5194
|
+
headers: _context61.t3,
|
|
5098
5195
|
method: "GET",
|
|
5099
|
-
path:
|
|
5196
|
+
path: _context61.t4
|
|
5100
5197
|
};
|
|
5101
|
-
|
|
5102
|
-
return
|
|
5198
|
+
_context61.t6 = _context61.t2.Request.call(_context61.t2, _context61.t5);
|
|
5199
|
+
return _context61.abrupt("return", _context61.t0.ResponseToFormat.call(_context61.t0, _context61.t1, _context61.t6));
|
|
5103
5200
|
case 14:
|
|
5104
5201
|
case "end":
|
|
5105
|
-
return
|
|
5202
|
+
return _context61.stop();
|
|
5106
5203
|
}
|
|
5107
|
-
},
|
|
5204
|
+
}, _callee61, this);
|
|
5108
5205
|
}));
|
|
5109
|
-
return function (
|
|
5110
|
-
return
|
|
5206
|
+
return function (_x57) {
|
|
5207
|
+
return _ref115.apply(this, arguments);
|
|
5208
|
+
};
|
|
5209
|
+
}();
|
|
5210
|
+
|
|
5211
|
+
/* Content groups */
|
|
5212
|
+
|
|
5213
|
+
/**
|
|
5214
|
+
* Retrieve a content object property ("tags", "groups" or "query_fields").
|
|
5215
|
+
*
|
|
5216
|
+
* @private
|
|
5217
|
+
*/
|
|
5218
|
+
var ContentObjectProperty = /*#__PURE__*/function () {
|
|
5219
|
+
var _ref117 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(_ref116) {
|
|
5220
|
+
var objectId, versionHash, writeToken, property, token;
|
|
5221
|
+
return _regeneratorRuntime.wrap(function _callee62$(_context62) {
|
|
5222
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5223
|
+
case 0:
|
|
5224
|
+
objectId = _ref116.objectId, versionHash = _ref116.versionHash, writeToken = _ref116.writeToken, property = _ref116.property;
|
|
5225
|
+
if (!(writeToken && versionHash)) {
|
|
5226
|
+
_context62.next = 3;
|
|
5227
|
+
break;
|
|
5228
|
+
}
|
|
5229
|
+
throw Error("Cannot specify writeToken and versionHash at same time (token:".concat(writeToken, ", hash:").concat(versionHash, ")"));
|
|
5230
|
+
case 3:
|
|
5231
|
+
if (writeToken) {
|
|
5232
|
+
ValidateWriteToken(writeToken);
|
|
5233
|
+
} else if (versionHash) {
|
|
5234
|
+
ValidateVersion(versionHash);
|
|
5235
|
+
} else {
|
|
5236
|
+
ValidateObject(objectId);
|
|
5237
|
+
}
|
|
5238
|
+
if (writeToken) {
|
|
5239
|
+
objectId = this.utils.DecodeWriteToken(writeToken).objectId;
|
|
5240
|
+
} else if (versionHash) {
|
|
5241
|
+
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
5242
|
+
}
|
|
5243
|
+
_context62.next = 7;
|
|
5244
|
+
return this.GenerateStateChannelToken({
|
|
5245
|
+
objectId: objectId,
|
|
5246
|
+
versionHash: versionHash
|
|
5247
|
+
});
|
|
5248
|
+
case 7:
|
|
5249
|
+
token = _context62.sent;
|
|
5250
|
+
return _context62.abrupt("return", this.HttpClient.RequestJsonBody({
|
|
5251
|
+
headers: {
|
|
5252
|
+
Authorization: "Bearer ".concat(token)
|
|
5253
|
+
},
|
|
5254
|
+
method: "GET",
|
|
5255
|
+
path: UrlJoin("q", writeToken || versionHash || objectId, property)
|
|
5256
|
+
}));
|
|
5257
|
+
case 9:
|
|
5258
|
+
case "end":
|
|
5259
|
+
return _context62.stop();
|
|
5260
|
+
}
|
|
5261
|
+
}, _callee62, this);
|
|
5262
|
+
}));
|
|
5263
|
+
return function ContentObjectProperty(_x58) {
|
|
5264
|
+
return _ref117.apply(this, arguments);
|
|
5265
|
+
};
|
|
5266
|
+
}();
|
|
5267
|
+
|
|
5268
|
+
/**
|
|
5269
|
+
* Get content tags
|
|
5270
|
+
*
|
|
5271
|
+
* @methodGroup Content Groups
|
|
5272
|
+
* @namedParams
|
|
5273
|
+
* @param {string=} objectId - ID of the object
|
|
5274
|
+
* @param {string=} versionHash - Hash of the object version
|
|
5275
|
+
* @param {string=} writeToken - Write token of the draft
|
|
5276
|
+
*
|
|
5277
|
+
* @returns {Promise<Array<string>>} - The content object tags
|
|
5278
|
+
*/
|
|
5279
|
+
exports.ContentObjectTags = /*#__PURE__*/function () {
|
|
5280
|
+
var _ref119 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(_ref118) {
|
|
5281
|
+
var objectId, versionHash, writeToken;
|
|
5282
|
+
return _regeneratorRuntime.wrap(function _callee63$(_context63) {
|
|
5283
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
5284
|
+
case 0:
|
|
5285
|
+
objectId = _ref118.objectId, versionHash = _ref118.versionHash, writeToken = _ref118.writeToken;
|
|
5286
|
+
this.Log("Retrieving content tags: ".concat(writeToken || versionHash || objectId));
|
|
5287
|
+
return _context63.abrupt("return", ContentObjectProperty.call(this, {
|
|
5288
|
+
objectId: objectId,
|
|
5289
|
+
versionHash: versionHash,
|
|
5290
|
+
writeToken: writeToken,
|
|
5291
|
+
property: "tags"
|
|
5292
|
+
}));
|
|
5293
|
+
case 3:
|
|
5294
|
+
case "end":
|
|
5295
|
+
return _context63.stop();
|
|
5296
|
+
}
|
|
5297
|
+
}, _callee63, this);
|
|
5298
|
+
}));
|
|
5299
|
+
return function (_x59) {
|
|
5300
|
+
return _ref119.apply(this, arguments);
|
|
5301
|
+
};
|
|
5302
|
+
}();
|
|
5303
|
+
|
|
5304
|
+
/**
|
|
5305
|
+
* Get content query fields
|
|
5306
|
+
*
|
|
5307
|
+
* @methodGroup Content Groups
|
|
5308
|
+
* @namedParams
|
|
5309
|
+
* @param {string=} objectId - ID of the object
|
|
5310
|
+
* @param {string=} versionHash - Hash of the object version
|
|
5311
|
+
* @param {string=} writeToken - Write token of the draft
|
|
5312
|
+
*
|
|
5313
|
+
* @returns {Promise<Object<string, string>>} - The content object query fields
|
|
5314
|
+
*/
|
|
5315
|
+
exports.ContentObjectQueryFields = /*#__PURE__*/function () {
|
|
5316
|
+
var _ref121 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(_ref120) {
|
|
5317
|
+
var objectId, versionHash, writeToken;
|
|
5318
|
+
return _regeneratorRuntime.wrap(function _callee64$(_context64) {
|
|
5319
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
5320
|
+
case 0:
|
|
5321
|
+
objectId = _ref120.objectId, versionHash = _ref120.versionHash, writeToken = _ref120.writeToken;
|
|
5322
|
+
this.Log("Retrieving content query fields: ".concat(writeToken || versionHash || objectId));
|
|
5323
|
+
return _context64.abrupt("return", ContentObjectProperty.call(this, {
|
|
5324
|
+
objectId: objectId,
|
|
5325
|
+
versionHash: versionHash,
|
|
5326
|
+
writeToken: writeToken,
|
|
5327
|
+
property: "query_fields"
|
|
5328
|
+
}));
|
|
5329
|
+
case 3:
|
|
5330
|
+
case "end":
|
|
5331
|
+
return _context64.stop();
|
|
5332
|
+
}
|
|
5333
|
+
}, _callee64, this);
|
|
5334
|
+
}));
|
|
5335
|
+
return function (_x60) {
|
|
5336
|
+
return _ref121.apply(this, arguments);
|
|
5337
|
+
};
|
|
5338
|
+
}();
|
|
5339
|
+
|
|
5340
|
+
/**
|
|
5341
|
+
* Get the groups a content object belongs to
|
|
5342
|
+
*
|
|
5343
|
+
* @methodGroup Content Groups
|
|
5344
|
+
* @namedParams
|
|
5345
|
+
* @param {string=} objectId - ID of the object
|
|
5346
|
+
* @param {string=} versionHash - Hash of the object version
|
|
5347
|
+
* @param {string=} writeToken - Write token of the draft
|
|
5348
|
+
*
|
|
5349
|
+
* @returns {Promise<Array<string>>} - The content groups the object belongs to
|
|
5350
|
+
*/
|
|
5351
|
+
exports.ContentObjectGroups = /*#__PURE__*/function () {
|
|
5352
|
+
var _ref123 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(_ref122) {
|
|
5353
|
+
var objectId, versionHash, writeToken;
|
|
5354
|
+
return _regeneratorRuntime.wrap(function _callee65$(_context65) {
|
|
5355
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
5356
|
+
case 0:
|
|
5357
|
+
objectId = _ref122.objectId, versionHash = _ref122.versionHash, writeToken = _ref122.writeToken;
|
|
5358
|
+
this.Log("Retrieving content object groups: ".concat(writeToken || versionHash || objectId));
|
|
5359
|
+
return _context65.abrupt("return", ContentObjectProperty.call(this, {
|
|
5360
|
+
objectId: objectId,
|
|
5361
|
+
versionHash: versionHash,
|
|
5362
|
+
writeToken: writeToken,
|
|
5363
|
+
property: "groups"
|
|
5364
|
+
}));
|
|
5365
|
+
case 3:
|
|
5366
|
+
case "end":
|
|
5367
|
+
return _context65.stop();
|
|
5368
|
+
}
|
|
5369
|
+
}, _callee65, this);
|
|
5370
|
+
}));
|
|
5371
|
+
return function (_x61) {
|
|
5372
|
+
return _ref123.apply(this, arguments);
|
|
5373
|
+
};
|
|
5374
|
+
}();
|
|
5375
|
+
|
|
5376
|
+
/**
|
|
5377
|
+
* Query tenant content.
|
|
5378
|
+
*
|
|
5379
|
+
* The response is based on the fabric index and can use groups, query_fields and tags for filtering and sorting.
|
|
5380
|
+
* The response may include metadata fields as specified in select/remove.
|
|
5381
|
+
*
|
|
5382
|
+
* @methodGroup Tenants
|
|
5383
|
+
* @namedParams
|
|
5384
|
+
* @param {string=} tenantId - ID of the tenant to query. Defaults to the tenant of the current user
|
|
5385
|
+
* @param {Array<string>=} filter - Filter expressions of the form `<field>:<comparator>:<value>`, e.g.
|
|
5386
|
+
* `tag:eq:elv:media:live_stream` or `qf.date:ge:2026-09-01`. Multiple expressions are combined with AND.
|
|
5387
|
+
*
|
|
5388
|
+
* Comparators: `::` or `:co:` contains, `:nc:` not contains, `:eq:` equals, `:ne:` not equals,
|
|
5389
|
+
* `:lt:` less than, `:le:` less than or equal, `:gt:` greater than, `:ge:` greater than or equal.
|
|
5390
|
+
* Comparisons are lexicographic string comparisons. `:sw:` and `:ew:` are not supported here.
|
|
5391
|
+
*
|
|
5392
|
+
* Reserved fields:
|
|
5393
|
+
* - `tag` - matches when *any one* of the object's tags satisfies the expression
|
|
5394
|
+
* - `group` - ID of a content group the object belongs to
|
|
5395
|
+
* - `unique_group.id`, `unique_group.type`
|
|
5396
|
+
* - `lib`, `library` - library ID. Supports `:eq:` only
|
|
5397
|
+
* - `created_block_time` - when the latest version was created. Comparison operators only
|
|
5398
|
+
*
|
|
5399
|
+
* Any other field name is treated as a query field name. Prefix with `qf.` to filter on a query field
|
|
5400
|
+
* whose name collides with a reserved one, e.g. `qf.tag:eq:x`. `created_block_number` is no longer
|
|
5401
|
+
* supported and is rejected.
|
|
5402
|
+
*
|
|
5403
|
+
* @param {string=} sortBy - Name of a query field to sort by. This is a query field name, not a metadata path,
|
|
5404
|
+
* and only one may be given. When omitted, results are sorted by the time the latest version was created.
|
|
5405
|
+
*
|
|
5406
|
+
* Note that sorting by a query field also restricts the results to objects that have that field
|
|
5407
|
+
* @param {boolean=} sortDescending=false - Sort in descending order
|
|
5408
|
+
* @param {(Array<string> | string)=} include - Index data to return alongside each result. Tokens:
|
|
5409
|
+
* `tags`, `groups`, `uniquegroups`, `fields` (query fields), `type`, `name`, `all`, `none`. May be given
|
|
5410
|
+
* as an array or as a comma-separated string. The Fabric defaults to query fields only; `none` suppresses
|
|
5411
|
+
* all index data, including those
|
|
5412
|
+
* @param {Array<string>=} select - Metadata subtree paths to include in each result. If omitted, no metadata
|
|
5413
|
+
* is retrieved at all and each result contains only its IDs and index data
|
|
5414
|
+
* @param {Array<string>=} remove - Metadata subtree paths to omit from each result. Only has an effect when
|
|
5415
|
+
* `select` is also specified
|
|
5416
|
+
* @param {number=} start - Index of the first object to retrieve. Defaults to the first
|
|
5417
|
+
* @param {number=} limit - Maximum number of objects to return. Defaults to 100, capped at 998
|
|
5418
|
+
* @param {string=} authorizationToken - Additional authorization token for the request
|
|
5419
|
+
*
|
|
5420
|
+
* @returns {Promise<Object>} - The query result, including `versions` and `paging` information. One entry per
|
|
5421
|
+
* content object - the index holds only the latest version - carrying `id`, `hash`, `qlib_id`,
|
|
5422
|
+
* `last_modified_at` and whatever `include` selects - by default the object's query fields
|
|
5423
|
+
*/
|
|
5424
|
+
exports.TenantContent = /*#__PURE__*/function () {
|
|
5425
|
+
var _ref125 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(_ref124) {
|
|
5426
|
+
var tenantId, _ref124$filter, filter, sortBy, sortDescending, include, _ref124$select, select, _ref124$remove, remove, start, limit, authorizationToken, path, token, httpClient, queryParams;
|
|
5427
|
+
return _regeneratorRuntime.wrap(function _callee66$(_context66) {
|
|
5428
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
5429
|
+
case 0:
|
|
5430
|
+
tenantId = _ref124.tenantId, _ref124$filter = _ref124.filter, filter = _ref124$filter === void 0 ? [] : _ref124$filter, sortBy = _ref124.sortBy, sortDescending = _ref124.sortDescending, include = _ref124.include, _ref124$select = _ref124.select, select = _ref124$select === void 0 ? [] : _ref124$select, _ref124$remove = _ref124.remove, remove = _ref124$remove === void 0 ? [] : _ref124$remove, start = _ref124.start, limit = _ref124.limit, authorizationToken = _ref124.authorizationToken;
|
|
5431
|
+
_context66.t0 = tenantId;
|
|
5432
|
+
if (_context66.t0) {
|
|
5433
|
+
_context66.next = 6;
|
|
5434
|
+
break;
|
|
5435
|
+
}
|
|
5436
|
+
_context66.next = 5;
|
|
5437
|
+
return this.userProfileClient.TenantContractId();
|
|
5438
|
+
case 5:
|
|
5439
|
+
_context66.t0 = _context66.sent;
|
|
5440
|
+
case 6:
|
|
5441
|
+
tenantId = _context66.t0;
|
|
5442
|
+
ValidatePresence("tenantId", tenantId);
|
|
5443
|
+
this.Log("Querying content for tenant ".concat(tenantId));
|
|
5444
|
+
path = UrlJoin("tenants", tenantId, "q", "query"); // Tenant query works best with plain token - it allows it to return objecte metadata fields.
|
|
5445
|
+
_context66.t1 = authorizationToken;
|
|
5446
|
+
if (_context66.t1) {
|
|
5447
|
+
_context66.next = 15;
|
|
5448
|
+
break;
|
|
5449
|
+
}
|
|
5450
|
+
_context66.next = 14;
|
|
5451
|
+
return this.CreatePlainToken();
|
|
5452
|
+
case 14:
|
|
5453
|
+
_context66.t1 = _context66.sent;
|
|
5454
|
+
case 15:
|
|
5455
|
+
token = _context66.t1;
|
|
5456
|
+
httpClient = this.TenantQueryHttpClient && this.TenantQueryHttpClient.uris && this.TenantQueryHttpClient.uris.length > 0 ? this.TenantQueryHttpClient : this.HttpClient;
|
|
5457
|
+
queryParams = {
|
|
5458
|
+
filter: filter,
|
|
5459
|
+
sort_by: sortBy,
|
|
5460
|
+
sort_descending: sortDescending,
|
|
5461
|
+
include: include,
|
|
5462
|
+
select: select,
|
|
5463
|
+
remove: remove,
|
|
5464
|
+
start: start,
|
|
5465
|
+
limit: limit
|
|
5466
|
+
};
|
|
5467
|
+
Object.keys(queryParams).forEach(function (key) {
|
|
5468
|
+
var value = queryParams[key];
|
|
5469
|
+
if (value === undefined || Array.isArray(value) && value.length === 0) {
|
|
5470
|
+
delete queryParams[key];
|
|
5471
|
+
}
|
|
5472
|
+
});
|
|
5473
|
+
return _context66.abrupt("return", this.utils.ResponseToJson(httpClient.Request({
|
|
5474
|
+
headers: {
|
|
5475
|
+
"Authorization": "Bearer ".concat(token)
|
|
5476
|
+
},
|
|
5477
|
+
method: "GET",
|
|
5478
|
+
path: path,
|
|
5479
|
+
queryParams: queryParams
|
|
5480
|
+
})));
|
|
5481
|
+
case 20:
|
|
5482
|
+
case "end":
|
|
5483
|
+
return _context66.stop();
|
|
5484
|
+
}
|
|
5485
|
+
}, _callee66, this);
|
|
5486
|
+
}));
|
|
5487
|
+
return function (_x62) {
|
|
5488
|
+
return _ref125.apply(this, arguments);
|
|
5111
5489
|
};
|
|
5112
5490
|
}();
|