@eluvio/elv-client-js 4.0.134 → 4.0.136

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 (52) 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 +522 -397
  12. package/dist/src/ElvWallet.js +7 -5
  13. package/dist/src/EthClient.js +8 -9
  14. package/dist/src/FrameClient.js +9 -10
  15. package/dist/src/HttpClient.js +5 -5
  16. package/dist/src/Id.js +1 -2
  17. package/dist/src/PermissionsClient.js +31 -19
  18. package/dist/src/RemoteSigner.js +10 -11
  19. package/dist/src/UserProfileClient.js +35 -20
  20. package/dist/src/Utils.js +2 -3
  21. package/dist/src/client/ABRPublishing.js +342 -196
  22. package/dist/src/client/AccessGroups.js +2 -2
  23. package/dist/src/client/ContentAccess.js +8 -12
  24. package/dist/src/client/ContentManagement.js +99 -83
  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 +43 -26
  28. package/dist/src/client/LiveStream.js +65 -63
  29. package/dist/src/client/NFT.js +2 -2
  30. package/dist/src/client/Shares.js +47 -24
  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 +65 -50
  35. package/package.json +2 -2
  36. package/src/ElvClient.js +67 -3
  37. package/src/FrameClient.js +2 -1
  38. package/src/client/ABRPublishing.js +215 -83
  39. package/src/client/ContentManagement.js +7 -6
  40. package/src/client/LiveConf.js +13 -9
  41. package/src/client/LiveStream.js +8 -3
  42. package/src/walletClient/index.js +1 -1
  43. package/utilities/FrontEndSimpleIngest.js +198 -0
  44. package/utilities/ProductionMasterCreate.js +9 -2
  45. package/utilities/SampleIngest.js +225 -0
  46. package/utilities/SampleIngestWithMaster.js +226 -0
  47. package/utilities/lib/concerns/ArgLibraryId.js +1 -1
  48. package/utilities/lib/concerns/ArgTenant.js +23 -0
  49. package/utilities/lib/concerns/ContentType.js +1 -1
  50. package/utilities/lib/concerns/Finalize.js +12 -7
  51. package/utilities/lib/concerns/LRO.js +3 -3
  52. package/utilities/lib/concerns/Tenant.js +47 -0
@@ -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(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
  *
@@ -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(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; }
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  /**
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 _context24.t0;
1621
+ throw new Error("Write token ".concat(errQwtoken, " not found"));
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, authorization;
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;
2977
2977
  return _regeneratorRuntime.wrap(function _callee37$(_context37) {
2978
2978
  while (1) switch (_context37.prev = _context37.next) {
2979
2979
  case 0:
@@ -3012,15 +3012,12 @@ exports.MakeFileServiceRequest = /*#__PURE__*/function () {
3012
3012
  });
3013
3013
  case 12:
3014
3014
  _context37.t1 = _context37.sent;
3015
- authorization = [_context37.t0, _context37.t1].flat().filter(function (token) {
3015
+ queryParams.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
- });
3021
3018
  _context37.t2 = this.utils;
3022
3019
  _context37.t3 = format;
3023
- _context37.next = 19;
3020
+ _context37.next = 18;
3024
3021
  return this.FileServiceHttpClient.Request({
3025
3022
  body: body,
3026
3023
  bodyType: bodyType,
@@ -3029,12 +3026,12 @@ exports.MakeFileServiceRequest = /*#__PURE__*/function () {
3029
3026
  path: queryPath,
3030
3027
  queryParams: queryParams
3031
3028
  });
3032
- case 19:
3029
+ case 18:
3033
3030
  _context37.t4 = _context37.sent;
3034
3031
  _context37.t5 = this.FileServiceHttpClient.debug;
3035
3032
  _context37.t6 = this.FileServiceHttpClient.Log.bind(this.FileServiceHttpClient);
3036
3033
  return _context37.abrupt("return", _context37.t2.ResponseToFormat.call(_context37.t2, _context37.t3, _context37.t4, _context37.t5, _context37.t6));
3037
- case 23:
3034
+ case 22:
3038
3035
  case "end":
3039
3036
  return _context37.stop();
3040
3037
  }
@@ -4694,7 +4691,6 @@ exports.AccessInfo = /*#__PURE__*/function () {
4694
4691
  [] // Stakeholders
4695
4692
  ];
4696
4693
  }
4697
-
4698
4694
  this.Log("Retrieving access info: ".concat(objectId));
4699
4695
  _context55.next = 6;
4700
4696
  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(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
  *
@@ -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=} tenantId - ID of the tenant to use for this library
428
+ * @param {string=} tenantContractId - ID of the tenant to use for this library
429
429
  *
430
430
  * @returns {Promise<string>} - Library ID of created library
431
431
  */
@@ -657,32 +657,17 @@ 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, path, authorizationHeader;
660
+ var libraryId;
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("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:
665
+ throw Error("Delete library not supported. (".concat(libraryId, ")"));
666
+ case 2:
682
667
  case "end":
683
668
  return _context8.stop();
684
669
  }
685
- }, _callee8, this);
670
+ }, _callee8);
686
671
  }));
687
672
  return function (_x8) {
688
673
  return _ref15.apply(this, arguments);
@@ -828,7 +813,11 @@ exports.RemoveLibraryContentType = /*#__PURE__*/function () {
828
813
  *
829
814
  * meta: Metadata to use for the new object
830
815
  *
831
- * @returns {Promise<Object>} - Response containing the object ID and write token of the draft
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.
832
821
  */
833
822
  exports.CreateContentObject = /*#__PURE__*/function () {
834
823
  var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref20) {
@@ -842,143 +831,165 @@ exports.CreateContentObject = /*#__PURE__*/function () {
842
831
  ValidateObject(objectId);
843
832
  }
844
833
  this.Log("Creating content object: ".concat(libraryId, " ").concat(objectId || ""));
845
-
846
- // Look up content type, if specified
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:
847
840
  if (!options.type) {
848
- _context11.next = 26;
841
+ _context11.next = 28;
849
842
  break;
850
843
  }
851
844
  this.Log("Type specified: ".concat(options.type));
852
845
  type = options.type;
853
846
  if (!type.startsWith("hq__")) {
854
- _context11.next = 13;
847
+ _context11.next = 15;
855
848
  break;
856
849
  }
857
- _context11.next = 10;
850
+ _context11.next = 12;
858
851
  return this.ContentType({
859
852
  versionHash: type
860
853
  });
861
- case 10:
854
+ case 12:
862
855
  type = _context11.sent;
863
- _context11.next = 22;
856
+ _context11.next = 24;
864
857
  break;
865
- case 13:
858
+ case 15:
866
859
  if (!type.startsWith("iq__")) {
867
- _context11.next = 19;
860
+ _context11.next = 21;
868
861
  break;
869
862
  }
870
- _context11.next = 16;
863
+ _context11.next = 18;
871
864
  return this.ContentType({
872
865
  typeId: type
873
866
  });
874
- case 16:
867
+ case 18:
875
868
  type = _context11.sent;
876
- _context11.next = 22;
869
+ _context11.next = 24;
877
870
  break;
878
- case 19:
879
- _context11.next = 21;
871
+ case 21:
872
+ _context11.next = 23;
880
873
  return this.ContentType({
881
874
  name: type
882
875
  });
883
- case 21:
876
+ case 23:
884
877
  type = _context11.sent;
885
- case 22:
878
+ case 24:
886
879
  if (type) {
887
- _context11.next = 24;
880
+ _context11.next = 26;
888
881
  break;
889
882
  }
890
883
  throw Error("Unable to find content type '".concat(options.type, "'"));
891
- case 24:
884
+ case 26:
892
885
  typeId = type.id;
893
886
  options.type = type.hash;
894
- case 26:
887
+ case 28:
895
888
  if (objectId) {
896
- _context11.next = 44;
889
+ _context11.next = 46;
897
890
  break;
898
891
  }
899
- _context11.next = 29;
892
+ _context11.next = 31;
900
893
  return this.CurrentAccountAddress();
901
- case 29:
894
+ case 31:
902
895
  currentAccountAddress = _context11.sent;
903
- _context11.next = 32;
896
+ _context11.next = 34;
904
897
  return this.CallContractMethod({
905
898
  contractAddress: this.utils.HashToAddress(libraryId),
906
899
  methodName: "canContribute",
907
900
  methodArgs: [currentAccountAddress]
908
901
  });
909
- case 32:
902
+ case 34:
910
903
  canContribute = _context11.sent;
911
904
  if (canContribute) {
912
- _context11.next = 35;
905
+ _context11.next = 37;
913
906
  break;
914
907
  }
915
908
  throw Error("Current user does not have permission to create content in library ".concat(libraryId));
916
- case 35:
909
+ case 37:
917
910
  this.Log("Deploying contract...");
918
- _context11.next = 38;
911
+ _context11.next = 40;
919
912
  return this.authClient.CreateContentObject({
920
913
  libraryId: libraryId,
921
914
  typeId: typeId
922
915
  });
923
- case 38:
916
+ case 40:
924
917
  _yield$this$authClien3 = _context11.sent;
925
918
  contractAddress = _yield$this$authClien3.contractAddress;
926
919
  objectId = this.utils.AddressToObjectId(contractAddress);
927
920
  this.Log("Contract deployed: ".concat(contractAddress, " ").concat(objectId));
928
- _context11.next = 51;
921
+ _context11.next = 53;
929
922
  break;
930
- case 44:
923
+ case 46:
931
924
  _context11.t0 = this;
932
925
  _context11.t1 = "Contract already deployed for contract type: ";
933
- _context11.next = 48;
926
+ _context11.next = 50;
934
927
  return this.AccessType({
935
928
  id: objectId
936
929
  });
937
- case 48:
930
+ case 50:
938
931
  _context11.t2 = _context11.sent;
939
932
  _context11.t3 = _context11.t1.concat.call(_context11.t1, _context11.t2);
940
933
  _context11.t0.Log.call(_context11.t0, _context11.t3);
941
- case 51:
934
+ case 53:
942
935
  if (!options.visibility) {
943
- _context11.next = 55;
936
+ _context11.next = 57;
944
937
  break;
945
938
  }
946
939
  this.Log("Setting visibility to ".concat(options.visibility));
947
- _context11.next = 55;
940
+ _context11.next = 57;
948
941
  return this.SetVisibility({
949
942
  id: objectId,
950
943
  visibility: options.visibility
951
944
  });
952
- case 55:
945
+ case 57:
953
946
  path = UrlJoin("qid", objectId);
954
947
  _context11.t4 = this.HttpClient;
955
- _context11.next = 59;
948
+ _context11.next = 61;
956
949
  return this.authClient.AuthorizationHeader({
957
950
  libraryId: libraryId,
958
951
  objectId: objectId,
959
952
  update: true
960
953
  });
961
- case 59:
954
+ case 61:
962
955
  _context11.t5 = _context11.sent;
963
956
  _context11.t6 = path;
964
- _context11.t7 = options;
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
+ };
965
963
  _context11.t8 = {
966
964
  headers: _context11.t5,
967
965
  method: "POST",
968
966
  path: _context11.t6,
969
967
  body: _context11.t7
970
968
  };
971
- _context11.next = 65;
969
+ _context11.next = 67;
972
970
  return _context11.t4.Request.call(_context11.t4, _context11.t8);
973
- case 65:
971
+ case 67:
974
972
  rawCreateResponse = _context11.sent;
975
973
  // 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
+ // (not strictly needed now that we can quickly look up node URL for a write token,
975
+ // but still convenient)
977
976
  nodeUrl = new URL(rawCreateResponse.url).origin;
978
- _context11.next = 69;
977
+ _context11.next = 71;
979
978
  return this.utils.ResponseToJson(rawCreateResponse, this.HttpClient.debug, this.HttpClient.Log.bind(this.HttpClient));
980
- case 69:
979
+ case 71:
981
980
  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:
982
993
  // Record the node used in creating this write token
983
994
  this.RecordWriteToken({
984
995
  writeToken: createResponse.write_token,
@@ -988,7 +999,7 @@ exports.CreateContentObject = /*#__PURE__*/function () {
988
999
  createResponse.objectId = createResponse.id;
989
1000
  createResponse.nodeUrl = nodeUrl;
990
1001
  return _context11.abrupt("return", createResponse);
991
- case 75:
1002
+ case 80:
992
1003
  case "end":
993
1004
  return _context11.stop();
994
1005
  }
@@ -2303,7 +2314,7 @@ exports.UpdateContentObjectGraph = /*#__PURE__*/function () {
2303
2314
  return _context30.delegateYield(_loop(), "t0", 8);
2304
2315
  case 8:
2305
2316
  _ret = _context30.t0;
2306
- if (!(_typeof(_ret) === "object")) {
2317
+ if (!_ret) {
2307
2318
  _context30.next = 11;
2308
2319
  break;
2309
2320
  }
@@ -2451,12 +2462,12 @@ exports.CreateLinks = /*#__PURE__*/function () {
2451
2462
  return _regeneratorRuntime.wrap(function _callee31$(_context32) {
2452
2463
  while (1) switch (_context32.prev = _context32.next) {
2453
2464
  case 0:
2454
- path = info.path.replace(/^(\/|\.)+/, "");
2465
+ path = info.path.replace(/^([/.])+/, "");
2455
2466
  type = (info.type || "file") === "file" ? "files" : info.type;
2456
2467
  if (type === "metadata") {
2457
2468
  type = "meta";
2458
2469
  }
2459
- target = authTarget = info.target.replace(/^(\/|\.)+/, "");
2470
+ target = authTarget = info.target.replace(/^([/.])+/, "");
2460
2471
  if (info.targetHash) {
2461
2472
  target = "/qfab/".concat(info.targetHash, "/").concat(type, "/").concat(target);
2462
2473
  } else {
@@ -2637,38 +2648,43 @@ exports.SetAuthPolicy = /*#__PURE__*/function () {
2637
2648
  *
2638
2649
  * @namedParams
2639
2650
  * @param {string} writeToken - Write token to delete
2640
- * @param {string} libraryId - ID of the library
2641
2651
  */
2642
2652
  exports.DeleteWriteToken = /*#__PURE__*/function () {
2643
2653
  var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(_ref64) {
2644
- var writeToken, libraryId, path, authorizationHeader;
2654
+ var writeToken, objectId, libraryId, path, authorizationHeader;
2645
2655
  return _regeneratorRuntime.wrap(function _callee35$(_context36) {
2646
2656
  while (1) switch (_context36.prev = _context36.next) {
2647
2657
  case 0:
2648
- writeToken = _ref64.writeToken, libraryId = _ref64.libraryId;
2658
+ writeToken = _ref64.writeToken;
2649
2659
  ValidateWriteToken(writeToken);
2650
- ValidateLibrary(libraryId);
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;
2651
2667
  path = UrlJoin("qlibs", libraryId, "q", writeToken);
2652
- _context36.next = 6;
2668
+ _context36.next = 9;
2653
2669
  return this.authClient.AuthorizationHeader({
2654
- libraryId: libraryId,
2670
+ objectId: objectId,
2655
2671
  update: true
2656
2672
  });
2657
- case 6:
2673
+ case 9:
2658
2674
  authorizationHeader = _context36.sent;
2659
- _context36.next = 9;
2675
+ _context36.next = 12;
2660
2676
  return this.HttpClient.Request({
2661
2677
  headers: authorizationHeader,
2662
2678
  method: "DELETE",
2663
2679
  path: path,
2664
2680
  allowFailover: false
2665
2681
  });
2666
- case 9:
2667
- _context36.next = 11;
2682
+ case 12:
2683
+ _context36.next = 14;
2668
2684
  return this.HttpClient.ClearWriteToken({
2669
2685
  writeToken: writeToken
2670
2686
  });
2671
- case 11:
2687
+ case 14:
2672
2688
  case "end":
2673
2689
  return _context36.stop();
2674
2690
  }
@@ -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
  *
@@ -1,8 +1,9 @@
1
+ var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
1
2
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
3
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
3
4
  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; }
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; }
6
7
  /* eslint no-console: 0 */
7
8
 
8
9
  var DefaultABRLadder = {
@@ -109,7 +110,7 @@ var LiveConf = /*#__PURE__*/function () {
109
110
  this.overwriteOriginUrl = overwriteOriginUrl;
110
111
  this.syncAudioToVideo = syncAudioToVideo;
111
112
  }
112
- _createClass(LiveConf, [{
113
+ return _createClass(LiveConf, [{
113
114
  key: "probeKind",
114
115
  value: function probeKind() {
115
116
  var fileNameSplit = this.probeData.format.filename.split(":");
@@ -133,14 +134,17 @@ var LiveConf = /*#__PURE__*/function () {
133
134
  key: "getAudioStreamsFromProbe",
134
135
  value: function getAudioStreamsFromProbe() {
135
136
  var audioStreams = {};
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
- }
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
+ };
144
148
  }
145
149
  return audioStreams;
146
150
  }
@@ -224,7 +228,6 @@ var LiveConf = /*#__PURE__*/function () {
224
228
  } else {
225
229
  seg.audio = 29.76 * 48000; // Other codecs are resampled @48000
226
230
  }
227
-
228
231
  return seg;
229
232
  }
230
233
 
@@ -398,7 +401,7 @@ var LiveConf = /*#__PURE__*/function () {
398
401
  recordingChannels: audio.recording_channels || 2
399
402
  };
400
403
  if (audio.playout) {
401
- audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(audioIdx);
404
+ audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(i + 1);
402
405
  }
403
406
  }
404
407
  }
@@ -447,18 +450,6 @@ var LiveConf = /*#__PURE__*/function () {
447
450
  if (this.syncAudioToVideo) {
448
451
  conf.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id = this.syncAudioToStreamIdValue();
449
452
  }
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
- }
462
453
 
463
454
  // Fill in specifics for protocol
464
455
  switch (this.probeKind()) {
@@ -561,9 +552,35 @@ var LiveConf = /*#__PURE__*/function () {
561
552
  // Global recording bitrate for all audio streams
562
553
  conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = globalAudioBitrate;
563
554
  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
+ }
564
582
  return conf;
565
583
  }
566
584
  }]);
567
- return LiveConf;
568
585
  }();
569
586
  exports.LiveConf = LiveConf;