@eluvio/elv-client-js 4.0.136 → 4.0.138

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 (41) hide show
  1. package/dist/ElvClient-min.js +14 -15
  2. package/dist/ElvClient-node-min.js +13 -14
  3. package/dist/ElvFrameClient-min.js +10 -10
  4. package/dist/ElvPermissionsClient-min.js +9 -9
  5. package/dist/ElvWalletClient-min.js +14 -15
  6. package/dist/ElvWalletClient-node-min.js +13 -14
  7. package/dist/src/AuthorizationClient.js +12 -9
  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 +397 -522
  12. package/dist/src/ElvWallet.js +5 -7
  13. package/dist/src/EthClient.js +9 -8
  14. package/dist/src/FrameClient.js +10 -9
  15. package/dist/src/HttpClient.js +5 -5
  16. package/dist/src/Id.js +2 -1
  17. package/dist/src/PermissionsClient.js +19 -31
  18. package/dist/src/RemoteSigner.js +11 -10
  19. package/dist/src/UserProfileClient.js +20 -35
  20. package/dist/src/Utils.js +3 -2
  21. package/dist/src/client/ABRPublishing.js +196 -342
  22. package/dist/src/client/AccessGroups.js +2 -2
  23. package/dist/src/client/ContentAccess.js +12 -8
  24. package/dist/src/client/ContentManagement.js +83 -99
  25. package/dist/src/client/Contracts.js +2 -2
  26. package/dist/src/client/Files.js +2 -2
  27. package/dist/src/client/LiveConf.js +26 -43
  28. package/dist/src/client/LiveStream.js +63 -65
  29. package/dist/src/client/NFT.js +2 -2
  30. package/dist/src/client/Shares.js +24 -47
  31. package/dist/src/walletClient/ClientMethods.js +2 -2
  32. package/dist/src/walletClient/Profile.js +2 -2
  33. package/dist/src/walletClient/Utils.js +2 -2
  34. package/dist/src/walletClient/index.js +50 -65
  35. package/package.json +1 -1
  36. package/src/AuthorizationClient.js +2 -1
  37. package/src/ElvClient.js +2 -0
  38. package/src/EthClient.js +1 -1
  39. package/src/client/ABRPublishing.js +1 -1
  40. package/src/client/ContentAccess.js +30 -71
  41. package/src/walletClient/index.js +10 -6
@@ -2,8 +2,8 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
2
  var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
3
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
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; }
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; }
7
7
  /**
8
8
  * Methods for accessing and managing access groups
9
9
  *
@@ -3,8 +3,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
3
3
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
4
4
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
5
5
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
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; }
6
+ 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; }
7
+ 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; }
8
8
  /**
9
9
  * Methods for accessing content types, libraries and objects
10
10
  *
@@ -1618,7 +1618,7 @@ exports.ContentObjectMetadata = /*#__PURE__*/function () {
1618
1618
  _context24.next = 32;
1619
1619
  break;
1620
1620
  }
1621
- throw new Error("Write token ".concat(errQwtoken, " not found"));
1621
+ throw _context24.t0;
1622
1622
  case 32:
1623
1623
  // For all other 404 errors (not just 'subtree not found'), suppress error and
1624
1624
  // return an empty value. (there are function call chains that depend on this behavior,
@@ -2973,7 +2973,7 @@ exports.GlobalUrl = /*#__PURE__*/function () {
2973
2973
  }();
2974
2974
  exports.MakeFileServiceRequest = /*#__PURE__*/function () {
2975
2975
  var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(_ref64) {
2976
- var libraryId, objectId, versionHash, writeToken, path, _ref64$method, method, _ref64$queryParams, queryParams, body, _ref64$bodyType, bodyType, _ref64$format, format, encryption, _ref64$headers, headers, authorizationToken, queryPath;
2976
+ var libraryId, objectId, versionHash, writeToken, path, _ref64$method, method, _ref64$queryParams, queryParams, body, _ref64$bodyType, bodyType, _ref64$format, format, encryption, _ref64$headers, headers, authorizationToken, queryPath, authorization;
2977
2977
  return _regeneratorRuntime.wrap(function _callee37$(_context37) {
2978
2978
  while (1) switch (_context37.prev = _context37.next) {
2979
2979
  case 0:
@@ -3012,12 +3012,15 @@ exports.MakeFileServiceRequest = /*#__PURE__*/function () {
3012
3012
  });
3013
3013
  case 12:
3014
3014
  _context37.t1 = _context37.sent;
3015
- queryParams.authorization = [_context37.t0, _context37.t1].flat().filter(function (token) {
3015
+ authorization = [_context37.t0, _context37.t1].flat().filter(function (token) {
3016
3016
  return token;
3017
3017
  });
3018
+ headers.Authorization = headers.Authorization || authorization.map(function (token) {
3019
+ return "Bearer ".concat(token);
3020
+ });
3018
3021
  _context37.t2 = this.utils;
3019
3022
  _context37.t3 = format;
3020
- _context37.next = 18;
3023
+ _context37.next = 19;
3021
3024
  return this.FileServiceHttpClient.Request({
3022
3025
  body: body,
3023
3026
  bodyType: bodyType,
@@ -3026,12 +3029,12 @@ exports.MakeFileServiceRequest = /*#__PURE__*/function () {
3026
3029
  path: queryPath,
3027
3030
  queryParams: queryParams
3028
3031
  });
3029
- case 18:
3032
+ case 19:
3030
3033
  _context37.t4 = _context37.sent;
3031
3034
  _context37.t5 = this.FileServiceHttpClient.debug;
3032
3035
  _context37.t6 = this.FileServiceHttpClient.Log.bind(this.FileServiceHttpClient);
3033
3036
  return _context37.abrupt("return", _context37.t2.ResponseToFormat.call(_context37.t2, _context37.t3, _context37.t4, _context37.t5, _context37.t6));
3034
- case 22:
3037
+ case 23:
3035
3038
  case "end":
3036
3039
  return _context37.stop();
3037
3040
  }
@@ -4691,6 +4694,7 @@ exports.AccessInfo = /*#__PURE__*/function () {
4691
4694
  [] // Stakeholders
4692
4695
  ];
4693
4696
  }
4697
+
4694
4698
  this.Log("Retrieving access info: ".concat(objectId));
4695
4699
  _context55.next = 6;
4696
4700
  return this.ethClient.CallContractMethod({
@@ -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(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; }
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; }
7
7
  /**
8
8
  * Methods for managing content types, libraries and objects
9
9
  *
@@ -421,11 +421,11 @@ exports.CreateContentType = /*#__PURE__*/function () {
421
421
  * @param {string} name - Library name
422
422
  * @param {string=} description - Library description
423
423
  * @param {blob=} image - Image associated with the library
424
- * @param {string=} imageName - Name of the image associated with the library (required if image specified)
424
+ * @param {string=} - imageName - Name of the image associated with the library (required if image specified)
425
425
  * @param {Object=} metadata - Metadata of library object
426
426
  * @param {string=} kmsId - ID of the KMS to use for content in this library. If not specified,
427
427
  * the default KMS will be used.
428
- * @param {string=} tenantContractId - ID of the tenant to use for this library
428
+ * @param {string=} tenantId - ID of the tenant to use for this library
429
429
  *
430
430
  * @returns {Promise<string>} - Library ID of created library
431
431
  */
@@ -657,17 +657,32 @@ exports.SetContentObjectImage = /*#__PURE__*/function () {
657
657
  */
658
658
  exports.DeleteContentLibrary = /*#__PURE__*/function () {
659
659
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref14) {
660
- var libraryId;
660
+ var libraryId, path, authorizationHeader;
661
661
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
662
662
  while (1) switch (_context8.prev = _context8.next) {
663
663
  case 0:
664
664
  libraryId = _ref14.libraryId;
665
- throw Error("Delete library not supported. (".concat(libraryId, ")"));
666
- case 2:
665
+ throw Error("Not supported");
666
+ case 6:
667
+ authorizationHeader = _context8.sent;
668
+ _context8.next = 9;
669
+ return this.CallContractMethodAndWait({
670
+ contractAddress: this.utils.HashToAddress(libraryId),
671
+ methodName: "kill",
672
+ methodArgs: []
673
+ });
674
+ case 9:
675
+ _context8.next = 11;
676
+ return this.HttpClient.Request({
677
+ headers: authorizationHeader,
678
+ method: "DELETE",
679
+ path: path
680
+ });
681
+ case 11:
667
682
  case "end":
668
683
  return _context8.stop();
669
684
  }
670
- }, _callee8);
685
+ }, _callee8, this);
671
686
  }));
672
687
  return function (_x8) {
673
688
  return _ref15.apply(this, arguments);
@@ -813,11 +828,7 @@ exports.RemoveLibraryContentType = /*#__PURE__*/function () {
813
828
  *
814
829
  * meta: Metadata to use for the new object
815
830
  *
816
- * noEncryptionConk: Set to true to prevent creation of an encryption conk for the object
817
- *
818
- * createKMSConk: Set to true to create a KMS conk for object (usually for sharing a playable object) (incompatible with noEncryptionConk: true)
819
- *
820
- * @returns {Promise<Object>} - Response containing the object ID and write token of the draft, as well as the url of the node that created the write token.
831
+ * @returns {Promise<Object>} - Response containing the object ID and write token of the draft
821
832
  */
822
833
  exports.CreateContentObject = /*#__PURE__*/function () {
823
834
  var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref20) {
@@ -831,165 +842,143 @@ exports.CreateContentObject = /*#__PURE__*/function () {
831
842
  ValidateObject(objectId);
832
843
  }
833
844
  this.Log("Creating content object: ".concat(libraryId, " ").concat(objectId || ""));
834
- if (!(options.noEncryptionConk && options.createKMSConk)) {
835
- _context11.next = 6;
836
- break;
837
- }
838
- throw new Error("Incompatible options: noEncryptionConk and createKMSConk both set to true");
839
- case 6:
845
+
846
+ // Look up content type, if specified
840
847
  if (!options.type) {
841
- _context11.next = 28;
848
+ _context11.next = 26;
842
849
  break;
843
850
  }
844
851
  this.Log("Type specified: ".concat(options.type));
845
852
  type = options.type;
846
853
  if (!type.startsWith("hq__")) {
847
- _context11.next = 15;
854
+ _context11.next = 13;
848
855
  break;
849
856
  }
850
- _context11.next = 12;
857
+ _context11.next = 10;
851
858
  return this.ContentType({
852
859
  versionHash: type
853
860
  });
854
- case 12:
861
+ case 10:
855
862
  type = _context11.sent;
856
- _context11.next = 24;
863
+ _context11.next = 22;
857
864
  break;
858
- case 15:
865
+ case 13:
859
866
  if (!type.startsWith("iq__")) {
860
- _context11.next = 21;
867
+ _context11.next = 19;
861
868
  break;
862
869
  }
863
- _context11.next = 18;
870
+ _context11.next = 16;
864
871
  return this.ContentType({
865
872
  typeId: type
866
873
  });
867
- case 18:
874
+ case 16:
868
875
  type = _context11.sent;
869
- _context11.next = 24;
876
+ _context11.next = 22;
870
877
  break;
871
- case 21:
872
- _context11.next = 23;
878
+ case 19:
879
+ _context11.next = 21;
873
880
  return this.ContentType({
874
881
  name: type
875
882
  });
876
- case 23:
883
+ case 21:
877
884
  type = _context11.sent;
878
- case 24:
885
+ case 22:
879
886
  if (type) {
880
- _context11.next = 26;
887
+ _context11.next = 24;
881
888
  break;
882
889
  }
883
890
  throw Error("Unable to find content type '".concat(options.type, "'"));
884
- case 26:
891
+ case 24:
885
892
  typeId = type.id;
886
893
  options.type = type.hash;
887
- case 28:
894
+ case 26:
888
895
  if (objectId) {
889
- _context11.next = 46;
896
+ _context11.next = 44;
890
897
  break;
891
898
  }
892
- _context11.next = 31;
899
+ _context11.next = 29;
893
900
  return this.CurrentAccountAddress();
894
- case 31:
901
+ case 29:
895
902
  currentAccountAddress = _context11.sent;
896
- _context11.next = 34;
903
+ _context11.next = 32;
897
904
  return this.CallContractMethod({
898
905
  contractAddress: this.utils.HashToAddress(libraryId),
899
906
  methodName: "canContribute",
900
907
  methodArgs: [currentAccountAddress]
901
908
  });
902
- case 34:
909
+ case 32:
903
910
  canContribute = _context11.sent;
904
911
  if (canContribute) {
905
- _context11.next = 37;
912
+ _context11.next = 35;
906
913
  break;
907
914
  }
908
915
  throw Error("Current user does not have permission to create content in library ".concat(libraryId));
909
- case 37:
916
+ case 35:
910
917
  this.Log("Deploying contract...");
911
- _context11.next = 40;
918
+ _context11.next = 38;
912
919
  return this.authClient.CreateContentObject({
913
920
  libraryId: libraryId,
914
921
  typeId: typeId
915
922
  });
916
- case 40:
923
+ case 38:
917
924
  _yield$this$authClien3 = _context11.sent;
918
925
  contractAddress = _yield$this$authClien3.contractAddress;
919
926
  objectId = this.utils.AddressToObjectId(contractAddress);
920
927
  this.Log("Contract deployed: ".concat(contractAddress, " ").concat(objectId));
921
- _context11.next = 53;
928
+ _context11.next = 51;
922
929
  break;
923
- case 46:
930
+ case 44:
924
931
  _context11.t0 = this;
925
932
  _context11.t1 = "Contract already deployed for contract type: ";
926
- _context11.next = 50;
933
+ _context11.next = 48;
927
934
  return this.AccessType({
928
935
  id: objectId
929
936
  });
930
- case 50:
937
+ case 48:
931
938
  _context11.t2 = _context11.sent;
932
939
  _context11.t3 = _context11.t1.concat.call(_context11.t1, _context11.t2);
933
940
  _context11.t0.Log.call(_context11.t0, _context11.t3);
934
- case 53:
941
+ case 51:
935
942
  if (!options.visibility) {
936
- _context11.next = 57;
943
+ _context11.next = 55;
937
944
  break;
938
945
  }
939
946
  this.Log("Setting visibility to ".concat(options.visibility));
940
- _context11.next = 57;
947
+ _context11.next = 55;
941
948
  return this.SetVisibility({
942
949
  id: objectId,
943
950
  visibility: options.visibility
944
951
  });
945
- case 57:
952
+ case 55:
946
953
  path = UrlJoin("qid", objectId);
947
954
  _context11.t4 = this.HttpClient;
948
- _context11.next = 61;
955
+ _context11.next = 59;
949
956
  return this.authClient.AuthorizationHeader({
950
957
  libraryId: libraryId,
951
958
  objectId: objectId,
952
959
  update: true
953
960
  });
954
- case 61:
961
+ case 59:
955
962
  _context11.t5 = _context11.sent;
956
963
  _context11.t6 = path;
957
- _context11.t7 = {
958
- // filter out options not recognized by server (noEncryptionConk, createKMSConk)
959
- type: options.type,
960
- meta: options.meta,
961
- copy_from: options.copy_from
962
- };
964
+ _context11.t7 = options;
963
965
  _context11.t8 = {
964
966
  headers: _context11.t5,
965
967
  method: "POST",
966
968
  path: _context11.t6,
967
969
  body: _context11.t7
968
970
  };
969
- _context11.next = 67;
971
+ _context11.next = 65;
970
972
  return _context11.t4.Request.call(_context11.t4, _context11.t8);
971
- case 67:
973
+ case 65:
972
974
  rawCreateResponse = _context11.sent;
973
975
  // extract the url for the node that handled the request
974
- // (not strictly needed now that we can quickly look up node URL for a write token,
975
- // but still convenient)
976
+ // TODO: remove/simplify after we start using /nodes API call to get node URLs for write tokens
976
977
  nodeUrl = new URL(rawCreateResponse.url).origin;
977
- _context11.next = 71;
978
+ _context11.next = 69;
978
979
  return this.utils.ResponseToJson(rawCreateResponse, this.HttpClient.debug, this.HttpClient.Log.bind(this.HttpClient));
979
- case 71:
980
+ case 69:
980
981
  createResponse = _context11.sent;
981
- if (options.noEncryptionConk) {
982
- _context11.next = 75;
983
- break;
984
- }
985
- _context11.next = 75;
986
- return this.CreateEncryptionConk({
987
- libraryId: libraryId,
988
- objectId: objectId,
989
- writeToken: createResponse.write_token,
990
- createKMSConk: !!options.createKMSConk // make sure `undefined` gets converted to `false`
991
- });
992
- case 75:
993
982
  // Record the node used in creating this write token
994
983
  this.RecordWriteToken({
995
984
  writeToken: createResponse.write_token,
@@ -999,7 +988,7 @@ exports.CreateContentObject = /*#__PURE__*/function () {
999
988
  createResponse.objectId = createResponse.id;
1000
989
  createResponse.nodeUrl = nodeUrl;
1001
990
  return _context11.abrupt("return", createResponse);
1002
- case 80:
991
+ case 75:
1003
992
  case "end":
1004
993
  return _context11.stop();
1005
994
  }
@@ -2314,7 +2303,7 @@ exports.UpdateContentObjectGraph = /*#__PURE__*/function () {
2314
2303
  return _context30.delegateYield(_loop(), "t0", 8);
2315
2304
  case 8:
2316
2305
  _ret = _context30.t0;
2317
- if (!_ret) {
2306
+ if (!(_typeof(_ret) === "object")) {
2318
2307
  _context30.next = 11;
2319
2308
  break;
2320
2309
  }
@@ -2462,12 +2451,12 @@ exports.CreateLinks = /*#__PURE__*/function () {
2462
2451
  return _regeneratorRuntime.wrap(function _callee31$(_context32) {
2463
2452
  while (1) switch (_context32.prev = _context32.next) {
2464
2453
  case 0:
2465
- path = info.path.replace(/^([/.])+/, "");
2454
+ path = info.path.replace(/^(\/|\.)+/, "");
2466
2455
  type = (info.type || "file") === "file" ? "files" : info.type;
2467
2456
  if (type === "metadata") {
2468
2457
  type = "meta";
2469
2458
  }
2470
- target = authTarget = info.target.replace(/^([/.])+/, "");
2459
+ target = authTarget = info.target.replace(/^(\/|\.)+/, "");
2471
2460
  if (info.targetHash) {
2472
2461
  target = "/qfab/".concat(info.targetHash, "/").concat(type, "/").concat(target);
2473
2462
  } else {
@@ -2648,43 +2637,38 @@ exports.SetAuthPolicy = /*#__PURE__*/function () {
2648
2637
  *
2649
2638
  * @namedParams
2650
2639
  * @param {string} writeToken - Write token to delete
2640
+ * @param {string} libraryId - ID of the library
2651
2641
  */
2652
2642
  exports.DeleteWriteToken = /*#__PURE__*/function () {
2653
2643
  var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(_ref64) {
2654
- var writeToken, objectId, libraryId, path, authorizationHeader;
2644
+ var writeToken, libraryId, path, authorizationHeader;
2655
2645
  return _regeneratorRuntime.wrap(function _callee35$(_context36) {
2656
2646
  while (1) switch (_context36.prev = _context36.next) {
2657
2647
  case 0:
2658
- writeToken = _ref64.writeToken;
2648
+ writeToken = _ref64.writeToken, libraryId = _ref64.libraryId;
2659
2649
  ValidateWriteToken(writeToken);
2660
- objectId = this.utils.DecodeWriteToken(writeToken).objectId;
2661
- _context36.next = 5;
2662
- return this.ContentObjectLibraryId({
2663
- objectId: objectId
2664
- });
2665
- case 5:
2666
- libraryId = _context36.sent;
2650
+ ValidateLibrary(libraryId);
2667
2651
  path = UrlJoin("qlibs", libraryId, "q", writeToken);
2668
- _context36.next = 9;
2652
+ _context36.next = 6;
2669
2653
  return this.authClient.AuthorizationHeader({
2670
- objectId: objectId,
2654
+ libraryId: libraryId,
2671
2655
  update: true
2672
2656
  });
2673
- case 9:
2657
+ case 6:
2674
2658
  authorizationHeader = _context36.sent;
2675
- _context36.next = 12;
2659
+ _context36.next = 9;
2676
2660
  return this.HttpClient.Request({
2677
2661
  headers: authorizationHeader,
2678
2662
  method: "DELETE",
2679
2663
  path: path,
2680
2664
  allowFailover: false
2681
2665
  });
2682
- case 12:
2683
- _context36.next = 14;
2666
+ case 9:
2667
+ _context36.next = 11;
2684
2668
  return this.HttpClient.ClearWriteToken({
2685
2669
  writeToken: writeToken
2686
2670
  });
2687
- case 14:
2671
+ case 11:
2688
2672
  case "end":
2689
2673
  return _context36.stop();
2690
2674
  }
@@ -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(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; }
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; }
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(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; }
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; }
7
7
  /**
8
8
  * Methods for accessing and managing access groups
9
9
  *
@@ -1,9 +1,8 @@
1
- var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
2
1
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
3
2
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
4
3
  var _createClass = require("@babel/runtime/helpers/createClass");
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; }
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; }
7
6
  /* eslint no-console: 0 */
8
7
 
9
8
  var DefaultABRLadder = {
@@ -110,7 +109,7 @@ var LiveConf = /*#__PURE__*/function () {
110
109
  this.overwriteOriginUrl = overwriteOriginUrl;
111
110
  this.syncAudioToVideo = syncAudioToVideo;
112
111
  }
113
- return _createClass(LiveConf, [{
112
+ _createClass(LiveConf, [{
114
113
  key: "probeKind",
115
114
  value: function probeKind() {
116
115
  var fileNameSplit = this.probeData.format.filename.split(":");
@@ -134,17 +133,14 @@ var LiveConf = /*#__PURE__*/function () {
134
133
  key: "getAudioStreamsFromProbe",
135
134
  value: function getAudioStreamsFromProbe() {
136
135
  var audioStreams = {};
137
- var audioStreamData = this.probeData.streams.filter(function (value) {
138
- return value.codec_type === "audio";
139
- });
140
- for (var index = 0; index < audioStreamData.length; index++) {
141
- var currentStreamIndex = audioStreamData[index].stream_index;
142
- var currentStreamData = audioStreamData[index];
143
- audioStreams[currentStreamIndex] = {
144
- recordingBitrate: Math.max(currentStreamData.bit_rate, 128000),
145
- recordingChannels: currentStreamData.channels,
146
- playoutLabel: "Audio ".concat(index + 1)
147
- };
136
+ for (var index = 0; index < this.probeData.streams.length; index++) {
137
+ if (this.probeData.streams[index].codec_type == "audio") {
138
+ audioStreams[index] = {
139
+ recordingBitrate: Math.max(this.probeData.streams[index].bit_rate, 128000),
140
+ recordingChannels: this.probeData.streams[index].channels,
141
+ playoutLabel: "Audio ".concat(index)
142
+ };
143
+ }
148
144
  }
149
145
  return audioStreams;
150
146
  }
@@ -228,6 +224,7 @@ var LiveConf = /*#__PURE__*/function () {
228
224
  } else {
229
225
  seg.audio = 29.76 * 48000; // Other codecs are resampled @48000
230
226
  }
227
+
231
228
  return seg;
232
229
  }
233
230
 
@@ -401,7 +398,7 @@ var LiveConf = /*#__PURE__*/function () {
401
398
  recordingChannels: audio.recording_channels || 2
402
399
  };
403
400
  if (audio.playout) {
404
- audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(i + 1);
401
+ audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(audioIdx);
405
402
  }
406
403
  }
407
404
  }
@@ -450,6 +447,18 @@ var LiveConf = /*#__PURE__*/function () {
450
447
  if (this.syncAudioToVideo) {
451
448
  conf.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id = this.syncAudioToStreamIdValue();
452
449
  }
450
+ if (customSettings.edge_write_token) {
451
+ conf.live_recording.fabric_config.edge_write_token = customSettings.edge_write_token;
452
+ }
453
+ if (customSettings.part_ttl) {
454
+ conf.live_recording.recording_config.recording_params.part_ttl = customSettings.part_ttl;
455
+ }
456
+ if (customSettings.connection_timeout) {
457
+ conf.live_recording.recording_config.recording_params.xc_params.connection_timeout = customSettings.connection_timeout;
458
+ }
459
+ if (customSettings.reconnect_timeout) {
460
+ conf.live_recording.recording_config.recording_params.reconnect_timeout = customSettings.reconnect_timeout;
461
+ }
453
462
 
454
463
  // Fill in specifics for protocol
455
464
  switch (this.probeKind()) {
@@ -552,35 +561,9 @@ var LiveConf = /*#__PURE__*/function () {
552
561
  // Global recording bitrate for all audio streams
553
562
  conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = globalAudioBitrate;
554
563
  conf.live_recording.recording_config.recording_params.xc_params.n_audio = nAudio;
555
-
556
- // Iterate through custom settings (which will override any existing setting)
557
- function SetByPath(_ref6) {
558
- var obj = _ref6.obj,
559
- path = _ref6.path,
560
- value = _ref6.value;
561
- var keys = path.split(".");
562
- var temp = obj;
563
- for (var _i3 = 0; _i3 < keys.length - 1; _i3++) {
564
- if (!temp[keys[_i3]]) {
565
- temp[keys[_i3]] = {};
566
- }
567
- temp = temp[keys[_i3]];
568
- }
569
- temp[keys[keys.length - 1]] = value;
570
- }
571
- var metaPathValues = customSettings.metaPathValues;
572
- for (var _i4 = 0, _Object$entries = Object.entries(metaPathValues || {}); _i4 < _Object$entries.length; _i4++) {
573
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i4], 2),
574
- path = _Object$entries$_i[0],
575
- value = _Object$entries$_i[1];
576
- SetByPath({
577
- obj: conf,
578
- path: path,
579
- value: value
580
- });
581
- }
582
564
  return conf;
583
565
  }
584
566
  }]);
567
+ return LiveConf;
585
568
  }();
586
569
  exports.LiveConf = LiveConf;