@lableb/javascript-sdk
Version:
Lableb cloud search client for javascript
17 lines (14 loc) • 22.8 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var e=require("yup"),t=require("axios");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var n=i(e),r=s(t);
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function o(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(s[i[n]]=e[i[n]])}return s}function d(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function d(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,d)}a((i=i.apply(e,t||[])).next())}))}function a(e,t){if(!e)return;let s=Object.assign({},e);return Object.keys(s).forEach((e=>{t(s[e])||delete s[e]})),s}function u(e){return"number"==typeof e&&0==e?"0":e}function l(e){let t={};return Object.keys(e).forEach((s=>{const i=s,n=s.replace(/[A-Z]/g,(e=>`_${e.toLowerCase()}`));t[n]=e[i]})),t}function c(e){return void 0===e||("string"==typeof e||"number"==typeof e)&&("string"!=typeof e||0!=e.length)}function m(e){return void 0===e||"number"==typeof e&&Number.isInteger(e)}const h="Platform name is a required field",p="Index name is a required field",b="API Key is a required field",f="Indexing API Key is a required field",y="Please provide a valid IP Address",I="query is a required field",v="documents is a required field",g="documents field must have at least 1 items",O="document id is a required field",N="document id passed must be none empty string",j="user country should be a string of two letters(iso 3166)",x="URL is not valid",q='Please provide an integer value for "skip"',P='Please provide an integer value for "limit"',A="User id must be none empty string",k='Please provide an integer value for "item order"',K="Feedback documents array should contains at least one item",H="Feedback documents array is required",G="Source document id(which used to fetch the recommend results for) is required for the recommend feedback to complete",C="Source document id passed must be none empty string",E="Target document id(which the user clicks from within the recommend results displayed) is required for the recommend feedback to complete",$="Source document id passed must be none empty string",F="Target Id can't be equal to source id in recommend feedback request",T="Target title document can't be empty string",L="Source title document can't be empty string",B="Wrong http method",_="Body is not allowed for get & delete requests",S="Body is required",R="Session Id Generator must be of type function and returns a string value",w=n.object().shape({sessionId:n.string().optional(),userId:n.string().optional().test("test-id",A,c),userIp:n.string().optional().test("test-ip",y,(function(e){return!e||!e.length||/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e)})),userCountry:n.string().length(2,j).optional().uppercase(),sessionIdGenerator:n.mixed().test("test-type",R,(function(e){if(e){if("function"!=typeof e)return!1;if("string"!=typeof e())return!1}return!0}))}),D=w.concat(n.object().shape({APIKey:n.string().optional(),indexingAPIKey:n.string().optional(),platformName:n.string().optional(),indexName:n.string().optional(),searchHandler:n.string().optional(),autocompleteHandler:n.string().optional(),recommendHandler:n.string().optional()})),U=w.concat(n.object().shape({platformName:n.string().required(h),indexName:n.string().required(p),indexingAPIKey:n.string().optional(),APIKey:n.string().optional()})),M=w.concat(n.object().shape({query:n.string().required(I),url:n.string().url(x).optional(),itemId:n.string().optional().test("test-id",N,c),itemOrder:n.number().optional().test("is-integer",k,m)})),z=w.concat(n.object().shape({sourceId:n.string().required(G).test("test-id",C,c),sourceTitle:n.string().optional().min(1,L),sourceUrl:n.string().optional().url(x),targetId:n.string().required(E).test("test-id",$,c).test("test-equal-with-source-id",F,(function(e,t){return t.parent.sourceId!=t.parent.targetId})),targetTitle:n.string().optional().min(1,T),targetUrl:n.string().optional().url(x),itemOrder:n.number().optional().test("is-integer",k,m)})),J=U.concat(n.object().shape({autocompleteHandler:n.string().optional(),APIKey:n.string().required(b),documentsFeedbacks:n.array().required(H).min(1,K).of(M)}));function V(e){return d(this,void 0,void 0,(function*(){const{documentFeedback:t}=e,s=o(e,["documentFeedback"]),i=Object.assign({},s);return t&&(i.documentsFeedbacks=[t]),W.bind(this)(i)}))}function W(e){var t;return d(this,void 0,void 0,(function*(){const s=yield J.validate(a(Object.assign(Object.assign({},e),{indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),autocompleteHandler:e.autocompleteHandler||(null==this?void 0:this.autocompleteHandler)||"suggest",APIKey:e.APIKey||(null==this?void 0:this.APIKey),documentsFeedbacks:null===(t=e.documentsFeedbacks)||void 0===t?void 0:t.map((e=>a(Object.assign(Object.assign({},e),{userCountry:e.userCountry||(null==this?void 0:this.userCountry),userId:e.userId||(null==this?void 0:this.userId),userIp:e.userIp||(null==this?void 0:this.userIp),sessionId:e.sessionId||(null==this?void 0:this.sessionId)||(this.sessionIdGenerator?this.sessionIdGenerator():void 0)}),u)))}),u)),{indexName:i,platformName:n,autocompleteHandler:r,APIKey:o,documentsFeedbacks:d}=s;return{method:"POST",url:`https://api.lableb.com/v2/projects/${n}/indices/${i}/autocomplete/${r}/feedback/hits`,params:{apikey:o},headers:{},body:d}}))}const X=U.concat(n.object().shape({APIKey:n.string().required(b),query:n.string().required(I),autocompleteHandler:n.string().optional(),sort:n.string().optional(),limit:n.number().optional().test("test-integer",P,m)}));function Z(e){return d(this,void 0,void 0,(function*(){const t=yield X.validate(a(Object.assign(Object.assign({},e),{indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),autocompleteHandler:e.autocompleteHandler||(null==this?void 0:this.autocompleteHandler)||"suggest",APIKey:e.APIKey||(null==this?void 0:this.APIKey),userCountry:e.userCountry||(null==this?void 0:this.userCountry),userId:e.userId||(null==this?void 0:this.userId),userIp:e.userIp||(null==this?void 0:this.userIp),sessionId:e.sessionId||(null==this?void 0:this.sessionId),sessionIdGenerator:e.sessionIdGenerator||(null==this?void 0:this.sessionIdGenerator)}),u)),{indexName:s,platformName:i,autocompleteHandler:n,APIKey:r,query:d}=t,l=o(t,["indexName","platformName","autocompleteHandler","APIKey","query"]);return{method:"GET",url:`https://api.lableb.com/v2/projects/${i}/indices/${s}/autocomplete/${n}`,params:Object.assign({apikey:r,q:d},l),headers:{}}}))}const Q=n.object().shape({indexingAPIKey:n.string().required(f),platformName:n.string().required(h),indexName:n.string().required(p),documentId:n.string().required(O).test("test-id",N,c)});function Y(e){return d(this,void 0,void 0,(function*(){const t=yield Q.validate(a({indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),indexingAPIKey:e.indexingAPIKey||(null==this?void 0:this.indexingAPIKey),documentId:e.documentId},u)),{indexName:s,platformName:i,indexingAPIKey:n,documentId:r}=t;return{method:"DELETE",url:`https://api.lableb.com/v2/projects/${i}/indices/${s}/documents/${r}`,params:{apikey:n},headers:{}}}))}const ee=n.object().shape({indexingAPIKey:n.string().required(f),platformName:n.string().required(h),indexName:n.string().required(p),documents:n.array().required(v).min(1,g).of(n.object().shape({id:n.string().required(O).test("test-id",N,c)}))});function te(e){return d(this,void 0,void 0,(function*(){const t=yield ee.validate(a({indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),indexingAPIKey:e.indexingAPIKey||(null==this?void 0:this.indexingAPIKey),documents:e.documents},u)),{indexName:s,platformName:i,indexingAPIKey:n,documents:r}=t;return{method:"POST",url:`https://api.lableb.com/v2/projects/${i}/indices/${s}/documents`,params:a({apikey:n},u),headers:{},body:r}}))}const se=U.concat(n.object().shape({recommendHandler:n.string().optional(),APIKey:n.string().required(b),documentsFeedbacks:n.array().required(H).min(1,K).of(z)}));function ie(e){return d(this,void 0,void 0,(function*(){const{documentFeedback:t}=e,s=o(e,["documentFeedback"]),i=Object.assign({},s);return t&&(i.documentsFeedbacks=[t]),ne.bind(this)(i)}))}function ne(e){var t;return d(this,void 0,void 0,(function*(){const s=yield se.validate(a(Object.assign(Object.assign({},e),{indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),recommendHandler:e.recommendHandler||(null==this?void 0:this.recommendHandler)||"recommend",APIKey:e.APIKey||(null==this?void 0:this.APIKey),documentsFeedbacks:null===(t=e.documentsFeedbacks)||void 0===t?void 0:t.map((e=>a(Object.assign(Object.assign({},e),{userCountry:e.userCountry||(null==this?void 0:this.userCountry),userId:e.userId||(null==this?void 0:this.userId),userIp:e.userIp||(null==this?void 0:this.userIp),sessionId:e.sessionId||(null==this?void 0:this.sessionId)||(this.sessionIdGenerator?this.sessionIdGenerator():void 0)}),u)))}),u)),{indexName:i,platformName:n,recommendHandler:r,APIKey:o,documentsFeedbacks:d}=s;return{method:"POST",url:`https://api.lableb.com/v2/projects/${n}/indices/${i}/recommend/${r}/feedback/hits`,params:{apikey:o},headers:{},body:d}}))}const re=U.concat(n.object().shape({APIKey:n.string().required(b),id:n.string().test("test-id",N,c).required(O),title:n.string().optional(),url:n.string().url(x).optional(),recommendHandler:n.string().optional(),sort:n.string().optional(),limit:n.number().optional().test("test-integer",P,m)}));function oe(e){return d(this,void 0,void 0,(function*(){const t=yield re.validate(a(Object.assign(Object.assign({},e),{indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),recommendHandler:e.recommendHandler||(null==this?void 0:this.recommendHandler)||"recommend",APIKey:e.APIKey||(null==this?void 0:this.APIKey),userCountry:e.userCountry||(null==this?void 0:this.userCountry),userId:e.userId||(null==this?void 0:this.userId),userIp:e.userIp||(null==this?void 0:this.userIp),sessionId:e.sessionId||(null==this?void 0:this.sessionId)}),u)),{indexName:s,platformName:i,recommendHandler:n,APIKey:r}=t,d=o(t,["indexName","platformName","recommendHandler","APIKey"]);return{method:"GET",url:`https://api.lableb.com/v2/projects/${i}/indices/${s}/recommend/${n}`,params:Object.assign({apikey:r},d),headers:{}}}))}const de=U.concat(n.object().shape({APIKey:n.string().required(b),id:n.string().required(O)}));function ae(e){return d(this,void 0,void 0,(function*(){const t=yield de.validate(a(Object.assign(Object.assign({},e),{indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),APIKey:e.APIKey||(null==this?void 0:this.APIKey),userCountry:e.userCountry||(null==this?void 0:this.userCountry),userId:e.userId||(null==this?void 0:this.userId),userIp:e.userIp||(null==this?void 0:this.userIp),sessionId:e.sessionId||(null==this?void 0:this.sessionId),sessionIdGenerator:e.sessionIdGenerator||(null==this?void 0:this.sessionIdGenerator)}),u)),{indexName:s,platformName:i,APIKey:n,id:r}=t,d=o(t,["indexName","platformName","APIKey","id"]);return{method:"GET",url:`https://api.lableb.com/v2/projects/${i}/indices/${s}/documents/${r}`,params:Object.assign({apikey:n},d),headers:{}}}))}const ue=U.concat(n.object().shape({searchHandler:n.string().optional(),APIKey:n.string().required(b),documentsFeedbacks:n.array().required(H).min(1,K).of(M)}));function le(e){return d(this,void 0,void 0,(function*(){const{documentFeedback:t}=e,s=o(e,["documentFeedback"]),i=Object.assign({},s);return t&&(i.documentsFeedbacks=[t]),ce.bind(this)(i)}))}function ce(e){var t;return d(this,void 0,void 0,(function*(){const s=yield ue.validate(a(Object.assign(Object.assign({},e),{indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),searchHandler:e.searchHandler||(null==this?void 0:this.searchHandler)||"default",APIKey:e.APIKey||(null==this?void 0:this.APIKey),documentsFeedbacks:null===(t=e.documentsFeedbacks)||void 0===t?void 0:t.map((e=>a(Object.assign(Object.assign({},e),{userCountry:e.userCountry||(null==this?void 0:this.userCountry),userId:e.userId||(null==this?void 0:this.userId),userIp:e.userIp||(null==this?void 0:this.userIp),sessionId:e.sessionId||(null==this?void 0:this.sessionId)||(this.sessionIdGenerator?this.sessionIdGenerator():void 0)}),u)))}),u)),{indexName:i,platformName:n,searchHandler:r,APIKey:o,documentsFeedbacks:d}=s;return{method:"POST",url:`https://api.lableb.com/v2/projects/${n}/indices/${i}/search/${r}/feedback/hits`,params:{apikey:o},headers:{},body:d}}))}const me=U.concat(n.object().shape({APIKey:n.string().required(b),query:n.string().required(I),searchHandler:n.string().optional(),sort:n.string().optional(),skip:n.number().optional().test("test-integer",q,m),limit:n.number().optional().test("test-integer",P,m),facets:n.object().shape({key:n.string().optional()}).optional()}));function he(e){return d(this,void 0,void 0,(function*(){const t=yield me.validate(a(Object.assign(Object.assign({},e),{indexName:e.indexName||(null==this?void 0:this.indexName)||"index",platformName:e.platformName||(null==this?void 0:this.platformName),searchHandler:e.searchHandler||(null==this?void 0:this.searchHandler)||"default",APIKey:e.APIKey||(null==this?void 0:this.APIKey),userCountry:e.userCountry||(null==this?void 0:this.userCountry),userId:e.userId||(null==this?void 0:this.userId),userIp:e.userIp||(null==this?void 0:this.userIp),sessionId:e.sessionId||(null==this?void 0:this.sessionId),sessionIdGenerator:e.sessionIdGenerator||(null==this?void 0:this.sessionIdGenerator)}),u)),{indexName:s,platformName:i,searchHandler:n,APIKey:r,query:d,facets:l}=t,c=o(t,["indexName","platformName","searchHandler","APIKey","query","facets"]);let m="";if(e.facets){const t=function(e){const t=a(e,(e=>e&&e.length&&e.filter(u).length>0));let s="";for(const i of Object.keys(t))for(const t of e[i])s+=`${i}=${t}&`;return s.slice(0,s.length-1)}(e.facets);m=t?`?${t}`:""}return{method:"GET",url:`https://api.lableb.com/v2/projects/${i}/indices/${s}/search/${n}${m}`,params:Object.assign({apikey:r,q:d},c),headers:{}}}))}function pe(e={}){return D.validateSync(a(e,u)),{index:te.bind(e),search:he.bind(e),searchById:ae.bind(e),autocomplete:Z.bind(e),recommend:oe.bind(e),delete:Y.bind(e),feedback:{search:{single:le.bind(e),batch:ce.bind(e)},autocomplete:{single:V.bind(e),batch:W.bind(e)},recommend:{single:ie.bind(e),batch:ne.bind(e)}}}}const be=n.object().shape({method:n.string().required().test("test-http-method",B,(function(e){return!(e&&!["GET","POST","PUT","DELETE"].includes(e))})),url:n.string().required(),body:n.mixed().when("method",{is:e=>"GET"==e||"DELETE"==e,then:n.mixed().test("test-not-required",_,(e=>!e)),otherwise:n.mixed().required(S)}),params:n.object().optional(),headers:n.object().optional()});function fe(e){return d(this,void 0,void 0,(function*(){const t=yield be.validate(e);return r.default(a({method:null==t?void 0:t.method,url:null==t?void 0:t.url,headers:null==t?void 0:t.headers,data:null==t?void 0:t.body,params:null==t?void 0:t.params},u)).then((e=>e.data))}))}function ye(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n,body:r}=yield this.requestBuilder.feedback.autocomplete.single(e),o={method:i,url:t,headers:s,params:l(n),body:r.map(l)};return yield fe(o)}))}function Ie(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n,body:r}=yield this.requestBuilder.feedback.autocomplete.batch(e),o={method:i,url:t,headers:s,params:l(n),body:r.map(l)};return yield fe(o)}))}function ve(e){return d(this,void 0,void 0,(function*(){return function({autocompleteOptions:e,globalOptions:t,autocompleteResponse:s}){return Object.assign(Object.assign({},s),{response:Object.assign(Object.assign({},s.response),{results:s.response.results.map(((s,i)=>Object.assign(Object.assign({},s),{feedback:a({query:e.query,itemId:s.id,itemOrder:i,url:s.url,userCountry:e.userCountry||t.userCountry,userId:e.userId||t.userId,userIp:e.userIp||t.userIp,sessionId:e.sessionId||(e.sessionIdGenerator?e.sessionIdGenerator():void 0)||t.sessionId||(t.sessionIdGenerator?t.sessionIdGenerator():void 0)},u)})))})})}({autocompleteOptions:e,autocompleteResponse:yield ge.bind(this)(e),globalOptions:this.globalOptions})}))}function ge(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n}=yield this.requestBuilder.autocomplete(e),r={method:i,url:t,headers:s,params:l(n)};return yield fe(r)}))}function Oe(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n}=yield this.requestBuilder.delete(e),r={method:i,url:t,headers:s,params:l(n)};return yield fe(r)}))}function Ne(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n,body:r}=yield this.requestBuilder.index(e),o={method:i,url:t,headers:s,params:l(n),body:r};return yield fe(o)}))}function je(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n,body:r}=yield this.requestBuilder.feedback.recommend.single(e),o={method:i,url:t,headers:s,params:l(n),body:r.map(l)};return yield fe(o)}))}function xe(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n,body:r}=yield this.requestBuilder.feedback.recommend.batch(e),o={method:i,url:t,headers:s,params:l(n),body:r.map(l)};return yield fe(o)}))}function qe(e){return d(this,void 0,void 0,(function*(){return function({globalOptions:e,recommendOptions:t,recommendResponse:s}){return Object.assign(Object.assign({},s),{response:Object.assign(Object.assign({},s.response),{results:s.response.results.map(((s,i)=>Object.assign(Object.assign({},s),{feedback:a({sourceId:t.id,targetId:s.id,sourceTitle:t.title,targetTitle:s.title,sourceUrl:t.url,targetUrl:s.url,itemOrder:i,userCountry:t.userCountry||e.userCountry,userId:t.userId||e.userId,userIp:t.userIp||e.userIp,sessionId:t.sessionId||(t.sessionIdGenerator?t.sessionIdGenerator():void 0)||e.sessionId||(e.sessionIdGenerator?e.sessionIdGenerator():void 0)},u)})))})})}({recommendOptions:e,recommendResponse:yield Pe.bind(this)(e),globalOptions:this.globalOptions})}))}function Pe(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n}=yield this.requestBuilder.recommend(e),r={method:i,url:t,headers:s,params:l(n)};return yield fe(r)}))}function Ae(e){return d(this,void 0,void 0,(function*(){return yield ke.bind(this)(e)}))}function ke(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n}=yield this.requestBuilder.searchById(e),r={method:i,url:t,headers:s,params:l(n)};return yield fe(r)}))}function Ke(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n,body:r}=yield this.requestBuilder.feedback.search.single(e),o={method:i,url:t,headers:s,params:l(n),body:r.map(l)};return yield fe(o)}))}function He(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n,body:r}=yield this.requestBuilder.feedback.search.batch(e),o={method:i,url:t,headers:s,params:l(n),body:r.map(l)};return yield fe(o)}))}function Ge(e){return d(this,void 0,void 0,(function*(){return function({globalOptions:e,searchOptions:t,searchResponse:s}){return Object.assign(Object.assign({},s),{response:Object.assign(Object.assign({},s.response),{results:s.response.results.map(((s,i)=>Object.assign(Object.assign({},s),{feedback:a({query:t.query,itemId:s.id,itemOrder:i,url:s.url,userCountry:t.userCountry||e.userCountry,userId:t.userId||e.userId,userIp:t.userIp||e.userIp,sessionId:t.sessionId||(t.sessionIdGenerator?t.sessionIdGenerator():void 0)||e.sessionId||(e.sessionIdGenerator?e.sessionIdGenerator():void 0)},u)})))})})}({searchOptions:e,searchResponse:yield Ce.bind(this)(e),globalOptions:this.globalOptions})}))}function Ce(e){return d(this,void 0,void 0,(function*(){const{url:t,headers:s,method:i,params:n}=yield this.requestBuilder.search(e),r={method:i,url:t,headers:s,params:l(n)};return yield fe(r)}))}function Ee(e={}){const{interceptors:t}=e,s=o(e,["interceptors"]);if(t)for(let{request:e,response:s}of t)r.default.interceptors.request.use(e.onFulfilled,e.onRejected,e.options),r.default.interceptors.response.use(s.onFulfilled,s.onRejected,s.options);const i={requestBuilder:pe(s),globalOptions:s};return{index:Ne.bind(i),delete:Oe.bind(i),search:Ge.bind(i),searchById:Ae.bind(i),autocomplete:ve.bind(i),recommend:qe.bind(i),feedback:{search:{single:Ke.bind(i),batch:He.bind(i)},autocomplete:{single:ye.bind(i),batch:Ie.bind(i)},recommend:{single:je.bind(i),batch:xe.bind(i)}},__defaults__:{API_BASE_URL:"https://api.lableb.com/v2",GLOBAL_DEFAULT_INDEX_NAME:"index",GLOBAL_DEFAULT_SEARCH_HANDLER:"default",GLOBAL_DEFAULT_AUTOCOMPLETE_HANDLER:"suggest",GLOBAL_DEFAULT_RECOMMEND_HANDLER:"recommend"}}}console.log("Lableb JS-SDK VERSION 2.1.4"),exports.LablebClient=Ee,exports.LablebRequestBuilder=pe,exports.default=Ee;