@eluvio/elv-client-js 4.0.147 → 4.2.0
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 -67
- package/dist/ElvClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvClient-node-min.js +2 -66
- package/dist/ElvClient-node-min.js.LICENSE.txt +72 -0
- package/dist/ElvFrameClient-min.js +2 -60
- package/dist/ElvFrameClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvPermissionsClient-min.js +2 -60
- package/dist/ElvPermissionsClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvWalletClient-min.js +2 -67
- package/dist/ElvWalletClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvWalletClient-node-min.js +2 -66
- package/dist/ElvWalletClient-node-min.js.LICENSE.txt +72 -0
- package/dist/src/AuthorizationClient.js +713 -715
- package/dist/src/ContentObjectAudit.js +59 -59
- package/dist/src/Crypto.js +85 -86
- package/dist/src/ElvClient.js +532 -501
- package/dist/src/ElvWallet.js +30 -28
- package/dist/src/EthClient.js +316 -316
- package/dist/src/FrameClient.js +70 -71
- package/dist/src/HttpClient.js +60 -60
- package/dist/src/Id.js +1 -2
- package/dist/src/PermissionsClient.js +501 -489
- package/dist/src/RemoteSigner.js +83 -84
- package/dist/src/UserProfileClient.js +392 -374
- package/dist/src/Utils.js +67 -67
- package/dist/src/Validation.js +20 -12
- package/dist/src/client/ABRPublishing.js +412 -356
- package/dist/src/client/AccessGroups.js +479 -476
- package/dist/src/client/ContentAccess.js +1750 -1804
- package/dist/src/client/ContentManagement.js +874 -874
- package/dist/src/client/Contracts.js +586 -590
- package/dist/src/client/Files.js +702 -686
- package/dist/src/client/LiveConf.js +3 -5
- package/dist/src/client/LiveStream.js +659 -652
- package/dist/src/client/NFT.js +16 -16
- package/dist/src/client/NTP.js +84 -84
- package/dist/src/client/Shares.js +51 -51
- package/dist/src/walletClient/ClientMethods.js +979 -953
- package/dist/src/walletClient/Notifications.js +14 -14
- package/dist/src/walletClient/Profile.js +68 -68
- package/dist/src/walletClient/Utils.js +17 -17
- package/dist/src/walletClient/index.js +574 -564
- package/package.json +17 -16
- package/src/client/AccessGroups.js +1 -1
- package/testScripts/Test.js +5 -1
- package/webpack.config.js +10 -13
- package/dist/src/ContentObjectVerification.js +0 -281
package/dist/src/Utils.js
CHANGED
|
@@ -3,8 +3,8 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
|
3
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
4
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
5
5
|
var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
|
|
6
|
-
function ownKeys(
|
|
7
|
-
function _objectSpread(
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
if (typeof globalThis.Buffer === "undefined") {
|
|
9
9
|
globalThis.Buffer = require("buffer/").Buffer;
|
|
10
10
|
}
|
|
@@ -281,7 +281,6 @@ var Utils = {
|
|
|
281
281
|
flags: flags // flags for part write token (tqp_)
|
|
282
282
|
};
|
|
283
283
|
},
|
|
284
|
-
|
|
285
284
|
/**
|
|
286
285
|
* Convert contract address to multiformat hash
|
|
287
286
|
*
|
|
@@ -470,37 +469,37 @@ var Utils = {
|
|
|
470
469
|
});
|
|
471
470
|
},
|
|
472
471
|
LimitedMap: function () {
|
|
473
|
-
var _LimitedMap = _asyncToGenerator(
|
|
472
|
+
var _LimitedMap = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(limit, array, f) {
|
|
474
473
|
var index, locked, nextIndex, results, active;
|
|
475
|
-
return _regeneratorRuntime.wrap(function
|
|
474
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
476
475
|
while (1) switch (_context3.prev = _context3.next) {
|
|
477
476
|
case 0:
|
|
478
477
|
index = 0;
|
|
479
478
|
locked = false;
|
|
480
479
|
nextIndex = /*#__PURE__*/function () {
|
|
481
|
-
var _ref = _asyncToGenerator(
|
|
480
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
482
481
|
var thisIndex;
|
|
483
|
-
return _regeneratorRuntime.wrap(function
|
|
482
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
484
483
|
while (1) switch (_context.prev = _context.next) {
|
|
485
484
|
case 0:
|
|
486
485
|
if (!locked) {
|
|
487
|
-
_context.next =
|
|
486
|
+
_context.next = 2;
|
|
488
487
|
break;
|
|
489
488
|
}
|
|
490
|
-
_context.next =
|
|
489
|
+
_context.next = 1;
|
|
491
490
|
return new Promise(function (resolve) {
|
|
492
491
|
return setTimeout(resolve, 10);
|
|
493
492
|
});
|
|
494
|
-
case
|
|
493
|
+
case 1:
|
|
495
494
|
_context.next = 0;
|
|
496
495
|
break;
|
|
497
|
-
case
|
|
496
|
+
case 2:
|
|
498
497
|
locked = true;
|
|
499
498
|
thisIndex = index;
|
|
500
499
|
index += 1;
|
|
501
500
|
locked = false;
|
|
502
501
|
return _context.abrupt("return", thisIndex);
|
|
503
|
-
case
|
|
502
|
+
case 3:
|
|
504
503
|
case "end":
|
|
505
504
|
return _context.stop();
|
|
506
505
|
}
|
|
@@ -513,53 +512,53 @@ var Utils = {
|
|
|
513
512
|
results = [];
|
|
514
513
|
active = 0;
|
|
515
514
|
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
516
|
-
_toConsumableArray(Array(limit || 1)).forEach(
|
|
517
|
-
var index;
|
|
518
|
-
return _regeneratorRuntime.wrap(function
|
|
515
|
+
_toConsumableArray(Array(limit || 1)).forEach(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
516
|
+
var index, _t;
|
|
517
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
519
518
|
while (1) switch (_context2.prev = _context2.next) {
|
|
520
519
|
case 0:
|
|
521
520
|
active += 1;
|
|
522
|
-
_context2.next =
|
|
521
|
+
_context2.next = 1;
|
|
523
522
|
return nextIndex();
|
|
524
|
-
case
|
|
523
|
+
case 1:
|
|
525
524
|
index = _context2.sent;
|
|
526
|
-
case
|
|
525
|
+
case 2:
|
|
527
526
|
if (!(index < array.length)) {
|
|
528
|
-
_context2.next =
|
|
527
|
+
_context2.next = 8;
|
|
529
528
|
break;
|
|
530
529
|
}
|
|
531
|
-
_context2.prev =
|
|
532
|
-
_context2.next =
|
|
530
|
+
_context2.prev = 3;
|
|
531
|
+
_context2.next = 4;
|
|
533
532
|
return f(array[index], index);
|
|
534
|
-
case
|
|
533
|
+
case 4:
|
|
535
534
|
results[index] = _context2.sent;
|
|
536
|
-
_context2.next =
|
|
535
|
+
_context2.next = 6;
|
|
537
536
|
break;
|
|
538
|
-
case
|
|
539
|
-
_context2.prev =
|
|
540
|
-
|
|
541
|
-
reject(
|
|
542
|
-
case
|
|
543
|
-
_context2.next =
|
|
537
|
+
case 5:
|
|
538
|
+
_context2.prev = 5;
|
|
539
|
+
_t = _context2["catch"](3);
|
|
540
|
+
reject(_t);
|
|
541
|
+
case 6:
|
|
542
|
+
_context2.next = 7;
|
|
544
543
|
return nextIndex();
|
|
545
|
-
case
|
|
544
|
+
case 7:
|
|
546
545
|
index = _context2.sent;
|
|
547
|
-
_context2.next =
|
|
546
|
+
_context2.next = 2;
|
|
548
547
|
break;
|
|
549
|
-
case
|
|
548
|
+
case 8:
|
|
550
549
|
// When finished and no more workers are active, resolve
|
|
551
550
|
active -= 1;
|
|
552
551
|
if (active === 0) {
|
|
553
552
|
resolve(results);
|
|
554
553
|
}
|
|
555
|
-
case
|
|
554
|
+
case 9:
|
|
556
555
|
case "end":
|
|
557
556
|
return _context2.stop();
|
|
558
557
|
}
|
|
559
|
-
}, _callee2, null, [[
|
|
558
|
+
}, _callee2, null, [[3, 5]]);
|
|
560
559
|
})));
|
|
561
560
|
}));
|
|
562
|
-
case
|
|
561
|
+
case 1:
|
|
563
562
|
case "end":
|
|
564
563
|
return _context3.stop();
|
|
565
564
|
}
|
|
@@ -579,20 +578,20 @@ var Utils = {
|
|
|
579
578
|
* @return {*} - Result of parsing response body as JSON
|
|
580
579
|
*/
|
|
581
580
|
ResponseToJson: function () {
|
|
582
|
-
var _ResponseToJson = _asyncToGenerator(
|
|
581
|
+
var _ResponseToJson = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(response) {
|
|
583
582
|
var debug,
|
|
584
583
|
logFn,
|
|
585
584
|
_args4 = arguments;
|
|
586
|
-
return _regeneratorRuntime.wrap(function
|
|
585
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
587
586
|
while (1) switch (_context4.prev = _context4.next) {
|
|
588
587
|
case 0:
|
|
589
588
|
debug = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : false;
|
|
590
589
|
logFn = _args4.length > 2 ? _args4[2] : undefined;
|
|
591
|
-
_context4.next =
|
|
590
|
+
_context4.next = 1;
|
|
592
591
|
return Utils.ResponseToFormat("json", response, debug, logFn);
|
|
593
|
-
case
|
|
592
|
+
case 1:
|
|
594
593
|
return _context4.abrupt("return", _context4.sent);
|
|
595
|
-
case
|
|
594
|
+
case 2:
|
|
596
595
|
case "end":
|
|
597
596
|
return _context4.stop();
|
|
598
597
|
}
|
|
@@ -613,60 +612,61 @@ var Utils = {
|
|
|
613
612
|
* @return {*} - Result of converting response body into the requested format
|
|
614
613
|
*/
|
|
615
614
|
ResponseToFormat: function () {
|
|
616
|
-
var _ResponseToFormat = _asyncToGenerator(
|
|
615
|
+
var _ResponseToFormat = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(format, response) {
|
|
617
616
|
var debug,
|
|
618
617
|
logFn,
|
|
619
618
|
formattedBody,
|
|
620
|
-
_args5 = arguments
|
|
621
|
-
|
|
619
|
+
_args5 = arguments,
|
|
620
|
+
_t2;
|
|
621
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
622
622
|
while (1) switch (_context5.prev = _context5.next) {
|
|
623
623
|
case 0:
|
|
624
624
|
debug = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : false;
|
|
625
625
|
logFn = _args5.length > 3 ? _args5[3] : undefined;
|
|
626
|
-
_context5.next =
|
|
626
|
+
_context5.next = 1;
|
|
627
627
|
return response;
|
|
628
|
-
case
|
|
628
|
+
case 1:
|
|
629
629
|
response = _context5.sent;
|
|
630
|
-
|
|
631
|
-
_context5.next =
|
|
630
|
+
_t2 = format.toLowerCase();
|
|
631
|
+
_context5.next = _t2 === "json" ? 2 : _t2 === "text" ? 4 : _t2 === "blob" ? 6 : _t2 === "arraybuffer" ? 8 : _t2 === "formdata" ? 10 : _t2 === "buffer" ? 12 : 14;
|
|
632
632
|
break;
|
|
633
|
-
case
|
|
634
|
-
_context5.next =
|
|
633
|
+
case 2:
|
|
634
|
+
_context5.next = 3;
|
|
635
635
|
return response.json();
|
|
636
|
-
case
|
|
636
|
+
case 3:
|
|
637
637
|
formattedBody = _context5.sent;
|
|
638
638
|
if (debug) logFn("response body: ".concat(JSON.stringify(formattedBody, null, 2)));
|
|
639
639
|
return _context5.abrupt("return", formattedBody);
|
|
640
|
-
case
|
|
641
|
-
_context5.next =
|
|
640
|
+
case 4:
|
|
641
|
+
_context5.next = 5;
|
|
642
642
|
return response.text();
|
|
643
|
-
case
|
|
643
|
+
case 5:
|
|
644
644
|
formattedBody = _context5.sent;
|
|
645
645
|
if (debug) logFn("response body: ".concat(formattedBody));
|
|
646
646
|
return _context5.abrupt("return", formattedBody);
|
|
647
|
-
case
|
|
648
|
-
_context5.next =
|
|
647
|
+
case 6:
|
|
648
|
+
_context5.next = 7;
|
|
649
649
|
return response.blob();
|
|
650
|
-
case
|
|
650
|
+
case 7:
|
|
651
651
|
return _context5.abrupt("return", _context5.sent);
|
|
652
|
-
case
|
|
653
|
-
_context5.next =
|
|
652
|
+
case 8:
|
|
653
|
+
_context5.next = 9;
|
|
654
654
|
return response.arrayBuffer();
|
|
655
|
-
case
|
|
655
|
+
case 9:
|
|
656
656
|
return _context5.abrupt("return", _context5.sent);
|
|
657
|
-
case
|
|
658
|
-
_context5.next =
|
|
657
|
+
case 10:
|
|
658
|
+
_context5.next = 11;
|
|
659
659
|
return response.formData();
|
|
660
|
-
case
|
|
660
|
+
case 11:
|
|
661
661
|
return _context5.abrupt("return", _context5.sent);
|
|
662
|
-
case
|
|
663
|
-
_context5.next =
|
|
662
|
+
case 12:
|
|
663
|
+
_context5.next = 13;
|
|
664
664
|
return response.buffer();
|
|
665
|
-
case
|
|
665
|
+
case 13:
|
|
666
666
|
return _context5.abrupt("return", _context5.sent);
|
|
667
|
-
case
|
|
667
|
+
case 14:
|
|
668
668
|
return _context5.abrupt("return", response);
|
|
669
|
-
case
|
|
669
|
+
case 15:
|
|
670
670
|
case "end":
|
|
671
671
|
return _context5.stop();
|
|
672
672
|
}
|
package/dist/src/Validation.js
CHANGED
|
@@ -27,11 +27,19 @@ exports.ValidateVersion = function (versionHash) {
|
|
|
27
27
|
throw Error("Invalid version hash: ".concat(versionHash));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
+
|
|
31
|
+
// Validates that write token is in valid format and is properly encoded.
|
|
32
|
+
// If objectId is also supplied, then write token's encoded object id is checked to make sure it matches
|
|
33
|
+
// the supplied object id.
|
|
30
34
|
exports.ValidateWriteToken = function (writeToken) {
|
|
35
|
+
var objectId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
31
36
|
if (!writeToken) {
|
|
32
37
|
throw Error("Write token not specified");
|
|
33
|
-
} else
|
|
34
|
-
|
|
38
|
+
} else {
|
|
39
|
+
var decoded = Utils.DecodeWriteToken(writeToken);
|
|
40
|
+
if (objectId && objectId !== decoded.objectId) {
|
|
41
|
+
throw Error("Object id (".concat(objectId, ") does not match the the id (").concat(decoded.objectId, ") decoded from write token (").concat(writeToken, ")"));
|
|
42
|
+
}
|
|
35
43
|
}
|
|
36
44
|
};
|
|
37
45
|
exports.ValidatePartHash = function (partHash) {
|
|
@@ -80,36 +88,36 @@ exports.ValidateDate = function (date) {
|
|
|
80
88
|
return new Date(date).getTime();
|
|
81
89
|
};
|
|
82
90
|
exports.ValidateUserWallet = /*#__PURE__*/function () {
|
|
83
|
-
var _ref3 = _asyncToGenerator(
|
|
91
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
84
92
|
var address, client, walletAddress;
|
|
85
|
-
return _regeneratorRuntime.wrap(function
|
|
93
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
86
94
|
while (1) switch (_context.prev = _context.next) {
|
|
87
95
|
case 0:
|
|
88
96
|
address = _ref2.address, client = _ref2.client;
|
|
89
97
|
if (address) {
|
|
90
|
-
_context.next =
|
|
98
|
+
_context.next = 1;
|
|
91
99
|
break;
|
|
92
100
|
}
|
|
93
101
|
throw Error("Address not specified");
|
|
94
|
-
case
|
|
102
|
+
case 1:
|
|
95
103
|
if (client) {
|
|
96
|
-
_context.next =
|
|
104
|
+
_context.next = 2;
|
|
97
105
|
break;
|
|
98
106
|
}
|
|
99
107
|
throw Error("Client not specified");
|
|
100
|
-
case
|
|
101
|
-
_context.next =
|
|
108
|
+
case 2:
|
|
109
|
+
_context.next = 3;
|
|
102
110
|
return client.userProfileClient.UserWalletAddress({
|
|
103
111
|
address: address
|
|
104
112
|
});
|
|
105
|
-
case
|
|
113
|
+
case 3:
|
|
106
114
|
walletAddress = _context.sent;
|
|
107
115
|
if (walletAddress) {
|
|
108
|
-
_context.next =
|
|
116
|
+
_context.next = 4;
|
|
109
117
|
break;
|
|
110
118
|
}
|
|
111
119
|
throw Error("User address has no wallet: ".concat(address));
|
|
112
|
-
case
|
|
120
|
+
case 4:
|
|
113
121
|
case "end":
|
|
114
122
|
return _context.stop();
|
|
115
123
|
}
|