@eluvio/elv-client-js 4.0.101 → 4.0.103

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 +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 +74 -67
  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 +2 -1
  16. package/dist/src/Id.js +2 -1
  17. package/dist/src/PermissionsClient.js +19 -31
  18. package/dist/src/RemoteSigner.js +8 -6
  19. package/dist/src/UserProfileClient.js +19 -35
  20. package/dist/src/Utils.js +3 -2
  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 +620 -548
  24. package/dist/src/client/ContentManagement.js +3 -3
  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 +5 -3
  28. package/dist/src/client/LiveStream.js +2 -0
  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 +14 -17
  34. package/package.json +1 -1
  35. package/src/ElvClient.js +43 -14
  36. package/src/FrameClient.js +1 -0
  37. package/src/RemoteSigner.js +3 -2
  38. package/src/client/ContentAccess.js +55 -1
  39. package/src/walletClient/index.js +1 -1
  40. package/testScripts/Test.js +1 -9
@@ -5,8 +5,8 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
5
5
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
6
6
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
7
7
  var _createClass = require("@babel/runtime/helpers/createClass");
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ 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; }
9
+ 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; }
10
10
  if (typeof globalThis.Buffer === "undefined") {
11
11
  globalThis.Buffer = require("buffer/").Buffer;
12
12
  }
@@ -65,6 +65,7 @@ var ElvClient = /*#__PURE__*/function () {
65
65
  * @param {Array<string>} fabricURIs - A list of full URIs to content fabric nodes
66
66
  * @param {Array<string>} ethereumURIs - A list of full URIs to ethereum nodes
67
67
  * @param {Array<string>} authServiceURIs - A list of full URIs to auth service endpoints
68
+ * @param {Array<string>} fileServiceURIs - A list of full URIs to file service endpoints
68
69
  * @param {Array<string>=} searchURIs - A list of full URIs to search service endpoints
69
70
  * @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
70
71
  * @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
@@ -85,6 +86,7 @@ var ElvClient = /*#__PURE__*/function () {
85
86
  fabricURIs = _ref.fabricURIs,
86
87
  ethereumURIs = _ref.ethereumURIs,
87
88
  authServiceURIs = _ref.authServiceURIs,
89
+ fileServiceURIs = _ref.fileServiceURIs,
88
90
  searchURIs = _ref.searchURIs,
89
91
  _ref$ethereumContract = _ref.ethereumContractTimeout,
90
92
  ethereumContractTimeout = _ref$ethereumContract === void 0 ? 10 : _ref$ethereumContract,
@@ -110,6 +112,7 @@ var ElvClient = /*#__PURE__*/function () {
110
112
  this.fabricVersion = fabricVersion;
111
113
  this.fabricURIs = fabricURIs;
112
114
  this.authServiceURIs = authServiceURIs;
115
+ this.fileServiceURIs = fileServiceURIs || fabricURIs;
113
116
  this.ethereumURIs = ethereumURIs;
114
117
  this.searchURIs = searchURIs;
115
118
  this.ethereumContractTimeout = ethereumContractTimeout;
@@ -139,7 +142,7 @@ var ElvClient = /*#__PURE__*/function () {
139
142
  * @param {string=} clientIP - IP address to use in determining the region to use
140
143
  * @return {Promise<Object>} - Object containing content space ID and fabric and ethereum URLs
141
144
  */
142
- return _createClass(ElvClient, [{
145
+ _createClass(ElvClient, [{
143
146
  key: "Log",
144
147
  value: function Log(message) {
145
148
  var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -168,9 +171,9 @@ var ElvClient = /*#__PURE__*/function () {
168
171
  reporter.debugOptions = options;
169
172
  }
170
173
  };
171
- [this, this.authClient, this.ethClient, this.HttpClient, this.userProfileClient].forEach(setDebug);
174
+ [this, this.authClient, this.ethClient, this.HttpClient, this.AuthHttpClient, this.FileServiceHttpClient, this.SearchHttpClient, this.userProfileClient].forEach(setDebug);
172
175
  if (enable) {
173
- this.Log("Debug Logging Enabled:\n Content Space: ".concat(this.contentSpaceId, "\n Fabric URLs: [\n\t\t").concat(this.fabricURIs.join(", \n\t\t"), "\n\t]\n Ethereum URLs: [\n\t\t").concat(this.ethereumURIs.join(", \n\t\t"), "\n\t]\n Auth Service URLs: [\n\t\t").concat(this.authServiceURIs.join(", \n\t\t"), "\n\t]\n "));
176
+ this.Log("Debug Logging Enabled:\n Content Space: ".concat(this.contentSpaceId, "\n Fabric URLs: [\n\t\t").concat(this.fabricURIs.join(", \n\t\t"), "\n\t]\n Ethereum URLs: [\n\t\t").concat(this.ethereumURIs.join(", \n\t\t"), "\n\t]\n Auth Service URLs: [\\n\\t\\t").concat(this.authServiceURIs.join(", \n\t\t"), "\\n\\t]\n File Service URLs: [\\n\\t\\t").concat(this.fileServiceURIs.join(", \n\t\t"), "\\n\\t]\n "));
174
177
  }
175
178
  }
176
179
  }, {
@@ -257,6 +260,10 @@ var ElvClient = /*#__PURE__*/function () {
257
260
  uris: this.authServiceURIs,
258
261
  debug: this.debug
259
262
  });
263
+ this.FileServiceHttpClient = new HttpClient({
264
+ uris: this.fileServiceURIs,
265
+ debug: this.debug
266
+ });
260
267
  this.SearchHttpClient = new HttpClient({
261
268
  uris: this.searchURIs || [],
262
269
  debug: this.debug
@@ -297,7 +304,7 @@ var ElvClient = /*#__PURE__*/function () {
297
304
  // Initialize crypto wasm
298
305
  this.Crypto = Crypto;
299
306
  this.Crypto.ElvCrypto();
300
- case 19:
307
+ case 20:
301
308
  case "end":
302
309
  return _context2.stop();
303
310
  }
@@ -334,9 +341,9 @@ var ElvClient = /*#__PURE__*/function () {
334
341
  */
335
342
  }, {
336
343
  key: "UseRegion",
337
- value: (function () {
344
+ value: function () {
338
345
  var _UseRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
339
- var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs, searchURIs;
346
+ var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs;
340
347
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
341
348
  while (1) switch (_context3.prev = _context3.next) {
342
349
  case 0:
@@ -357,22 +364,24 @@ var ElvClient = /*#__PURE__*/function () {
357
364
  fabricURIs = _yield$ElvClient$Conf.fabricURIs;
358
365
  ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
359
366
  authServiceURIs = _yield$ElvClient$Conf.authServiceURIs;
367
+ fileServiceURIs = _yield$ElvClient$Conf.fileServiceURIs;
360
368
  searchURIs = _yield$ElvClient$Conf.searchURIs;
361
369
  this.region = region;
362
- this.authServiceURIs = authServiceURIs;
363
- this.fabricURIs = fabricURIs;
364
- this.ethereumURIs = ethereumURIs;
365
- this.searchURIs = searchURIs;
366
- this.HttpClient.uris = fabricURIs;
367
- this.HttpClient.uriIndex = 0;
368
- this.ethClient.ethereumURIs = ethereumURIs;
369
- this.ethClient.ethereumURIIndex = 0;
370
+ this.SetNodes({
371
+ fabricURIs: fabricURIs,
372
+ ethereumURIs: ethereumURIs,
373
+ authServiceURIs: authServiceURIs,
374
+ fileServiceURIs: fileServiceURIs,
375
+ searchURIs: searchURIs
376
+ });
370
377
  return _context3.abrupt("return", {
371
378
  fabricURIs: fabricURIs,
372
379
  ethereumURIs: ethereumURIs,
380
+ fileServiceURIs: fileServiceURIs,
381
+ authServiceURIs: authServiceURIs,
373
382
  searchURIs: searchURIs
374
383
  });
375
- case 20:
384
+ case 14:
376
385
  case "end":
377
386
  return _context3.stop();
378
387
  }
@@ -392,10 +401,9 @@ var ElvClient = /*#__PURE__*/function () {
392
401
  *
393
402
  * @return {Promise<Object>} - An object containing the updated fabric and ethereum URLs in order of preference
394
403
  */
395
- )
396
404
  }, {
397
405
  key: "ResetRegion",
398
- value: (function () {
406
+ value: function () {
399
407
  var _ResetRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
400
408
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
401
409
  while (1) switch (_context4.prev = _context4.next) {
@@ -435,10 +443,9 @@ var ElvClient = /*#__PURE__*/function () {
435
443
  *
436
444
  * @return {Promise<string>} - The node ID reported by the fabric
437
445
  */
438
- )
439
446
  }, {
440
447
  key: "NodeId",
441
- value: (function () {
448
+ value: function () {
442
449
  var _NodeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
443
450
  var region, _yield$ElvClient$Conf2, nodeId;
444
451
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -472,7 +479,6 @@ var ElvClient = /*#__PURE__*/function () {
472
479
  *
473
480
  * @return {Promise<Object>} - An object containing the lists of fabric, ethereum, auth service, and search urls in use by the client
474
481
  */
475
- )
476
482
  }, {
477
483
  key: "Nodes",
478
484
  value: function Nodes() {
@@ -480,6 +486,7 @@ var ElvClient = /*#__PURE__*/function () {
480
486
  fabricURIs: this.fabricURIs,
481
487
  ethereumURIs: this.ethereumURIs,
482
488
  authServiceURIs: this.authServiceURIs,
489
+ fileServiceURIs: this.fileServiceURIs,
483
490
  searchURIs: this.searchURIs
484
491
  };
485
492
  }
@@ -491,6 +498,7 @@ var ElvClient = /*#__PURE__*/function () {
491
498
  * @param {Array<string>=} fabricURIs - A list of URLs for the fabric, in preference order
492
499
  * @param {Array<string>=} ethereumURIs - A list of URLs for the blockchain, in preference order
493
500
  * @param {Array<string>=} authServiceURIs - A list of URLs for the auth service, in preference order
501
+ * @param {Array<string>=} fileServiceURIs - A list of URLs for file service jobs, in preference order
494
502
  * @param {Array<string>=} searchURIs - A list of URLs for the search nodes, in preference order
495
503
  *
496
504
  * @methodGroup Nodes
@@ -501,6 +509,7 @@ var ElvClient = /*#__PURE__*/function () {
501
509
  var fabricURIs = _ref6.fabricURIs,
502
510
  ethereumURIs = _ref6.ethereumURIs,
503
511
  authServiceURIs = _ref6.authServiceURIs,
512
+ fileServiceURIs = _ref6.fileServiceURIs,
504
513
  searchURIs = _ref6.searchURIs;
505
514
  if (fabricURIs) {
506
515
  this.fabricURIs = fabricURIs;
@@ -517,8 +526,15 @@ var ElvClient = /*#__PURE__*/function () {
517
526
  this.AuthHttpClient.uris = authServiceURIs;
518
527
  this.AuthHttpClient.uriIndex = 0;
519
528
  }
529
+ if (fileServiceURIs) {
530
+ this.fileServiceURIs = fileServiceURIs;
531
+ this.FileServiceHttpClient.uris = fileServiceURIs;
532
+ this.FileServiceHttpClient.uriIndex = 0;
533
+ }
520
534
  if (searchURIs) {
521
535
  this.searchURIs = searchURIs;
536
+ this.SearchHttpClient.uris = searchURIs;
537
+ this.SearchHttpClient.uriIndex = 0;
522
538
  }
523
539
  }
524
540
 
@@ -534,7 +550,7 @@ var ElvClient = /*#__PURE__*/function () {
534
550
  */
535
551
  }, {
536
552
  key: "SpaceNodes",
537
- value: (function () {
553
+ value: function () {
538
554
  var _SpaceNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
539
555
  var _this = this;
540
556
  var _ref7,
@@ -621,7 +637,6 @@ var ElvClient = /*#__PURE__*/function () {
621
637
  * @methodGroup Nodes
622
638
  * @returns {Object} - The name, ID and configuration URL of the network
623
639
  */
624
- )
625
640
  }, {
626
641
  key: "NetworkInfo",
627
642
  value: function NetworkInfo() {
@@ -719,7 +734,7 @@ var ElvClient = /*#__PURE__*/function () {
719
734
  */
720
735
  }, {
721
736
  key: "SetRemoteSigner",
722
- value: (function () {
737
+ value: function () {
723
738
  var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref11) {
724
739
  var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer;
725
740
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
@@ -774,10 +789,9 @@ var ElvClient = /*#__PURE__*/function () {
774
789
  * @namedParams
775
790
  * @param {object} provider - The web3 provider object
776
791
  */
777
- )
778
792
  }, {
779
793
  key: "SetSignerFromWeb3Provider",
780
- value: (function () {
794
+ value: function () {
781
795
  var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
782
796
  var provider, ethProvider;
783
797
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
@@ -820,10 +834,9 @@ var ElvClient = /*#__PURE__*/function () {
820
834
  *
821
835
  * @return {string} - The address of the user
822
836
  */
823
- )
824
837
  }, {
825
838
  key: "CreateAccount",
826
- value: (function () {
839
+ value: function () {
827
840
  var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
828
841
  var tenantId, fundingToken, _ref13$funds, funds, groupToken, wallet, signer;
829
842
  return _regeneratorRuntime.wrap(function _callee9$(_context9) {
@@ -898,10 +911,9 @@ var ElvClient = /*#__PURE__*/function () {
898
911
  PAYLOAD 85b json-compressed
899
912
  json 79b {"adr":"VVf4DQU357tDnZGYQeDrntRJ5rs=","spc":"ispc3ANoVSzNA3P6t7abLR69ho5YPPZU"}
900
913
  */
901
- )
902
914
  }, {
903
915
  key: "PersonalSign",
904
- value: (function () {
916
+ value: function () {
905
917
  var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref14) {
906
918
  var _this2 = this;
907
919
  var message, addEthereumPrefix, Sign;
@@ -956,10 +968,9 @@ var ElvClient = /*#__PURE__*/function () {
956
968
  * @param {function=} Sign - If specified, this function will be used to produce the signature instead of the client's current signer
957
969
  * @param {boolean=} addEthereumPrefix=true - If specified, the 'Ethereum Signed Message' prefixed hash format will be performed. Disable this if the provided Sign method already does this (e.g. Metamask)
958
970
  */
959
- )
960
971
  }, {
961
972
  key: "CreateFabricToken",
962
- value: (function () {
973
+ value: function () {
963
974
  var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
964
975
  var _ref16,
965
976
  _ref16$duration,
@@ -1041,10 +1052,9 @@ var ElvClient = /*#__PURE__*/function () {
1041
1052
  * enabling the user of this token to download encrypted content from the specified object
1042
1053
  * @param {Object=} context - Additional JSON context
1043
1054
  */
1044
- )
1045
1055
  }, {
1046
1056
  key: "CreateSignedToken",
1047
- value: (function () {
1057
+ value: function () {
1048
1058
  var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
1049
1059
  var libraryId, objectId, versionHash, policyId, subject, _ref17$grantType, grantType, _ref17$allowDecryptio, allowDecryption, duration, _ref17$context, context, token, cap, compressedToken, signature;
1050
1060
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
@@ -1157,10 +1167,9 @@ var ElvClient = /*#__PURE__*/function () {
1157
1167
  * @namedParams
1158
1168
  * @param {string} messasge - A JSON object representing the message to sign
1159
1169
  */
1160
- )
1161
1170
  }, {
1162
1171
  key: "CreateSignedMessageJSON",
1163
- value: (function () {
1172
+ value: function () {
1164
1173
  var _CreateSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
1165
1174
  var message, type, msg, signature;
1166
1175
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
@@ -1197,10 +1206,9 @@ var ElvClient = /*#__PURE__*/function () {
1197
1206
  * @param {string} signedMessage - a signed message as created by CreateSignedMessageJSON
1198
1207
  * @returns {Promise<Object>} - The decoded message, signer address, signature and signature type
1199
1208
  */
1200
- )
1201
1209
  }, {
1202
1210
  key: "DecodeSignedMessageJSON",
1203
- value: (function () {
1211
+ value: function () {
1204
1212
  var _DecodeSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
1205
1213
  var signedMessage, type, msgBytes, signature, msg, obj, prefixedMsgHash, signerAddr;
1206
1214
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
@@ -1243,7 +1251,6 @@ var ElvClient = /*#__PURE__*/function () {
1243
1251
  * @methodGroup Signers
1244
1252
  * @returns {string} - The address of the current signer
1245
1253
  */
1246
- )
1247
1254
  }, {
1248
1255
  key: "CurrentAccountAddress",
1249
1256
  value: function CurrentAccountAddress() {
@@ -1259,7 +1266,7 @@ var ElvClient = /*#__PURE__*/function () {
1259
1266
  */
1260
1267
  }, {
1261
1268
  key: "SetOauthToken",
1262
- value: (function () {
1269
+ value: function () {
1263
1270
  var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
1264
1271
  var token, wallet, signer;
1265
1272
  return _regeneratorRuntime.wrap(function _callee16$(_context16) {
@@ -1295,10 +1302,9 @@ var ElvClient = /*#__PURE__*/function () {
1295
1302
  * @namedParams
1296
1303
  * @param {string} token - The OAuth ID
1297
1304
  */
1298
- )
1299
1305
  }, {
1300
1306
  key: "SetSignerFromOauthToken",
1301
- value: (function () {
1307
+ value: function () {
1302
1308
  var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref21) {
1303
1309
  var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
1304
1310
  return _regeneratorRuntime.wrap(function _callee17$(_context17) {
@@ -1400,7 +1406,6 @@ var ElvClient = /*#__PURE__*/function () {
1400
1406
  * @namedParams
1401
1407
  * @param {string=} token - The static token to use. If not provided, the default static token will be set.
1402
1408
  */
1403
- )
1404
1409
  }, {
1405
1410
  key: "SetStaticToken",
1406
1411
  value: function SetStaticToken() {
@@ -1434,7 +1439,7 @@ var ElvClient = /*#__PURE__*/function () {
1434
1439
  */
1435
1440
  }, {
1436
1441
  key: "SetPolicyAuthorization",
1437
- value: (function () {
1442
+ value: function () {
1438
1443
  var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref23) {
1439
1444
  var objectId;
1440
1445
  return _regeneratorRuntime.wrap(function _callee18$(_context18) {
@@ -1469,10 +1474,9 @@ var ElvClient = /*#__PURE__*/function () {
1469
1474
  * @param {string} string - The string to sign
1470
1475
  * @return {Promise<string>} - The signed string
1471
1476
  */
1472
- )
1473
1477
  }, {
1474
1478
  key: "Sign",
1475
- value: (function () {
1479
+ value: function () {
1476
1480
  var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(string) {
1477
1481
  var signature;
1478
1482
  return _regeneratorRuntime.wrap(function _callee19$(_context19) {
@@ -1503,10 +1507,9 @@ var ElvClient = /*#__PURE__*/function () {
1503
1507
  *
1504
1508
  * @return {Promise<string>} - The encrypted message
1505
1509
  */
1506
- )
1507
1510
  }, {
1508
1511
  key: "EncryptECIES",
1509
- value: (function () {
1512
+ value: function () {
1510
1513
  var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref24) {
1511
1514
  var message, publicKey;
1512
1515
  return _regeneratorRuntime.wrap(function _callee20$(_context20) {
@@ -1543,10 +1546,9 @@ var ElvClient = /*#__PURE__*/function () {
1543
1546
  *
1544
1547
  * @return {Promise<string | Object>} - The decrypted string or object
1545
1548
  */
1546
- )
1547
1549
  }, {
1548
1550
  key: "DecryptECIES",
1549
- value: (function () {
1551
+ value: function () {
1550
1552
  var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref25) {
1551
1553
  var message;
1552
1554
  return _regeneratorRuntime.wrap(function _callee21$(_context21) {
@@ -1586,10 +1588,9 @@ var ElvClient = /*#__PURE__*/function () {
1586
1588
  *
1587
1589
  * @return {Promise<*>} - Response in the specified format
1588
1590
  */
1589
- )
1590
1591
  }, {
1591
1592
  key: "Request",
1592
- value: (function () {
1593
+ value: function () {
1593
1594
  var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref26) {
1594
1595
  var url, _ref26$format, format, _ref26$method, method, _ref26$headers, headers, body;
1595
1596
  return _regeneratorRuntime.wrap(function _callee22$(_context22) {
@@ -1611,7 +1612,7 @@ var ElvClient = /*#__PURE__*/function () {
1611
1612
  return _Request.apply(this, arguments);
1612
1613
  }
1613
1614
  return Request;
1614
- }())
1615
+ }()
1615
1616
  }, {
1616
1617
  key: "MakeAuthServiceRequest",
1617
1618
  value: function () {
@@ -1768,9 +1769,9 @@ var ElvClient = /*#__PURE__*/function () {
1768
1769
  }()
1769
1770
  }], [{
1770
1771
  key: "Configuration",
1771
- value: (function () {
1772
+ value: function () {
1772
1773
  var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref28) {
1773
- var configUrl, _ref28$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1774
+ var configUrl, _ref28$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion;
1774
1775
  return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1775
1776
  while (1) switch (_context25.prev = _context25.next) {
1776
1777
  case 0:
@@ -1804,6 +1805,10 @@ var ElvClient = /*#__PURE__*/function () {
1804
1805
  if (authServiceURIs.find(filterHTTPS)) {
1805
1806
  authServiceURIs = authServiceURIs.filter(filterHTTPS);
1806
1807
  }
1808
+ fileServiceURIs = fabricInfo.network.services.file_service || fabricURIs;
1809
+ if (fileServiceURIs.find(filterHTTPS)) {
1810
+ fileServiceURIs = fileServiceURIs.filter(filterHTTPS);
1811
+ }
1807
1812
  searchURIs = fabricInfo.network.services.search || [];
1808
1813
  fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1809
1814
  return _context25.abrupt("return", {
@@ -1814,23 +1819,24 @@ var ElvClient = /*#__PURE__*/function () {
1814
1819
  fabricURIs: fabricURIs,
1815
1820
  ethereumURIs: ethereumURIs,
1816
1821
  authServiceURIs: authServiceURIs,
1822
+ fileServiceURIs: fileServiceURIs,
1817
1823
  kmsURIs: kmsUrls,
1818
1824
  searchURIs: searchURIs,
1819
1825
  fabricVersion: fabricVersion
1820
1826
  });
1821
- case 21:
1822
- _context25.prev = 21;
1827
+ case 23:
1828
+ _context25.prev = 23;
1823
1829
  _context25.t0 = _context25["catch"](1);
1824
1830
  // eslint-disable-next-line no-console
1825
1831
  console.error("Error retrieving fabric configuration:");
1826
1832
  // eslint-disable-next-line no-console
1827
1833
  console.error(_context25.t0);
1828
1834
  throw _context25.t0;
1829
- case 26:
1835
+ case 28:
1830
1836
  case "end":
1831
1837
  return _context25.stop();
1832
1838
  }
1833
- }, _callee25, null, [[1, 21]]);
1839
+ }, _callee25, null, [[1, 23]]);
1834
1840
  }));
1835
1841
  function Configuration(_x21) {
1836
1842
  return _Configuration.apply(this, arguments);
@@ -1844,7 +1850,6 @@ var ElvClient = /*#__PURE__*/function () {
1844
1850
  *
1845
1851
  * @return {Object} - An object using network names as keys and configuration URLs as values.
1846
1852
  */
1847
- )
1848
1853
  }, {
1849
1854
  key: "Networks",
1850
1855
  value: function Networks() {
@@ -1869,7 +1874,7 @@ var ElvClient = /*#__PURE__*/function () {
1869
1874
  */
1870
1875
  }, {
1871
1876
  key: "FromNetworkName",
1872
- value: (function () {
1877
+ value: function () {
1873
1878
  var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref29) {
1874
1879
  var networkName, region, clientIP, trustAuthorityId, staticToken, _ref29$ethereumContra, ethereumContractTimeout, _ref29$noCache, noCache, _ref29$noAuth, noAuth, assumeV3, configUrl;
1875
1880
  return _regeneratorRuntime.wrap(function _callee26$(_context26) {
@@ -1924,12 +1929,11 @@ var ElvClient = /*#__PURE__*/function () {
1924
1929
  *
1925
1930
  * @return {Promise<ElvClient>} - New ElvClient connected to the specified content fabric and blockchain
1926
1931
  */
1927
- )
1928
1932
  }, {
1929
1933
  key: "FromConfigurationUrl",
1930
- value: (function () {
1934
+ value: function () {
1931
1935
  var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref30) {
1932
- var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, _ref30$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1936
+ var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, _ref30$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion, client;
1933
1937
  return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1934
1938
  while (1) switch (_context27.prev = _context27.next) {
1935
1939
  case 0:
@@ -1948,6 +1952,7 @@ var ElvClient = /*#__PURE__*/function () {
1948
1952
  fabricURIs = _yield$ElvClient$Conf3.fabricURIs;
1949
1953
  ethereumURIs = _yield$ElvClient$Conf3.ethereumURIs;
1950
1954
  authServiceURIs = _yield$ElvClient$Conf3.authServiceURIs;
1955
+ fileServiceURIs = _yield$ElvClient$Conf3.fileServiceURIs;
1951
1956
  searchURIs = _yield$ElvClient$Conf3.searchURIs;
1952
1957
  fabricVersion = _yield$ElvClient$Conf3.fabricVersion;
1953
1958
  client = new ElvClient({
@@ -1958,6 +1963,7 @@ var ElvClient = /*#__PURE__*/function () {
1958
1963
  fabricURIs: fabricURIs,
1959
1964
  ethereumURIs: ethereumURIs,
1960
1965
  authServiceURIs: authServiceURIs,
1966
+ fileServiceURIs: fileServiceURIs,
1961
1967
  searchURIs: searchURIs,
1962
1968
  ethereumContractTimeout: ethereumContractTimeout,
1963
1969
  trustAuthorityId: trustAuthorityId,
@@ -1970,7 +1976,7 @@ var ElvClient = /*#__PURE__*/function () {
1970
1976
  client.region = region;
1971
1977
  client.clientIP = clientIP;
1972
1978
  return _context27.abrupt("return", client);
1973
- case 17:
1979
+ case 18:
1974
1980
  case "end":
1975
1981
  return _context27.stop();
1976
1982
  }
@@ -1980,8 +1986,9 @@ var ElvClient = /*#__PURE__*/function () {
1980
1986
  return _FromConfigurationUrl.apply(this, arguments);
1981
1987
  }
1982
1988
  return FromConfigurationUrl;
1983
- }())
1989
+ }()
1984
1990
  }]);
1991
+ return ElvClient;
1985
1992
  }();
1986
1993
  Object.assign(ElvClient.prototype, require("./client/AccessGroups"));
1987
1994
  Object.assign(ElvClient.prototype, require("./client/ContentAccess"));
@@ -25,7 +25,7 @@ var ElvWallet = /*#__PURE__*/function () {
25
25
  *
26
26
  * @returns {string} - Space-separated list of random words
27
27
  */
28
- return _createClass(ElvWallet, [{
28
+ _createClass(ElvWallet, [{
29
29
  key: "GenerateMnemonic",
30
30
  value: function GenerateMnemonic() {
31
31
  return Ethers.Wallet.createRandom().mnemonic.phrase;
@@ -64,7 +64,7 @@ var ElvWallet = /*#__PURE__*/function () {
64
64
  */
65
65
  }, {
66
66
  key: "AddAccountFromEncryptedPK",
67
- value: (function () {
67
+ value: function () {
68
68
  var _AddAccountFromEncryptedPK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
69
69
  var accountName, encryptedPrivateKey, password, signer;
70
70
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -102,7 +102,6 @@ var ElvWallet = /*#__PURE__*/function () {
102
102
  *
103
103
  * @returns {Signer} - Signer with the private key, connected to the provider
104
104
  */
105
- )
106
105
  }, {
107
106
  key: "AddAccount",
108
107
  value: function AddAccount(_ref3) {
@@ -134,7 +133,7 @@ var ElvWallet = /*#__PURE__*/function () {
134
133
  */
135
134
  }, {
136
135
  key: "GetAccountBalance",
137
- value: (function () {
136
+ value: function () {
138
137
  var _GetAccountBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4) {
139
138
  var accountName, signer, accountSigner;
140
139
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
@@ -181,10 +180,9 @@ var ElvWallet = /*#__PURE__*/function () {
181
180
  *
182
181
  * @returns {Promise<string>} - The encrypted private key (in Ethereum keystore format)
183
182
  */
184
- )
185
183
  }, {
186
184
  key: "GenerateEncryptedPrivateKey",
187
- value: (function () {
185
+ value: function () {
188
186
  var _GenerateEncryptedPrivateKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
189
187
  var accountName, signer, password, options, accountSigner;
190
188
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -222,7 +220,6 @@ var ElvWallet = /*#__PURE__*/function () {
222
220
  * @param {string} accountName - Name of the account
223
221
  * @returns {(Signer|undefined)} - Signer of the saved account, if it exists
224
222
  */
225
- )
226
223
  }, {
227
224
  key: "GetAccount",
228
225
  value: function GetAccount(_ref6) {
@@ -243,5 +240,6 @@ var ElvWallet = /*#__PURE__*/function () {
243
240
  delete this.signers[accountName];
244
241
  }
245
242
  }]);
243
+ return ElvWallet;
246
244
  }();
247
245
  module.exports = ElvWallet;
@@ -5,11 +5,11 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
5
5
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
6
6
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
7
7
  var _createClass = require("@babel/runtime/helpers/createClass");
8
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
9
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
- 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; }
12
- 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
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ 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; }
12
+ 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; }
13
13
  // NOTE: Querying Ethereum requires CORS enabled
14
14
  // Use --rpccorsdomain "http[s]://hostname:port" or set up proxy
15
15
  var Ethers = require("ethers");
@@ -57,7 +57,7 @@ var EthClient = /*#__PURE__*/function () {
57
57
 
58
58
  //Ethers.errors.setLogLevel("error");
59
59
  }
60
- return _createClass(EthClient, [{
60
+ _createClass(EthClient, [{
61
61
  key: "Log",
62
62
  value: function Log(message) {
63
63
  var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -701,7 +701,7 @@ var EthClient = /*#__PURE__*/function () {
701
701
  }() /* Specific contract management */
702
702
  }, {
703
703
  key: "DeployAccessGroupContract",
704
- value: (function () {
704
+ value: function () {
705
705
  var _DeployAccessGroupContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
706
706
  var contentSpaceAddress;
707
707
  return _regeneratorRuntime.wrap(function _callee10$(_context10) {
@@ -725,7 +725,7 @@ var EthClient = /*#__PURE__*/function () {
725
725
  return _DeployAccessGroupContract.apply(this, arguments);
726
726
  }
727
727
  return DeployAccessGroupContract;
728
- }())
728
+ }()
729
729
  }, {
730
730
  key: "DeployTypeContract",
731
731
  value: function () {
@@ -1149,5 +1149,6 @@ var EthClient = /*#__PURE__*/function () {
1149
1149
  return Events;
1150
1150
  }()
1151
1151
  }]);
1152
+ return EthClient;
1152
1153
  }();
1153
1154
  module.exports = EthClient;