@eluvio/elv-client-js 4.0.24 → 4.0.25

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.
@@ -256,6 +256,10 @@ var ElvClient = /*#__PURE__*/function () {
256
256
  uris: this.authServiceURIs,
257
257
  debug: this.debug
258
258
  });
259
+ this.SearchHttpClient = new HttpClient({
260
+ uris: this.searchURIs || [],
261
+ debug: this.debug
262
+ });
259
263
  this.ethClient = new EthClient({
260
264
  client: this,
261
265
  uris: this.ethereumURIs,
@@ -292,7 +296,7 @@ var ElvClient = /*#__PURE__*/function () {
292
296
  // Initialize crypto wasm
293
297
  this.Crypto = Crypto;
294
298
  this.Crypto.ElvCrypto();
295
- case 18:
299
+ case 19:
296
300
  case "end":
297
301
  return _context2.stop();
298
302
  }
@@ -2835,11 +2835,13 @@ exports.CallBitcodeMethod = /*#__PURE__*/function () {
2835
2835
  * @param {string=} versionHash - Hash of the object version - if not specified, latest version will be used
2836
2836
  * @param {string} rep - Representation to use
2837
2837
  * @param {Object=} queryParams - Query params to add to the URL
2838
+ * @param {string=} service=fabric - The service to use. By default, will use a fabric node. Options: "fabric", "search", "auth"
2838
2839
  * @param {boolean=} channelAuth=false - If specified, state channel authorization will be performed instead of access request authorization
2839
2840
  * @param {boolean=} noAuth=false - If specified, authorization will not be performed and the URL will not have an authorization
2840
2841
  * token. This is useful for accessing public assets.
2841
2842
  * @param {boolean=} noCache=false - If specified, a new access request will be made for the authorization regardless of
2842
2843
  * whether such a request exists in the client cache. This request will not be cached. This option has no effect if noAuth is true.
2844
+ * @param {boolean=} makeAccessRequest=false - If using auth, will make a full access request
2843
2845
  *
2844
2846
  * @see <a href="#FabricUrl">FabricUrl</a> for creating arbitrary fabric URLs
2845
2847
  *
@@ -2847,11 +2849,11 @@ exports.CallBitcodeMethod = /*#__PURE__*/function () {
2847
2849
  */
2848
2850
  exports.Rep = /*#__PURE__*/function () {
2849
2851
  var _ref63 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(_ref62) {
2850
- var libraryId, objectId, versionHash, rep, _ref62$queryParams, queryParams, _ref62$channelAuth, channelAuth, _ref62$noAuth, noAuth, _ref62$noCache, noCache;
2852
+ var libraryId, objectId, versionHash, rep, _ref62$queryParams, queryParams, _ref62$service, service, _ref62$makeAccessRequ, makeAccessRequest, _ref62$channelAuth, channelAuth, _ref62$noAuth, noAuth, _ref62$noCache, noCache;
2851
2853
  return _regeneratorRuntime.wrap(function _callee36$(_context36) {
2852
2854
  while (1) switch (_context36.prev = _context36.next) {
2853
2855
  case 0:
2854
- libraryId = _ref62.libraryId, objectId = _ref62.objectId, versionHash = _ref62.versionHash, rep = _ref62.rep, _ref62$queryParams = _ref62.queryParams, queryParams = _ref62$queryParams === void 0 ? {} : _ref62$queryParams, _ref62$channelAuth = _ref62.channelAuth, channelAuth = _ref62$channelAuth === void 0 ? false : _ref62$channelAuth, _ref62$noAuth = _ref62.noAuth, noAuth = _ref62$noAuth === void 0 ? false : _ref62$noAuth, _ref62$noCache = _ref62.noCache, noCache = _ref62$noCache === void 0 ? false : _ref62$noCache;
2856
+ libraryId = _ref62.libraryId, objectId = _ref62.objectId, versionHash = _ref62.versionHash, rep = _ref62.rep, _ref62$queryParams = _ref62.queryParams, queryParams = _ref62$queryParams === void 0 ? {} : _ref62$queryParams, _ref62$service = _ref62.service, service = _ref62$service === void 0 ? "fabric" : _ref62$service, _ref62$makeAccessRequ = _ref62.makeAccessRequest, makeAccessRequest = _ref62$makeAccessRequ === void 0 ? false : _ref62$makeAccessRequ, _ref62$channelAuth = _ref62.channelAuth, channelAuth = _ref62$channelAuth === void 0 ? false : _ref62$channelAuth, _ref62$noAuth = _ref62.noAuth, noAuth = _ref62$noAuth === void 0 ? false : _ref62$noAuth, _ref62$noCache = _ref62.noCache, noCache = _ref62$noCache === void 0 ? false : _ref62$noCache;
2855
2857
  ValidateParameters({
2856
2858
  libraryId: libraryId,
2857
2859
  objectId: objectId,
@@ -2869,6 +2871,8 @@ exports.Rep = /*#__PURE__*/function () {
2869
2871
  versionHash: versionHash,
2870
2872
  rep: rep,
2871
2873
  queryParams: queryParams,
2874
+ service: service,
2875
+ makeAccessRequest: makeAccessRequest,
2872
2876
  channelAuth: channelAuth,
2873
2877
  noAuth: noAuth,
2874
2878
  noCache: noCache
@@ -2903,11 +2907,11 @@ exports.Rep = /*#__PURE__*/function () {
2903
2907
  */
2904
2908
  exports.PublicRep = /*#__PURE__*/function () {
2905
2909
  var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(_ref64) {
2906
- var libraryId, objectId, versionHash, rep, _ref64$queryParams, queryParams;
2910
+ var libraryId, objectId, versionHash, rep, _ref64$queryParams, queryParams, _ref64$service, service;
2907
2911
  return _regeneratorRuntime.wrap(function _callee37$(_context37) {
2908
2912
  while (1) switch (_context37.prev = _context37.next) {
2909
2913
  case 0:
2910
- libraryId = _ref64.libraryId, objectId = _ref64.objectId, versionHash = _ref64.versionHash, rep = _ref64.rep, _ref64$queryParams = _ref64.queryParams, queryParams = _ref64$queryParams === void 0 ? {} : _ref64$queryParams;
2914
+ libraryId = _ref64.libraryId, objectId = _ref64.objectId, versionHash = _ref64.versionHash, rep = _ref64.rep, _ref64$queryParams = _ref64.queryParams, queryParams = _ref64$queryParams === void 0 ? {} : _ref64$queryParams, _ref64$service = _ref64.service, service = _ref64$service === void 0 ? "fabric" : _ref64$service;
2911
2915
  ValidateParameters({
2912
2916
  libraryId: libraryId,
2913
2917
  objectId: objectId,
@@ -2925,6 +2929,7 @@ exports.PublicRep = /*#__PURE__*/function () {
2925
2929
  versionHash: versionHash,
2926
2930
  publicRep: rep,
2927
2931
  queryParams: queryParams,
2932
+ service: service,
2928
2933
  noAuth: true
2929
2934
  }));
2930
2935
  case 5:
@@ -2952,21 +2957,23 @@ exports.PublicRep = /*#__PURE__*/function () {
2952
2957
  * @param {string=} publicRep - Public rep parameter of the url
2953
2958
  * @param {string=} call - Bitcode method to call
2954
2959
  * @param {Object=} queryParams - Query params to add to the URL
2960
+ * @param {string=} service=fabric - The service to use. By default, will use a fabric node. Options: "fabric", "search", "auth"
2955
2961
  * @param {boolean=} channelAuth=false - If specified, state channel authorization will be used instead of access request authorization
2956
2962
  * @param {boolean=} noAuth=false - If specified, authorization will not be performed and the URL will not have an authorization
2957
2963
  * token. This is useful for accessing public assets.
2958
2964
  * @param {boolean=} noCache=false - If specified, a new access request will be made for the authorization regardless of
2959
2965
  * whether such a request exists in the client cache. This request will not be cached. This option has no effect if noAuth is true.
2966
+ * @param {boolean=} makeAccessRequest=false - If using auth, will make a full access request
2960
2967
  *
2961
2968
  * @returns {Promise<string>} - URL to the specified endpoint with authorization token
2962
2969
  */
2963
2970
  exports.FabricUrl = /*#__PURE__*/function () {
2964
2971
  var _ref67 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(_ref66) {
2965
- var libraryId, objectId, versionHash, writeToken, partHash, rep, publicRep, call, _ref66$queryParams, queryParams, _ref66$channelAuth, channelAuth, _ref66$noAuth, noAuth, _ref66$noCache, noCache, authorization, path;
2972
+ var libraryId, objectId, versionHash, writeToken, partHash, rep, publicRep, call, _ref66$queryParams, queryParams, _ref66$service, service, _ref66$channelAuth, channelAuth, _ref66$makeAccessRequ, makeAccessRequest, _ref66$noAuth, noAuth, _ref66$noCache, noCache, authorization, path, httpClient;
2966
2973
  return _regeneratorRuntime.wrap(function _callee38$(_context38) {
2967
2974
  while (1) switch (_context38.prev = _context38.next) {
2968
2975
  case 0:
2969
- libraryId = _ref66.libraryId, objectId = _ref66.objectId, versionHash = _ref66.versionHash, writeToken = _ref66.writeToken, partHash = _ref66.partHash, rep = _ref66.rep, publicRep = _ref66.publicRep, call = _ref66.call, _ref66$queryParams = _ref66.queryParams, queryParams = _ref66$queryParams === void 0 ? {} : _ref66$queryParams, _ref66$channelAuth = _ref66.channelAuth, channelAuth = _ref66$channelAuth === void 0 ? false : _ref66$channelAuth, _ref66$noAuth = _ref66.noAuth, noAuth = _ref66$noAuth === void 0 ? false : _ref66$noAuth, _ref66$noCache = _ref66.noCache, noCache = _ref66$noCache === void 0 ? false : _ref66$noCache;
2976
+ libraryId = _ref66.libraryId, objectId = _ref66.objectId, versionHash = _ref66.versionHash, writeToken = _ref66.writeToken, partHash = _ref66.partHash, rep = _ref66.rep, publicRep = _ref66.publicRep, call = _ref66.call, _ref66$queryParams = _ref66.queryParams, queryParams = _ref66$queryParams === void 0 ? {} : _ref66$queryParams, _ref66$service = _ref66.service, service = _ref66$service === void 0 ? "fabric" : _ref66$service, _ref66$channelAuth = _ref66.channelAuth, channelAuth = _ref66$channelAuth === void 0 ? false : _ref66$channelAuth, _ref66$makeAccessRequ = _ref66.makeAccessRequest, makeAccessRequest = _ref66$makeAccessRequ === void 0 ? false : _ref66$makeAccessRequ, _ref66$noAuth = _ref66.noAuth, noAuth = _ref66$noAuth === void 0 ? false : _ref66$noAuth, _ref66$noCache = _ref66.noCache, noCache = _ref66$noCache === void 0 ? false : _ref66$noCache;
2970
2977
  if (objectId || versionHash) {
2971
2978
  ValidateParameters({
2972
2979
  libraryId: libraryId,
@@ -2993,6 +3000,7 @@ exports.FabricUrl = /*#__PURE__*/function () {
2993
3000
  objectId: objectId,
2994
3001
  versionHash: versionHash,
2995
3002
  channelAuth: channelAuth,
3003
+ makeAccessRequest: makeAccessRequest,
2996
3004
  noAuth: noAuth,
2997
3005
  noCache: noCache
2998
3006
  });
@@ -3033,11 +3041,17 @@ exports.FabricUrl = /*#__PURE__*/function () {
3033
3041
  } else if (call) {
3034
3042
  path = UrlJoin(path, "call", call);
3035
3043
  }
3036
- return _context38.abrupt("return", this.HttpClient.URL({
3044
+ httpClient = this.HttpClient;
3045
+ if (service === "search") {
3046
+ httpClient = this.SearchHttpClient;
3047
+ } else if (service === "auth") {
3048
+ httpClient = this.AuthHttpClient;
3049
+ }
3050
+ return _context38.abrupt("return", httpClient.URL({
3037
3051
  path: path,
3038
3052
  queryParams: queryParams
3039
3053
  }));
3040
- case 21:
3054
+ case 23:
3041
3055
  case "end":
3042
3056
  return _context38.stop();
3043
3057
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.24",
3
+ "version": "4.0.25",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
package/src/ElvClient.js CHANGED
@@ -395,6 +395,7 @@ class ElvClient {
395
395
  const uris = this.service === "search" ? this.searchURIs : this.fabricURIs;
396
396
  this.HttpClient = new HttpClient({uris, debug: this.debug});
397
397
  this.AuthHttpClient = new HttpClient({uris: this.authServiceURIs, debug: this.debug});
398
+ this.SearchHttpClient = new HttpClient({uris: this.searchURIs || [], debug: this.debug});
398
399
  this.ethClient = new EthClient({client: this, uris: this.ethereumURIs, networkId: this.networkId, debug: this.debug, timeout: this.ethereumContractTimeout});
399
400
 
400
401
  if(!this.signer) {
@@ -1848,21 +1848,23 @@ exports.CallBitcodeMethod = async function({
1848
1848
  * @param {string=} versionHash - Hash of the object version - if not specified, latest version will be used
1849
1849
  * @param {string} rep - Representation to use
1850
1850
  * @param {Object=} queryParams - Query params to add to the URL
1851
+ * @param {string=} service=fabric - The service to use. By default, will use a fabric node. Options: "fabric", "search", "auth"
1851
1852
  * @param {boolean=} channelAuth=false - If specified, state channel authorization will be performed instead of access request authorization
1852
1853
  * @param {boolean=} noAuth=false - If specified, authorization will not be performed and the URL will not have an authorization
1853
1854
  * token. This is useful for accessing public assets.
1854
1855
  * @param {boolean=} noCache=false - If specified, a new access request will be made for the authorization regardless of
1855
1856
  * whether such a request exists in the client cache. This request will not be cached. This option has no effect if noAuth is true.
1857
+ * @param {boolean=} makeAccessRequest=false - If using auth, will make a full access request
1856
1858
  *
1857
1859
  * @see <a href="#FabricUrl">FabricUrl</a> for creating arbitrary fabric URLs
1858
1860
  *
1859
1861
  * @returns {Promise<string>} - URL to the specified rep endpoint with authorization token
1860
1862
  */
1861
- exports.Rep = async function({libraryId, objectId, versionHash, rep, queryParams={}, channelAuth=false, noAuth=false, noCache=false}) {
1863
+ exports.Rep = async function({libraryId, objectId, versionHash, rep, queryParams={}, service="fabric", makeAccessRequest=false, channelAuth=false, noAuth=false, noCache=false}) {
1862
1864
  ValidateParameters({libraryId, objectId, versionHash});
1863
1865
  if(!rep) { throw "Rep not specified"; }
1864
1866
 
1865
- return this.FabricUrl({libraryId, objectId, versionHash, rep, queryParams, channelAuth, noAuth, noCache});
1867
+ return this.FabricUrl({libraryId, objectId, versionHash, rep, queryParams, service, makeAccessRequest, channelAuth, noAuth, noCache});
1866
1868
  };
1867
1869
 
1868
1870
  /**
@@ -1882,11 +1884,11 @@ exports.Rep = async function({libraryId, objectId, versionHash, rep, queryParams
1882
1884
  *
1883
1885
  * @returns {Promise<string>} - URL to the specified rep endpoint with authorization token
1884
1886
  */
1885
- exports.PublicRep = async function({libraryId, objectId, versionHash, rep, queryParams={}}) {
1887
+ exports.PublicRep = async function({libraryId, objectId, versionHash, rep, queryParams={}, service="fabric"}) {
1886
1888
  ValidateParameters({libraryId, objectId, versionHash});
1887
1889
  if(!rep) { throw "Rep not specified"; }
1888
1890
 
1889
- return this.FabricUrl({libraryId, objectId, versionHash, publicRep: rep, queryParams, noAuth: true});
1891
+ return this.FabricUrl({libraryId, objectId, versionHash, publicRep: rep, queryParams, service, noAuth: true});
1890
1892
  };
1891
1893
 
1892
1894
  /**
@@ -1903,11 +1905,13 @@ exports.PublicRep = async function({libraryId, objectId, versionHash, rep, query
1903
1905
  * @param {string=} publicRep - Public rep parameter of the url
1904
1906
  * @param {string=} call - Bitcode method to call
1905
1907
  * @param {Object=} queryParams - Query params to add to the URL
1908
+ * @param {string=} service=fabric - The service to use. By default, will use a fabric node. Options: "fabric", "search", "auth"
1906
1909
  * @param {boolean=} channelAuth=false - If specified, state channel authorization will be used instead of access request authorization
1907
1910
  * @param {boolean=} noAuth=false - If specified, authorization will not be performed and the URL will not have an authorization
1908
1911
  * token. This is useful for accessing public assets.
1909
1912
  * @param {boolean=} noCache=false - If specified, a new access request will be made for the authorization regardless of
1910
1913
  * whether such a request exists in the client cache. This request will not be cached. This option has no effect if noAuth is true.
1914
+ * @param {boolean=} makeAccessRequest=false - If using auth, will make a full access request
1911
1915
  *
1912
1916
  * @returns {Promise<string>} - URL to the specified endpoint with authorization token
1913
1917
  */
@@ -1921,7 +1925,9 @@ exports.FabricUrl = async function({
1921
1925
  publicRep,
1922
1926
  call,
1923
1927
  queryParams={},
1928
+ service="fabric",
1924
1929
  channelAuth=false,
1930
+ makeAccessRequest=false,
1925
1931
  noAuth=false,
1926
1932
  noCache=false
1927
1933
  }) {
@@ -1960,6 +1966,7 @@ exports.FabricUrl = async function({
1960
1966
  objectId,
1961
1967
  versionHash,
1962
1968
  channelAuth,
1969
+ makeAccessRequest,
1963
1970
  noAuth,
1964
1971
  noCache
1965
1972
  })
@@ -1997,7 +2004,14 @@ exports.FabricUrl = async function({
1997
2004
  path = UrlJoin(path, "call", call);
1998
2005
  }
1999
2006
 
2000
- return this.HttpClient.URL({
2007
+ let httpClient = this.HttpClient;
2008
+ if(service === "search") {
2009
+ httpClient = this.SearchHttpClient;
2010
+ } else if(service === "auth") {
2011
+ httpClient = this.AuthHttpClient;
2012
+ }
2013
+
2014
+ return httpClient.URL({
2001
2015
  path,
2002
2016
  queryParams
2003
2017
  });