@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.
Files changed (40) hide show
  1. package/dist/ElvClient-min.js +15 -14
  2. package/dist/ElvClient-node-min.js +14 -13
  3. package/dist/ElvFrameClient-min.js +10 -10
  4. package/dist/ElvPermissionsClient-min.js +9 -9
  5. package/dist/ElvWalletClient-min.js +15 -14
  6. package/dist/ElvWalletClient-node-min.js +14 -13
  7. package/dist/src/AuthorizationClient.js +9 -12
  8. package/dist/src/ContentObjectAudit.js +3 -3
  9. package/dist/src/ContentObjectVerification.js +3 -3
  10. package/dist/src/Crypto.js +2 -2
  11. package/dist/src/ElvClient.js +47 -28
  12. package/dist/src/ElvWallet.js +7 -5
  13. package/dist/src/EthClient.js +8 -9
  14. package/dist/src/FrameClient.js +8 -9
  15. package/dist/src/HttpClient.js +27 -4
  16. package/dist/src/Id.js +1 -2
  17. package/dist/src/PermissionsClient.js +31 -19
  18. package/dist/src/RemoteSigner.js +6 -8
  19. package/dist/src/UserProfileClient.js +35 -19
  20. package/dist/src/Utils.js +62 -28
  21. package/dist/src/client/ABRPublishing.js +2 -2
  22. package/dist/src/client/AccessGroups.js +2 -2
  23. package/dist/src/client/ContentAccess.js +104 -104
  24. package/dist/src/client/ContentManagement.js +25 -23
  25. package/dist/src/client/Contracts.js +2 -2
  26. package/dist/src/client/Files.js +77 -88
  27. package/dist/src/client/LiveConf.js +3 -7
  28. package/dist/src/client/LiveStream.js +35 -36
  29. package/dist/src/client/NFT.js +2 -2
  30. package/dist/src/walletClient/ClientMethods.js +2 -2
  31. package/dist/src/walletClient/Profile.js +2 -2
  32. package/dist/src/walletClient/Utils.js +2 -2
  33. package/dist/src/walletClient/index.js +17 -14
  34. package/package.json +1 -1
  35. package/src/HttpClient.js +16 -2
  36. package/src/Utils.js +27 -5
  37. package/src/client/ContentAccess.js +63 -80
  38. package/src/client/ContentManagement.js +25 -11
  39. package/src/client/Files.js +43 -51
  40. package/src/client/LiveStream.js +5 -1
@@ -2,8 +2,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
2
2
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
3
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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
  /**
8
8
  * Methods for managing content types, libraries and objects
9
9
  *
@@ -328,9 +328,10 @@ exports.CreateContentType = /*#__PURE__*/function () {
328
328
  case 21:
329
329
  rawCreateResponse = _context4.sent;
330
330
  // extract the url for the node that handled the request
331
+ // TODO: remove/simplify after we start using /nodes API call to get node URLs for write tokens
331
332
  nodeUrl = new URL(rawCreateResponse.url).origin;
332
333
  _context4.next = 25;
333
- return this.utils.ResponseToJson(rawCreateResponse);
334
+ return this.utils.ResponseToJson(rawCreateResponse, this.HttpClient.debug, this.HttpClient.Log.bind(this.HttpClient));
334
335
  case 25:
335
336
  createResponse = _context4.sent;
336
337
  // Record the node used in creating this write token
@@ -971,9 +972,11 @@ exports.CreateContentObject = /*#__PURE__*/function () {
971
972
  return _context11.t4.Request.call(_context11.t4, _context11.t8);
972
973
  case 65:
973
974
  rawCreateResponse = _context11.sent;
975
+ // extract the url for the node that handled the request
976
+ // TODO: remove/simplify after we start using /nodes API call to get node URLs for write tokens
974
977
  nodeUrl = new URL(rawCreateResponse.url).origin;
975
978
  _context11.next = 69;
976
- return this.utils.ResponseToJson(rawCreateResponse);
979
+ return this.utils.ResponseToJson(rawCreateResponse, this.HttpClient.debug, this.HttpClient.Log.bind(this.HttpClient));
977
980
  case 69:
978
981
  createResponse = _context11.sent;
979
982
  // Record the node used in creating this write token
@@ -1315,9 +1318,10 @@ exports.EditContentObject = /*#__PURE__*/function () {
1315
1318
  case 33:
1316
1319
  rawEditResponse = _context15.sent;
1317
1320
  // extract the url for the node that handled the request
1321
+ // TODO: remove/simplify after we start using /nodes API call to get node URLs for write tokens
1318
1322
  nodeUrl = new URL(rawEditResponse.url).origin;
1319
1323
  _context15.next = 37;
1320
- return this.utils.ResponseToJson(rawEditResponse);
1324
+ return this.utils.ResponseToJson(rawEditResponse, this.HttpClient.debug, this.HttpClient.Log.bind(this.HttpClient));
1321
1325
  case 37:
1322
1326
  editResponse = _context15.sent;
1323
1327
  // Record the node used in creating this write token
@@ -1651,44 +1655,42 @@ exports.FinalizeContentObject = /*#__PURE__*/function () {
1651
1655
  return this.AwaitPending(objectId);
1652
1656
  case 23:
1653
1657
  path = UrlJoin("q", writeToken);
1654
- _context20.t11 = this.utils;
1655
- _context20.t12 = this.HttpClient;
1656
- _context20.next = 28;
1658
+ _context20.t11 = this.HttpClient;
1659
+ _context20.next = 27;
1657
1660
  return this.authClient.AuthorizationHeader({
1658
1661
  libraryId: libraryId,
1659
1662
  objectId: objectId,
1660
1663
  update: true
1661
1664
  });
1662
- case 28:
1663
- _context20.t13 = _context20.sent;
1664
- _context20.t14 = path;
1665
- _context20.t15 = {
1666
- headers: _context20.t13,
1665
+ case 27:
1666
+ _context20.t12 = _context20.sent;
1667
+ _context20.t13 = path;
1668
+ _context20.t14 = {
1669
+ headers: _context20.t12,
1667
1670
  method: "POST",
1668
- path: _context20.t14,
1671
+ path: _context20.t13,
1669
1672
  allowFailover: false
1670
1673
  };
1671
- _context20.t16 = _context20.t12.Request.call(_context20.t12, _context20.t15);
1672
- _context20.next = 34;
1673
- return _context20.t11.ResponseToJson.call(_context20.t11, _context20.t16);
1674
- case 34:
1674
+ _context20.next = 32;
1675
+ return _context20.t11.RequestJsonBody.call(_context20.t11, _context20.t14);
1676
+ case 32:
1675
1677
  finalizeResponse = _context20.sent;
1676
1678
  this.Log("Finalized: ".concat(finalizeResponse.hash));
1677
1679
  if (!publish) {
1678
- _context20.next = 39;
1680
+ _context20.next = 37;
1679
1681
  break;
1680
1682
  }
1681
- _context20.next = 39;
1683
+ _context20.next = 37;
1682
1684
  return this.PublishContentVersion({
1683
1685
  objectId: objectId,
1684
1686
  versionHash: finalizeResponse.hash,
1685
1687
  awaitCommitConfirmation: awaitCommitConfirmation
1686
1688
  });
1687
- case 39:
1689
+ case 37:
1688
1690
  // Invalidate cached content type, if this is one.
1689
1691
  delete this.contentTypes[objectId];
1690
1692
  return _context20.abrupt("return", finalizeResponse);
1691
- case 41:
1693
+ case 39:
1692
1694
  case "end":
1693
1695
  return _context20.stop();
1694
1696
  }
@@ -2278,7 +2280,7 @@ exports.UpdateContentObjectGraph = /*#__PURE__*/function () {
2278
2280
  return _context30.delegateYield(_loop(), "t0", 8);
2279
2281
  case 8:
2280
2282
  _ret = _context30.t0;
2281
- if (!(_typeof(_ret) === "object")) {
2283
+ if (!_ret) {
2282
2284
  _context30.next = 11;
2283
2285
  break;
2284
2286
  }
@@ -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(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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
  /**
8
8
  * Methods for deploying and interacting with contracts
9
9
  *
@@ -2,8 +2,8 @@ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
2
2
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
3
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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
  /**
8
8
  * Methods for accessing and managing access groups
9
9
  *
@@ -56,25 +56,23 @@ exports.ListFiles = /*#__PURE__*/function () {
56
56
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
57
57
  }
58
58
  urlPath = UrlJoin("q", writeToken || versionHash || objectId, "files_list", path);
59
- _context.t0 = this.utils;
60
- _context.t1 = this.HttpClient;
61
- _context.next = 8;
59
+ _context.t0 = this.HttpClient;
60
+ _context.next = 7;
62
61
  return this.authClient.AuthorizationHeader({
63
62
  libraryId: libraryId,
64
63
  objectId: objectId,
65
64
  versionHash: versionHash
66
65
  });
67
- case 8:
68
- _context.t2 = _context.sent;
69
- _context.t3 = urlPath;
70
- _context.t4 = {
71
- headers: _context.t2,
66
+ case 7:
67
+ _context.t1 = _context.sent;
68
+ _context.t2 = urlPath;
69
+ _context.t3 = {
70
+ headers: _context.t1,
72
71
  method: "GET",
73
- path: _context.t3
72
+ path: _context.t2
74
73
  };
75
- _context.t5 = _context.t1.Request.call(_context.t1, _context.t4);
76
- return _context.abrupt("return", _context.t0.ResponseToJson.call(_context.t0, _context.t5));
77
- case 13:
74
+ return _context.abrupt("return", _context.t0.RequestJsonBody.call(_context.t0, _context.t3));
75
+ case 11:
78
76
  case "end":
79
77
  return _context.stop();
80
78
  }
@@ -159,7 +157,11 @@ exports.UploadFilesFromS3 = /*#__PURE__*/function () {
159
157
  _context2.next = 5;
160
158
  break;
161
159
  case 18:
162
- this.Log("Uploading files from S3: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
160
+ if (copy) {
161
+ this.Log("Copying files from S3: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
162
+ } else {
163
+ this.Log("Adding links to files in S3: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
164
+ }
163
165
  if (!(encryption === "cgck")) {
164
166
  _context2.next = 25;
165
167
  break;
@@ -700,29 +702,27 @@ exports.CreateFileUploadJob = /*#__PURE__*/function () {
700
702
  ops: ops
701
703
  };
702
704
  path = UrlJoin("q", writeToken, "file_jobs");
703
- _context8.t0 = this.utils;
704
- _context8.t1 = this.HttpClient;
705
- _context8.next = 12;
705
+ _context8.t0 = this.HttpClient;
706
+ _context8.next = 11;
706
707
  return this.authClient.AuthorizationHeader({
707
708
  libraryId: libraryId,
708
709
  objectId: objectId,
709
710
  update: true,
710
711
  encryption: encryption
711
712
  });
712
- case 12:
713
- _context8.t2 = _context8.sent;
714
- _context8.t3 = path;
715
- _context8.t4 = body;
716
- _context8.t5 = {
717
- headers: _context8.t2,
713
+ case 11:
714
+ _context8.t1 = _context8.sent;
715
+ _context8.t2 = path;
716
+ _context8.t3 = body;
717
+ _context8.t4 = {
718
+ headers: _context8.t1,
718
719
  method: "POST",
719
- path: _context8.t3,
720
- body: _context8.t4,
720
+ path: _context8.t2,
721
+ body: _context8.t3,
721
722
  allowFailover: false
722
723
  };
723
- _context8.t6 = _context8.t1.Request.call(_context8.t1, _context8.t5);
724
- return _context8.abrupt("return", _context8.t0.ResponseToJson.call(_context8.t0, _context8.t6));
725
- case 18:
724
+ return _context8.abrupt("return", _context8.t0.RequestJsonBody.call(_context8.t0, _context8.t4));
725
+ case 16:
726
726
  case "end":
727
727
  return _context8.stop();
728
728
  }
@@ -1375,29 +1375,27 @@ exports.ContentParts = /*#__PURE__*/function () {
1375
1375
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1376
1376
  }
1377
1377
  path = UrlJoin("q", versionHash || objectId, "parts");
1378
- _context17.t0 = this.utils;
1379
- _context17.t1 = this.HttpClient;
1380
- _context17.next = 9;
1378
+ _context17.t0 = this.HttpClient;
1379
+ _context17.next = 8;
1381
1380
  return this.authClient.AuthorizationHeader({
1382
1381
  libraryId: libraryId,
1383
1382
  objectId: objectId,
1384
1383
  versionHash: versionHash
1385
1384
  });
1386
- case 9:
1387
- _context17.t2 = _context17.sent;
1388
- _context17.t3 = path;
1389
- _context17.t4 = {
1390
- headers: _context17.t2,
1385
+ case 8:
1386
+ _context17.t1 = _context17.sent;
1387
+ _context17.t2 = path;
1388
+ _context17.t3 = {
1389
+ headers: _context17.t1,
1391
1390
  method: "GET",
1392
- path: _context17.t3
1391
+ path: _context17.t2
1393
1392
  };
1394
- _context17.t5 = _context17.t1.Request.call(_context17.t1, _context17.t4);
1395
- _context17.next = 15;
1396
- return _context17.t0.ResponseToJson.call(_context17.t0, _context17.t5);
1397
- case 15:
1393
+ _context17.next = 13;
1394
+ return _context17.t0.RequestJsonBody.call(_context17.t0, _context17.t3);
1395
+ case 13:
1398
1396
  response = _context17.sent;
1399
1397
  return _context17.abrupt("return", response.parts);
1400
- case 17:
1398
+ case 15:
1401
1399
  case "end":
1402
1400
  return _context17.stop();
1403
1401
  }
@@ -1439,28 +1437,26 @@ exports.ContentPart = /*#__PURE__*/function () {
1439
1437
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1440
1438
  }
1441
1439
  path = UrlJoin("q", versionHash || objectId, "parts", partHash);
1442
- _context18.t0 = this.utils;
1443
- _context18.t1 = this.HttpClient;
1444
- _context18.next = 10;
1440
+ _context18.t0 = this.HttpClient;
1441
+ _context18.next = 9;
1445
1442
  return this.authClient.AuthorizationHeader({
1446
1443
  libraryId: libraryId,
1447
1444
  objectId: objectId,
1448
1445
  versionHash: versionHash
1449
1446
  });
1450
- case 10:
1451
- _context18.t2 = _context18.sent;
1452
- _context18.t3 = path;
1453
- _context18.t4 = {
1454
- headers: _context18.t2,
1447
+ case 9:
1448
+ _context18.t1 = _context18.sent;
1449
+ _context18.t2 = path;
1450
+ _context18.t3 = {
1451
+ headers: _context18.t1,
1455
1452
  method: "GET",
1456
- path: _context18.t3
1453
+ path: _context18.t2
1457
1454
  };
1458
- _context18.t5 = _context18.t1.Request.call(_context18.t1, _context18.t4);
1459
- _context18.next = 16;
1460
- return _context18.t0.ResponseToJson.call(_context18.t0, _context18.t5);
1461
- case 16:
1455
+ _context18.next = 14;
1456
+ return _context18.t0.RequestJsonBody.call(_context18.t0, _context18.t3);
1457
+ case 14:
1462
1458
  return _context18.abrupt("return", _context18.sent);
1463
- case 17:
1459
+ case 15:
1464
1460
  case "end":
1465
1461
  return _context18.stop();
1466
1462
  }
@@ -1856,33 +1852,31 @@ exports.CreatePart = /*#__PURE__*/function () {
1856
1852
  });
1857
1853
  ValidateWriteToken(writeToken);
1858
1854
  path = UrlJoin("q", writeToken, "parts");
1859
- _context23.t0 = this.utils;
1860
- _context23.t1 = this.HttpClient;
1861
- _context23.next = 8;
1855
+ _context23.t0 = this.HttpClient;
1856
+ _context23.next = 7;
1862
1857
  return this.authClient.AuthorizationHeader({
1863
1858
  libraryId: libraryId,
1864
1859
  objectId: objectId,
1865
1860
  update: true,
1866
1861
  encryption: encryption
1867
1862
  });
1868
- case 8:
1869
- _context23.t2 = _context23.sent;
1870
- _context23.t3 = path;
1871
- _context23.t4 = {
1872
- headers: _context23.t2,
1863
+ case 7:
1864
+ _context23.t1 = _context23.sent;
1865
+ _context23.t2 = path;
1866
+ _context23.t3 = {
1867
+ headers: _context23.t1,
1873
1868
  method: "POST",
1874
- path: _context23.t3,
1869
+ path: _context23.t2,
1875
1870
  bodyType: "BINARY",
1876
1871
  body: "",
1877
1872
  allowFailover: false
1878
1873
  };
1879
- _context23.t5 = _context23.t1.Request.call(_context23.t1, _context23.t4);
1880
- _context23.next = 14;
1881
- return _context23.t0.ResponseToJson.call(_context23.t0, _context23.t5);
1882
- case 14:
1874
+ _context23.next = 12;
1875
+ return _context23.t0.RequestJsonBody.call(_context23.t0, _context23.t3);
1876
+ case 12:
1883
1877
  openResponse = _context23.sent;
1884
1878
  return _context23.abrupt("return", openResponse.part.write_token);
1885
- case 16:
1879
+ case 14:
1886
1880
  case "end":
1887
1881
  return _context23.stop();
1888
1882
  }
@@ -2000,35 +1994,30 @@ exports.FinalizePart = /*#__PURE__*/function () {
2000
1994
  });
2001
1995
  ValidateWriteToken(writeToken);
2002
1996
  path = UrlJoin("q", writeToken, "parts");
2003
- _context25.t0 = this.utils;
2004
- _context25.t1 = this.HttpClient;
2005
- _context25.next = 8;
1997
+ _context25.t0 = this.HttpClient;
1998
+ _context25.next = 7;
2006
1999
  return this.authClient.AuthorizationHeader({
2007
2000
  libraryId: libraryId,
2008
2001
  objectId: objectId,
2009
2002
  update: true,
2010
2003
  encryption: encryption
2011
2004
  });
2012
- case 8:
2013
- _context25.t2 = _context25.sent;
2014
- _context25.t3 = UrlJoin(path, partWriteToken);
2015
- _context25.t4 = {
2016
- headers: _context25.t2,
2005
+ case 7:
2006
+ _context25.t1 = _context25.sent;
2007
+ _context25.t2 = UrlJoin(path, partWriteToken);
2008
+ _context25.t3 = {
2009
+ headers: _context25.t1,
2017
2010
  method: "POST",
2018
- path: _context25.t3,
2011
+ path: _context25.t2,
2019
2012
  bodyType: "BINARY",
2020
2013
  body: "",
2021
2014
  allowFailover: false
2022
2015
  };
2023
- _context25.next = 13;
2024
- return _context25.t1.Request.call(_context25.t1, _context25.t4);
2025
- case 13:
2026
- _context25.t5 = _context25.sent;
2027
- _context25.next = 16;
2028
- return _context25.t0.ResponseToJson.call(_context25.t0, _context25.t5);
2029
- case 16:
2016
+ _context25.next = 12;
2017
+ return _context25.t0.RequestJsonBody.call(_context25.t0, _context25.t3);
2018
+ case 12:
2030
2019
  return _context25.abrupt("return", _context25.sent);
2031
- case 17:
2020
+ case 13:
2032
2021
  case "end":
2033
2022
  return _context25.stop();
2034
2023
  }
@@ -1,8 +1,8 @@
1
1
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
2
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
3
3
  var _createClass = require("@babel/runtime/helpers/createClass");
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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 LadderTemplate = {
7
7
  "2160": {
8
8
  bit_rate: 14000000,
@@ -127,7 +127,7 @@ var LiveConf = /*#__PURE__*/function () {
127
127
  this.overwriteOriginUrl = overwriteOriginUrl;
128
128
  this.syncAudioToVideo = syncAudioToVideo;
129
129
  }
130
- _createClass(LiveConf, [{
130
+ return _createClass(LiveConf, [{
131
131
  key: "probeKind",
132
132
  value: function probeKind() {
133
133
  var fileNameSplit = this.probeData.format.filename.split(":");
@@ -242,7 +242,6 @@ var LiveConf = /*#__PURE__*/function () {
242
242
  } else {
243
243
  seg.audio = 29.76 * 48000; // Other codecs are resampled @48000
244
244
  }
245
-
246
245
  return seg;
247
246
  }
248
247
 
@@ -317,7 +316,6 @@ var LiveConf = /*#__PURE__*/function () {
317
316
  break;
318
317
  default:
319
318
  throw "unsupported frame rate for MPEGTS - " + frameRate;
320
- break;
321
319
  }
322
320
  return seg;
323
321
  }
@@ -379,7 +377,6 @@ var LiveConf = /*#__PURE__*/function () {
379
377
  break;
380
378
  default:
381
379
  throw "unsupported frame rate for RTMP - " + frameRate;
382
- break;
383
380
  }
384
381
  return seg;
385
382
  }
@@ -571,6 +568,5 @@ var LiveConf = /*#__PURE__*/function () {
571
568
  return conf;
572
569
  }
573
570
  }]);
574
- return LiveConf;
575
571
  }();
576
572
  exports.LiveConf = LiveConf;
@@ -823,7 +823,6 @@ exports.StreamCreate = /*#__PURE__*/function () {
823
823
  edge_write_token: edgeToken,
824
824
  state: "active" // indicates there is an active session (set to 'closed' when done)
825
825
  },
826
-
827
826
  fabric_config: {
828
827
  edge_write_token: edgeToken
829
828
  }
@@ -1445,7 +1444,6 @@ exports.StreamInsertion = /*#__PURE__*/function () {
1445
1444
  insertionInfo = {
1446
1445
  duration_sec: 0 // Minimum of video and audio duration
1447
1446
  };
1448
-
1449
1447
  ["video", "audio"].forEach(function (mt) {
1450
1448
  var stream = offeringMeta.media_struct.streams[mt];
1451
1449
  insertionInfo[mt] = {
@@ -1664,7 +1662,7 @@ exports.StreamInsertion = /*#__PURE__*/function () {
1664
1662
  */
1665
1663
  exports.StreamConfig = /*#__PURE__*/function () {
1666
1664
  var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref21) {
1667
- var name, _ref21$customSettings, customSettings, probeMetadata, objectId, status, libraryId, probe, mainMeta, userConfig, hostName, streamUrl, nodes, node, endpoint, controller, timeoutId, probeUrl, lc, liveRecordingConfig, e, writeToken;
1665
+ var name, _ref21$customSettings, customSettings, probeMetadata, objectId, status, libraryId, probe, mainMeta, userConfig, parsedName, hostName, streamUrl, nodes, node, endpoint, controller, timeoutId, probeUrl, lc, liveRecordingConfig, e, writeToken;
1668
1666
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1669
1667
  while (1) switch (_context11.prev = _context11.next) {
1670
1668
  case 0:
@@ -1693,22 +1691,23 @@ exports.StreamConfig = /*#__PURE__*/function () {
1693
1691
  status.user_config = userConfig;
1694
1692
 
1695
1693
  // Get node URI from user config
1696
- hostName = userConfig.url.replace("udp://", "").replace("rtmp://", "").replace("srt://", "").split(":")[0];
1694
+ parsedName = userConfig.url.replace("udp://", "https://").replace("rtmp://", "https://").replace("srt://", "https://");
1695
+ hostName = new URL(parsedName).hostname;
1697
1696
  streamUrl = new URL(userConfig.url);
1698
1697
  console.log("Retrieving nodes - matching", hostName);
1699
- _context11.next = 19;
1698
+ _context11.next = 20;
1700
1699
  return this.SpaceNodes({
1701
1700
  matchEndpoint: hostName
1702
1701
  });
1703
- case 19:
1702
+ case 20:
1704
1703
  nodes = _context11.sent;
1705
1704
  if (!(nodes.length < 1)) {
1706
- _context11.next = 23;
1705
+ _context11.next = 24;
1707
1706
  break;
1708
1707
  }
1709
1708
  status.error = "No node matching stream URL " + streamUrl.href;
1710
1709
  return _context11.abrupt("return", status);
1711
- case 23:
1710
+ case 24:
1712
1711
  node = {
1713
1712
  endpoints: nodes[0].services.fabric_api.urls,
1714
1713
  id: nodes[0].id
@@ -1716,7 +1715,7 @@ exports.StreamConfig = /*#__PURE__*/function () {
1716
1715
  status.node = node;
1717
1716
  endpoint = node.endpoints[0];
1718
1717
  if (probe) {
1719
- _context11.next = 55;
1718
+ _context11.next = 56;
1720
1719
  break;
1721
1720
  }
1722
1721
  this.SetNodes({
@@ -1729,17 +1728,17 @@ exports.StreamConfig = /*#__PURE__*/function () {
1729
1728
  timeoutId = setTimeout(function () {
1730
1729
  controller.abort();
1731
1730
  }, 60 * 1000); // milliseconds
1732
- _context11.prev = 31;
1733
- _context11.next = 34;
1731
+ _context11.prev = 32;
1732
+ _context11.next = 35;
1734
1733
  return this.Rep({
1735
1734
  libraryId: libraryId,
1736
1735
  objectId: objectId,
1737
1736
  rep: "probe"
1738
1737
  });
1739
- case 34:
1738
+ case 35:
1740
1739
  probeUrl = _context11.sent;
1741
1740
  _context11.t0 = this.utils;
1742
- _context11.next = 38;
1741
+ _context11.next = 39;
1743
1742
  return HttpClient.Fetch(probeUrl, {
1744
1743
  body: JSON.stringify({
1745
1744
  "filename": streamUrl.href,
@@ -1748,50 +1747,50 @@ exports.StreamConfig = /*#__PURE__*/function () {
1748
1747
  method: "POST",
1749
1748
  signal: controller.signal
1750
1749
  });
1751
- case 38:
1750
+ case 39:
1752
1751
  _context11.t1 = _context11.sent;
1753
- _context11.next = 41;
1752
+ _context11.next = 42;
1754
1753
  return _context11.t0.ResponseToJson.call(_context11.t0, _context11.t1);
1755
- case 41:
1754
+ case 42:
1756
1755
  probe = _context11.sent;
1757
1756
  if (probe) {
1758
1757
  clearTimeout(timeoutId);
1759
1758
  }
1760
1759
  if (!probe.errors) {
1761
- _context11.next = 45;
1760
+ _context11.next = 46;
1762
1761
  break;
1763
1762
  }
1764
1763
  throw probe.errors[0];
1765
- case 45:
1766
- _context11.next = 54;
1764
+ case 46:
1765
+ _context11.next = 55;
1767
1766
  break;
1768
- case 47:
1769
- _context11.prev = 47;
1770
- _context11.t2 = _context11["catch"](31);
1767
+ case 48:
1768
+ _context11.prev = 48;
1769
+ _context11.t2 = _context11["catch"](32);
1771
1770
  if (!(_context11.t2.code === "ETIMEDOUT")) {
1772
- _context11.next = 53;
1771
+ _context11.next = 54;
1773
1772
  break;
1774
1773
  }
1775
1774
  throw "Stream probe time out - make sure the stream source is available";
1776
- case 53:
1777
- throw _context11.t2;
1778
1775
  case 54:
1779
- probe.format.filename = streamUrl.href;
1776
+ throw _context11.t2;
1780
1777
  case 55:
1778
+ probe.format.filename = streamUrl.href;
1779
+ case 56:
1781
1780
  // Create live recording config
1782
1781
  lc = new LiveConf(probe, node.id, endpoint, false, false, true);
1783
1782
  liveRecordingConfig = lc.generateLiveConf({
1784
1783
  customSettings: customSettings
1785
1784
  }); // Store live recording config into the stream object
1786
- _context11.next = 59;
1785
+ _context11.next = 60;
1787
1786
  return this.EditContentObject({
1788
1787
  libraryId: libraryId,
1789
1788
  objectId: objectId
1790
1789
  });
1791
- case 59:
1790
+ case 60:
1792
1791
  e = _context11.sent;
1793
1792
  writeToken = e.write_token;
1794
- _context11.next = 63;
1793
+ _context11.next = 64;
1795
1794
  return this.ReplaceMetadata({
1796
1795
  libraryId: libraryId,
1797
1796
  objectId: objectId,
@@ -1799,8 +1798,8 @@ exports.StreamConfig = /*#__PURE__*/function () {
1799
1798
  metadataSubtree: "live_recording",
1800
1799
  metadata: liveRecordingConfig.live_recording
1801
1800
  });
1802
- case 63:
1803
- _context11.next = 65;
1801
+ case 64:
1802
+ _context11.next = 66;
1804
1803
  return this.ReplaceMetadata({
1805
1804
  libraryId: libraryId,
1806
1805
  objectId: objectId,
@@ -1808,22 +1807,22 @@ exports.StreamConfig = /*#__PURE__*/function () {
1808
1807
  metadataSubtree: "live_recording_config/probe_info",
1809
1808
  metadata: probe
1810
1809
  });
1811
- case 65:
1812
- _context11.next = 67;
1810
+ case 66:
1811
+ _context11.next = 68;
1813
1812
  return this.FinalizeContentObject({
1814
1813
  libraryId: libraryId,
1815
1814
  objectId: objectId,
1816
1815
  writeToken: writeToken,
1817
1816
  commitMessage: "Apply live stream configuration"
1818
1817
  });
1819
- case 67:
1818
+ case 68:
1820
1819
  status.fin = _context11.sent;
1821
1820
  return _context11.abrupt("return", status);
1822
- case 69:
1821
+ case 70:
1823
1822
  case "end":
1824
1823
  return _context11.stop();
1825
1824
  }
1826
- }, _callee11, this, [[31, 47]]);
1825
+ }, _callee11, this, [[32, 48]]);
1827
1826
  }));
1828
1827
  return function (_x11) {
1829
1828
  return _ref22.apply(this, arguments);