@eluvio/elv-client-js 4.0.89 → 4.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElvClient-min.js +15 -14
- package/dist/ElvClient-node-min.js +14 -13
- package/dist/ElvFrameClient-min.js +10 -10
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +15 -14
- package/dist/ElvWalletClient-node-min.js +14 -13
- package/dist/src/AuthorizationClient.js +9 -12
- package/dist/src/ContentObjectAudit.js +3 -3
- package/dist/src/ContentObjectVerification.js +3 -3
- package/dist/src/Crypto.js +2 -2
- package/dist/src/ElvClient.js +47 -28
- package/dist/src/ElvWallet.js +7 -5
- package/dist/src/EthClient.js +8 -9
- package/dist/src/FrameClient.js +8 -9
- package/dist/src/HttpClient.js +27 -4
- package/dist/src/Id.js +1 -2
- package/dist/src/PermissionsClient.js +31 -19
- package/dist/src/RemoteSigner.js +6 -8
- package/dist/src/UserProfileClient.js +35 -19
- package/dist/src/Utils.js +62 -28
- package/dist/src/client/ABRPublishing.js +2 -2
- package/dist/src/client/AccessGroups.js +2 -2
- package/dist/src/client/ContentAccess.js +104 -104
- package/dist/src/client/ContentManagement.js +25 -23
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/Files.js +77 -88
- package/dist/src/client/LiveConf.js +3 -7
- package/dist/src/client/LiveStream.js +35 -36
- package/dist/src/client/NFT.js +2 -2
- package/dist/src/walletClient/ClientMethods.js +2 -2
- package/dist/src/walletClient/Profile.js +2 -2
- package/dist/src/walletClient/Utils.js +2 -2
- package/dist/src/walletClient/index.js +17 -14
- package/package.json +1 -1
- package/src/HttpClient.js +16 -2
- package/src/Utils.js +27 -5
- package/src/client/ContentAccess.js +63 -80
- package/src/client/ContentManagement.js +25 -11
- package/src/client/Files.js +43 -51
- package/src/client/LiveStream.js +5 -1
package/dist/src/client/NFT.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
2
2
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
3
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
6
|
/**
|
|
7
7
|
* Methods for creating and managing NFTs
|
|
8
8
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
2
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
3
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
6
|
var Utils = require("../Utils");
|
|
7
7
|
var UrlJoin = require("url-join");
|
|
8
8
|
var _require = require("./Utils"),
|
|
@@ -2,8 +2,8 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
|
2
2
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
3
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
4
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
7
|
var Utils = require("../Utils");
|
|
8
8
|
var UrlJoin = require("url-join");
|
|
9
9
|
var StateStorePath = function StateStorePath(_ref) {
|
|
@@ -2,8 +2,8 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
|
2
2
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
3
3
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
4
4
|
var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
7
|
var Utils = require("../Utils");
|
|
8
8
|
var RarityToPercentage = function RarityToPercentage(rarity) {
|
|
9
9
|
if (!rarity) {
|
|
@@ -5,8 +5,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
6
6
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
7
7
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
10
|
var _require = require("../ElvClient"),
|
|
11
11
|
ElvClient = _require.ElvClient;
|
|
12
12
|
var Configuration = require("./Configuration");
|
|
@@ -77,7 +77,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
77
77
|
this.utils = client.utils;
|
|
78
78
|
this.ForbiddenMethods = ElvWalletClient.ForbiddenMethods;
|
|
79
79
|
}
|
|
80
|
-
_createClass(ElvWalletClient, [{
|
|
80
|
+
return _createClass(ElvWalletClient, [{
|
|
81
81
|
key: "Log",
|
|
82
82
|
value: function Log(message) {
|
|
83
83
|
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -134,7 +134,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
134
134
|
*/
|
|
135
135
|
}, {
|
|
136
136
|
key: "PersonalSign",
|
|
137
|
-
value: function () {
|
|
137
|
+
value: (function () {
|
|
138
138
|
var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
139
139
|
var message, parameters, url;
|
|
140
140
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
@@ -263,7 +263,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
263
263
|
return _PersonalSign.apply(this, arguments);
|
|
264
264
|
}
|
|
265
265
|
return PersonalSign;
|
|
266
|
-
}()
|
|
266
|
+
}())
|
|
267
267
|
}, {
|
|
268
268
|
key: "LogInURL",
|
|
269
269
|
value: function () {
|
|
@@ -342,7 +342,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
342
342
|
*/
|
|
343
343
|
}, {
|
|
344
344
|
key: "LogIn",
|
|
345
|
-
value: function () {
|
|
345
|
+
value: (function () {
|
|
346
346
|
var _LogIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref5) {
|
|
347
347
|
var _this = this;
|
|
348
348
|
var _ref5$method, method, provider, _ref5$mode, mode, callbackUrl, marketplaceParams, _ref5$clearLogin, clearLogin, callback, loginUrl;
|
|
@@ -461,9 +461,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
461
461
|
*
|
|
462
462
|
* @methodGroup Login
|
|
463
463
|
*/
|
|
464
|
+
)
|
|
464
465
|
}, {
|
|
465
466
|
key: "LogOut",
|
|
466
|
-
value: function () {
|
|
467
|
+
value: (function () {
|
|
467
468
|
var _LogOut = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
468
469
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
469
470
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -506,7 +507,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
506
507
|
return _LogOut.apply(this, arguments);
|
|
507
508
|
}
|
|
508
509
|
return LogOut;
|
|
509
|
-
}()
|
|
510
|
+
}())
|
|
510
511
|
}, {
|
|
511
512
|
key: "TokenStatus",
|
|
512
513
|
value: function () {
|
|
@@ -546,7 +547,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
546
547
|
*/
|
|
547
548
|
}, {
|
|
548
549
|
key: "Authenticate",
|
|
549
|
-
value: function () {
|
|
550
|
+
value: (function () {
|
|
550
551
|
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref7) {
|
|
551
552
|
var token, decodedToken;
|
|
552
553
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
@@ -612,9 +613,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
612
613
|
* - signingToken - Identical to `authToken`, but also includes the ability to perform arbitrary signatures with the custodial wallet. This token should be protected and should not be
|
|
613
614
|
* shared with third parties.
|
|
614
615
|
*/
|
|
616
|
+
)
|
|
615
617
|
}, {
|
|
616
618
|
key: "AuthenticateOAuth",
|
|
617
|
-
value: function () {
|
|
619
|
+
value: (function () {
|
|
618
620
|
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref8) {
|
|
619
621
|
var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, _ref8$extraData, extraData, nonce, _ref8$createRemoteTok, createRemoteToken, _ref8$force, force, tokenDuration, fabricToken, expiresAt, tokenResponse, address, decodedToken;
|
|
620
622
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
@@ -741,9 +743,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
741
743
|
* @returns {Promise<string>} - Returns an authorization token that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
|
|
742
744
|
* Save this token to avoid having to reauthenticate. This token expires after 24 hours.
|
|
743
745
|
*/
|
|
746
|
+
)
|
|
744
747
|
}, {
|
|
745
748
|
key: "AuthenticateExternalWallet",
|
|
746
|
-
value: function () {
|
|
749
|
+
value: (function () {
|
|
747
750
|
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref9) {
|
|
748
751
|
var _this2 = this;
|
|
749
752
|
var address, _ref9$tokenDuration, tokenDuration, _ref9$walletName, walletName, Sign, expiresAt, fabricToken;
|
|
@@ -812,6 +815,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
812
815
|
*
|
|
813
816
|
* @returns {string} - The client auth token
|
|
814
817
|
*/
|
|
818
|
+
)
|
|
815
819
|
}, {
|
|
816
820
|
key: "ClientAuthToken",
|
|
817
821
|
value: function ClientAuthToken() {
|
|
@@ -1974,7 +1978,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1974
1978
|
*/
|
|
1975
1979
|
}, {
|
|
1976
1980
|
key: "Initialize",
|
|
1977
|
-
value: function () {
|
|
1981
|
+
value: (function () {
|
|
1978
1982
|
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref24) {
|
|
1979
1983
|
var client, _ref24$appId, appId, _ref24$network, network, _ref24$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref24$storeAuthToken, storeAuthToken, _ref24$skipMarketplac, skipMarketplaceLoad, _ref25, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
|
|
1980
1984
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
@@ -2092,9 +2096,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
2092
2096
|
return _Initialize.apply(this, arguments);
|
|
2093
2097
|
}
|
|
2094
2098
|
return Initialize;
|
|
2095
|
-
}()
|
|
2099
|
+
}())
|
|
2096
2100
|
}]);
|
|
2097
|
-
return ElvWalletClient;
|
|
2098
2101
|
}();
|
|
2099
2102
|
Object.assign(ElvWalletClient.prototype, require("./ClientMethods"));
|
|
2100
2103
|
Object.assign(ElvWalletClient.prototype, require("./Profile"));
|
package/package.json
CHANGED
package/src/HttpClient.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const URI = require("urijs");
|
|
2
2
|
const Fetch = typeof fetch !== "undefined" ? fetch : require("node-fetch").default;
|
|
3
3
|
const {LogMessage} = require("./LogMessage");
|
|
4
|
+
const Utils = require("./Utils");
|
|
4
5
|
|
|
5
6
|
class HttpClient {
|
|
6
7
|
Log(message, error=false) {
|
|
@@ -100,7 +101,10 @@ class HttpClient {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
let response;
|
|
103
|
-
this.
|
|
104
|
+
if(this.debug) {
|
|
105
|
+
this.Log(`${method} - ${uri.toString()}`);
|
|
106
|
+
this.Log(`fetchParameters: ${JSON.stringify(fetchParameters, null, 2)}`);
|
|
107
|
+
}
|
|
104
108
|
try {
|
|
105
109
|
response =
|
|
106
110
|
await HttpClient.Fetch(
|
|
@@ -166,7 +170,7 @@ class HttpClient {
|
|
|
166
170
|
requestParams: fetchParameters
|
|
167
171
|
};
|
|
168
172
|
|
|
169
|
-
this.Log(
|
|
173
|
+
if(this.debug) this.Log(
|
|
170
174
|
JSON.stringify(error, null, 2),
|
|
171
175
|
true
|
|
172
176
|
);
|
|
@@ -208,6 +212,16 @@ class HttpClient {
|
|
|
208
212
|
);
|
|
209
213
|
}
|
|
210
214
|
|
|
215
|
+
// Perform http request and then return response body parsed as JSON
|
|
216
|
+
// ResponseToJson() will log response if this.debug === true
|
|
217
|
+
async RequestJsonBody(params) {
|
|
218
|
+
return Utils.ResponseToJson(
|
|
219
|
+
this.Request(params),
|
|
220
|
+
this.debug,
|
|
221
|
+
this.Log.bind(this)
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
211
225
|
URL({path, queryParams={}}) {
|
|
212
226
|
let baseURI = this.BaseURI();
|
|
213
227
|
|
package/src/Utils.js
CHANGED
|
@@ -545,18 +545,40 @@ const Utils = {
|
|
|
545
545
|
});
|
|
546
546
|
},
|
|
547
547
|
|
|
548
|
-
|
|
549
|
-
|
|
548
|
+
/**
|
|
549
|
+
* Interprets an http response body obtained from an http call as JSON and returns result of parsing it.
|
|
550
|
+
*
|
|
551
|
+
* @param {Promise} response - An http response from node-fetch
|
|
552
|
+
* @param {boolean=} debug - Whether or not to log the body
|
|
553
|
+
* @param {Function} logFn - Log function to use if debug is truthy
|
|
554
|
+
* @return {*} - Result of parsing response body as JSON
|
|
555
|
+
*/
|
|
556
|
+
ResponseToJson: async (response, debug = false, logFn) => {
|
|
557
|
+
return await Utils.ResponseToFormat("json", response, debug, logFn);
|
|
550
558
|
},
|
|
551
559
|
|
|
552
|
-
|
|
560
|
+
/**
|
|
561
|
+
* Interprets an http response body obtained from an http call as a requested format and returns result of converting/formatting.
|
|
562
|
+
*
|
|
563
|
+
* @param {string} format - The format to use when interpreting response body (e.g. "json", "text" et. al.)
|
|
564
|
+
* @param {Promise} response - An http response from node-fetch
|
|
565
|
+
* @param {boolean=} debug - Whether or not to log a debug statement containing the body (ignored for formats other than "json" and "text")
|
|
566
|
+
* @param {Function} logFn - Log function to use if debug is truthy
|
|
567
|
+
* @return {*} - Result of converting response body into the requested format
|
|
568
|
+
*/
|
|
569
|
+
ResponseToFormat: async (format, response, debug = false, logFn) => {
|
|
553
570
|
response = await response;
|
|
571
|
+
let formattedBody;
|
|
554
572
|
|
|
555
573
|
switch(format.toLowerCase()) {
|
|
556
574
|
case "json":
|
|
557
|
-
|
|
575
|
+
formattedBody = await response.json();
|
|
576
|
+
if(debug) logFn(`response body: ${JSON.stringify(formattedBody, null, 2)}`);
|
|
577
|
+
return formattedBody;
|
|
558
578
|
case "text":
|
|
559
|
-
|
|
579
|
+
formattedBody = await response.text();
|
|
580
|
+
if(debug) logFn(`response body: ${formattedBody}`);
|
|
581
|
+
return formattedBody;
|
|
560
582
|
case "blob":
|
|
561
583
|
return await response.blob();
|
|
562
584
|
case "arraybuffer":
|
|
@@ -390,13 +390,11 @@ exports.ContentLibrary = async function({libraryId}) {
|
|
|
390
390
|
|
|
391
391
|
const path = UrlJoin("qlibs", libraryId);
|
|
392
392
|
|
|
393
|
-
const library = await this.
|
|
394
|
-
this.
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
})
|
|
399
|
-
);
|
|
393
|
+
const library = await this.HttpClient.RequestJsonBody({
|
|
394
|
+
headers: await this.authClient.AuthorizationHeader({libraryId}),
|
|
395
|
+
method: "GET",
|
|
396
|
+
path: path
|
|
397
|
+
});
|
|
400
398
|
|
|
401
399
|
return {
|
|
402
400
|
...library,
|
|
@@ -566,14 +564,12 @@ exports.ContentObjects = async function({libraryId, filterOptions={}}) {
|
|
|
566
564
|
this.Log("Filter options:");
|
|
567
565
|
this.Log(filterOptions);
|
|
568
566
|
|
|
569
|
-
return await this.
|
|
570
|
-
this.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
})
|
|
576
|
-
);
|
|
567
|
+
return await this.HttpClient.RequestJsonBody({
|
|
568
|
+
headers: await this.authClient.AuthorizationHeader({libraryId}),
|
|
569
|
+
method: "GET",
|
|
570
|
+
path: path,
|
|
571
|
+
queryParams
|
|
572
|
+
});
|
|
577
573
|
};
|
|
578
574
|
|
|
579
575
|
/**
|
|
@@ -597,13 +593,11 @@ exports.ContentObject = async function({libraryId, objectId, versionHash, writeT
|
|
|
597
593
|
|
|
598
594
|
let path = UrlJoin("q", writeToken || versionHash || objectId);
|
|
599
595
|
|
|
600
|
-
return await this.
|
|
601
|
-
this.
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
})
|
|
606
|
-
);
|
|
596
|
+
return await this.HttpClient.RequestJsonBody({
|
|
597
|
+
headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
|
|
598
|
+
method: "GET",
|
|
599
|
+
path: path
|
|
600
|
+
});
|
|
607
601
|
};
|
|
608
602
|
|
|
609
603
|
/**
|
|
@@ -919,22 +913,20 @@ exports.ContentObjectMetadata = async function({
|
|
|
919
913
|
|
|
920
914
|
let metadata;
|
|
921
915
|
try {
|
|
922
|
-
metadata = await this.
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
queryParams
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
})
|
|
937
|
-
);
|
|
916
|
+
metadata = await this.HttpClient.RequestJsonBody({
|
|
917
|
+
headers: { "Authorization": authTokens.map(token => `Bearer ${token}`) },
|
|
918
|
+
queryParams: {
|
|
919
|
+
...queryParams,
|
|
920
|
+
select,
|
|
921
|
+
remove,
|
|
922
|
+
link_depth: linkDepthLimit,
|
|
923
|
+
resolve: resolveLinks,
|
|
924
|
+
resolve_include_source: resolveIncludeSource,
|
|
925
|
+
resolve_ignore_errors: resolveIgnoreErrors,
|
|
926
|
+
},
|
|
927
|
+
method: "GET",
|
|
928
|
+
path: path
|
|
929
|
+
});
|
|
938
930
|
} catch(error) {
|
|
939
931
|
if(error.status !== 404) {
|
|
940
932
|
throw error;
|
|
@@ -1066,13 +1058,11 @@ exports.ContentObjectVersions = async function({libraryId, objectId}) {
|
|
|
1066
1058
|
|
|
1067
1059
|
let path = UrlJoin("qid", objectId);
|
|
1068
1060
|
|
|
1069
|
-
return this.
|
|
1070
|
-
this.
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
})
|
|
1075
|
-
);
|
|
1061
|
+
return this.HttpClient.RequestJsonBody({
|
|
1062
|
+
headers: await this.authClient.AuthorizationHeader({libraryId, objectId}),
|
|
1063
|
+
method: "GET",
|
|
1064
|
+
path: path
|
|
1065
|
+
});
|
|
1076
1066
|
};
|
|
1077
1067
|
|
|
1078
1068
|
/**
|
|
@@ -1143,13 +1133,11 @@ exports.LatestVersionHashV2 = async function({objectId, versionHash}) {
|
|
|
1143
1133
|
try {
|
|
1144
1134
|
let path = UrlJoin("q", objectId);
|
|
1145
1135
|
|
|
1146
|
-
let q = await this.
|
|
1147
|
-
this.
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
})
|
|
1152
|
-
);
|
|
1136
|
+
let q = await this.HttpClient.RequestJsonBody({
|
|
1137
|
+
headers: await this.authClient.AuthorizationHeader({objectId}),
|
|
1138
|
+
method: "GET",
|
|
1139
|
+
path: path
|
|
1140
|
+
});
|
|
1153
1141
|
latestHash = q.hash;
|
|
1154
1142
|
|
|
1155
1143
|
} catch(error) {
|
|
@@ -1379,15 +1367,13 @@ exports.AvailableOfferings = async function({
|
|
|
1379
1367
|
.flat()
|
|
1380
1368
|
.filter(token => token);
|
|
1381
1369
|
|
|
1382
|
-
return await this.
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
})
|
|
1390
|
-
);
|
|
1370
|
+
return await this.HttpClient.RequestJsonBody({
|
|
1371
|
+
path: path,
|
|
1372
|
+
method: "GET",
|
|
1373
|
+
headers: {
|
|
1374
|
+
Authorization: `Bearer ${authorization.join(",")}`
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1391
1377
|
} catch(error) {
|
|
1392
1378
|
if(error.status && parseInt(error.status) === 500) {
|
|
1393
1379
|
return {};
|
|
@@ -1526,13 +1512,11 @@ exports.PlayoutOptions = async function({
|
|
|
1526
1512
|
};
|
|
1527
1513
|
|
|
1528
1514
|
const playoutOptions = Object.values(
|
|
1529
|
-
await this.
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
})
|
|
1535
|
-
)
|
|
1515
|
+
await this.HttpClient.RequestJsonBody({
|
|
1516
|
+
path,
|
|
1517
|
+
method: "GET",
|
|
1518
|
+
queryParams
|
|
1519
|
+
})
|
|
1536
1520
|
);
|
|
1537
1521
|
|
|
1538
1522
|
if(!signedLink && linkTarget.versionHash) {
|
|
@@ -1638,17 +1622,14 @@ exports.PlayoutOptions = async function({
|
|
|
1638
1622
|
playoutMap.multiview = true;
|
|
1639
1623
|
|
|
1640
1624
|
playoutMap.AvailableViews = async () => {
|
|
1641
|
-
return await this.
|
|
1642
|
-
"json",
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
}
|
|
1650
|
-
})
|
|
1651
|
-
);
|
|
1625
|
+
return await this.HttpClient.RequestJsonBody({
|
|
1626
|
+
path: UrlJoin("q", linkTarget.versionHash || versionHash, "rep", handler, offering, "views.json"),
|
|
1627
|
+
method: "GET",
|
|
1628
|
+
queryParams: {
|
|
1629
|
+
sid: sessionId,
|
|
1630
|
+
authorization
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1652
1633
|
};
|
|
1653
1634
|
|
|
1654
1635
|
playoutMap.SwitchView = async (view) => {
|
|
@@ -1882,7 +1863,9 @@ exports.CallBitcodeMethod = async function({
|
|
|
1882
1863
|
path,
|
|
1883
1864
|
queryParams,
|
|
1884
1865
|
allowFailover: false
|
|
1885
|
-
})
|
|
1866
|
+
}),
|
|
1867
|
+
this.HttpClient.debug,
|
|
1868
|
+
this.HttpClient.Log.bind(this.HttpClient)
|
|
1886
1869
|
);
|
|
1887
1870
|
};
|
|
1888
1871
|
|
|
@@ -183,8 +183,13 @@ exports.CreateContentType = async function({name, metadata={}, bitcode}) {
|
|
|
183
183
|
path: path
|
|
184
184
|
});
|
|
185
185
|
// extract the url for the node that handled the request
|
|
186
|
+
// TODO: remove/simplify after we start using /nodes API call to get node URLs for write tokens
|
|
186
187
|
const nodeUrl = (new URL(rawCreateResponse.url)).origin;
|
|
187
|
-
const createResponse = await this.utils.ResponseToJson(
|
|
188
|
+
const createResponse = await this.utils.ResponseToJson(
|
|
189
|
+
rawCreateResponse,
|
|
190
|
+
this.HttpClient.debug,
|
|
191
|
+
this.HttpClient.Log.bind(this.HttpClient)
|
|
192
|
+
);
|
|
188
193
|
|
|
189
194
|
// Record the node used in creating this write token
|
|
190
195
|
this.RecordWriteToken({writeToken: createResponse.write_token, fabricNodeUrl: nodeUrl});
|
|
@@ -602,8 +607,14 @@ exports.CreateContentObject = async function({libraryId, objectId, options={}})
|
|
|
602
607
|
path: path,
|
|
603
608
|
body: options
|
|
604
609
|
});
|
|
610
|
+
// extract the url for the node that handled the request
|
|
611
|
+
// TODO: remove/simplify after we start using /nodes API call to get node URLs for write tokens
|
|
605
612
|
const nodeUrl = (new URL(rawCreateResponse.url)).origin;
|
|
606
|
-
const createResponse = await this.utils.ResponseToJson(
|
|
613
|
+
const createResponse = await this.utils.ResponseToJson(
|
|
614
|
+
rawCreateResponse,
|
|
615
|
+
this.HttpClient.debug,
|
|
616
|
+
this.HttpClient.Log.bind(this.HttpClient)
|
|
617
|
+
);
|
|
607
618
|
|
|
608
619
|
// Record the node used in creating this write token
|
|
609
620
|
this.RecordWriteToken({writeToken: createResponse.write_token, fabricNodeUrl: nodeUrl});
|
|
@@ -773,8 +784,13 @@ exports.EditContentObject = async function({libraryId, objectId, options={}}) {
|
|
|
773
784
|
body: options
|
|
774
785
|
});
|
|
775
786
|
// extract the url for the node that handled the request
|
|
787
|
+
// TODO: remove/simplify after we start using /nodes API call to get node URLs for write tokens
|
|
776
788
|
const nodeUrl = (new URL(rawEditResponse.url)).origin;
|
|
777
|
-
const editResponse = await this.utils.ResponseToJson(
|
|
789
|
+
const editResponse = await this.utils.ResponseToJson(
|
|
790
|
+
rawEditResponse,
|
|
791
|
+
this.HttpClient.debug,
|
|
792
|
+
this.HttpClient.Log.bind(this.HttpClient)
|
|
793
|
+
);
|
|
778
794
|
|
|
779
795
|
// Record the node used in creating this write token
|
|
780
796
|
this.RecordWriteToken({writeToken: editResponse.write_token, fabricNodeUrl: nodeUrl});
|
|
@@ -957,14 +973,12 @@ exports.FinalizeContentObject = async function({
|
|
|
957
973
|
|
|
958
974
|
let path = UrlJoin("q", writeToken);
|
|
959
975
|
|
|
960
|
-
const finalizeResponse = await this.
|
|
961
|
-
this.
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
})
|
|
967
|
-
);
|
|
976
|
+
const finalizeResponse = await this.HttpClient.RequestJsonBody({
|
|
977
|
+
headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
|
|
978
|
+
method: "POST",
|
|
979
|
+
path: path,
|
|
980
|
+
allowFailover: false
|
|
981
|
+
});
|
|
968
982
|
|
|
969
983
|
this.Log(`Finalized: ${finalizeResponse.hash}`);
|
|
970
984
|
|