UNPKG

meilisearch

Version:

The Meilisearch JS client for Node.js and the browser.

3 lines 59.9 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function e(){ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function o(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,s=Object.create(i.prototype),u=new R(n||[]);return s._invoke=function(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return O()}for(r.method=i,r.arg=s;;){var u=r.delegate;if(u){var a=b(u,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var o=h(t,e,r);if("normal"===o.type){if(n=r.done?"completed":"suspendedYield",o.arg===d)continue;return{value:o.arg,done:r.done}}"throw"===o.type&&(n="completed",r.method="throw",r.arg=o.arg)}}}(t,r,u),s}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var d={};function p(){}function f(){}function v(){}var l={};o(l,s,(function(){return this}));var w=Object.getPrototypeOf,y=w&&w(w(A([])));y&&y!==r&&n.call(y,s)&&(l=y);var x=v.prototype=p.prototype=Object.create(l);function k(t){["next","throw","return"].forEach((function(e){o(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){function r(i,s,u,a){var o=h(t[i],t,s);if("throw"!==o.type){var c=o.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(d).then((function(t){c.value=t,u(c)}),(function(t){return r("throw",t,u,a)}))}a(o.arg)}var i;this._invoke=function(t,n){function s(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(s,s):s()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=h(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return f.prototype=v,o(x,"constructor",v),o(v,"constructor",f),f.displayName=o(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,o(t,a,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},k(g.prototype),o(g.prototype,u,(function(){return this})),t.AsyncIterator=g,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var u=new g(c(e,r,n,i),s);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(x),o(x,a,"Generator"),o(x,s,(function(){return this})),o(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=A,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(q),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=n.call(s,"catchLoc"),o=n.call(s,"finallyLoc");if(a&&o){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var u=s?s.completion:{};return u.type=t,u.arg=e,s?(this.method="next",this.next=s.finallyLoc,d):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;q(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e,r){return d=h()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&c(i,r.prototype),i},d.apply(null,arguments)}function p(t){var e="function"==typeof Map?new Map:void 0;return p=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return d(t,arguments,o(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,t)},p(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return f(t)}function l(t){var e=h();return function(){var r,n=o(t);if(e){var i=o(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return v(this,r)}}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,s=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);u=!0);}catch(t){a=!0,i=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw i}}return s}(t,e)||y(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function k(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=y(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}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 s,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,s=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw s}}}}function g(t,e,r,n){return new(r||(r=Promise))((function(i,s){function u(t){try{o(n.next(t))}catch(t){s(t)}}function a(t){try{o(n.throw(t))}catch(t){s(t)}}function o(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}o((n=n.apply(t,e||[])).next())}))}var b=function(t){a(r,t);var e=l(r);function r(t,i,s,u){var a,o,c,h;return n(this,r),a=e.call(this,t),Object.setPrototypeOf(f(a),r.prototype),a.name="MeiliSearchCommunicationError",i instanceof Response&&(a.message=i.statusText,a.statusCode=i.status),i instanceof Error&&(a.errno=i.errno,a.code=i.code),u?(a.stack=u,a.stack=null===(o=a.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,a.name),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Failed to fetch","request to ".concat(s," failed, reason: connect ECONNREFUSED")),a.stack=null===(h=a.stack)||void 0===h?void 0:h.replace("Not Found","Not Found: ".concat(s))):Error.captureStackTrace&&Error.captureStackTrace(f(a),r),a}return s(r)}(p(Error)),m=function(t){a(r,t);var e=l(r);function r(t,i){var s;return n(this,r),s=e.call(this,t.message),Object.setPrototypeOf(f(s),r.prototype),s.name="MeiliSearchApiError",s.code=t.code,s.type=t.type,s.link=t.link,s.message=t.message,s.httpStatus=i,Error.captureStackTrace&&Error.captureStackTrace(f(s),r),s}return s(r)}(p(Error));function q(t){return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:n=e.sent,e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(1),new b(t.statusText,t,t.url);case 10:throw new m(n,t.status);case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),r,null,[[1,7]])})))}function R(t,e,r){if("MeiliSearchApiError"!==t.name)throw new b(t.message,t,r,e);throw t}var A=function(t){a(r,t);var e=l(r);function r(t){var i;return n(this,r),i=e.call(this,t),Object.setPrototypeOf(f(i),r.prototype),i.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(f(i),r),i}return s(r)}(p(Error)),O=function(t){a(r,t);var e=l(r);function r(t){var i;return n(this,r),i=e.call(this,t),Object.setPrototypeOf(f(i),r.prototype),i.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(f(i),r),i}return s(r)}(p(Error));function T(t,e){return"".concat(t,"\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ").concat(e," call requires.")}function S(t){return Object.entries(t).reduce((function(t,e){var r=w(e,2),n=r[0],i=r[1];return void 0!==i&&(t[n]=i),t}),{})}function j(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,t)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r)})))}function E(t){return Object.keys(t).reduce((function(e,r){var n=t[r];return void 0===n?e:Array.isArray(n)?Object.assign(Object.assign({},e),u({},r,n.join(","))):n instanceof Date?Object.assign(Object.assign({},e),u({},r,n.toISOString())):Object.assign(Object.assign({},e),u({},r,n))}),{})}function D(t){var e,r,n="X-Meilisearch-Client",i="Meilisearch JavaScript (v".concat("0.35.0",")"),s=function(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,r){return e[r]=t})),e}return Object.assign({},t)}(null!==(r=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==r?r:{});if(t.apiKey&&!s.Authorization&&(s.Authorization="Bearer ".concat(t.apiKey)),s["Content-Type"]||(s["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var u=t.clientAgents.concat(i);s[n]=u.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new A('Meilisearch: The header "'.concat(n,'" should be an array of string(s).\n'));s[n]=i}return s}var M=function(){function t(e){n(this,t),this.headers=D(e),this.requestConfig=e.requestConfig,this.httpClient=e.httpClient;try{var r=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new A("The provided host is not valid.")}var e}(e.host);this.url=new URL(r)}catch(t){throw new A("The provided host is not valid.")}}return s(t,[{key:"request",value:function(t){var r,n=t.method,i=t.url,s=t.params,u=t.body,a=t.config,o=void 0===a?{}:a;return g(this,void 0,void 0,e().mark((function t(){var a,c,h,d,p,f,v,l;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("undefined"==typeof fetch&&require("cross-fetch/polyfill"),a=new URL(i,this.url),s&&(c=new URLSearchParams,Object.keys(s).filter((function(t){return null!==s[t]})).map((function(t){return c.set(t,s[t])})),a.search=c.toString()),(null===(r=o.headers)||void 0===r?void 0:r["Content-Type"])||(u=JSON.stringify(u)),h=Object.assign(Object.assign({},this.headers),o.headers),t.prev=5,d=this.httpClient?this.httpClient:fetch,p=d(a.toString(),Object.assign(Object.assign(Object.assign({},o),this.requestConfig),{method:n,body:u,headers:h})),!this.httpClient){t.next=12;break}return t.next=11,p;case 11:return t.abrupt("return",t.sent);case 12:return t.next=14,p.then((function(t){return q(t)}));case 14:return f=t.sent,t.next=17,f.json().catch((function(){}));case 17:return v=t.sent,t.abrupt("return",v);case 21:t.prev=21,t.t0=t.catch(5),l=t.t0.stack,R(t.t0,l,a.toString());case 25:case"end":return t.stop()}}),t,this,[[5,21]])})))}},{key:"get",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"GET",url:t,params:r,config:n});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),i,this)})))}},{key:"post",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"POST",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"put",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"PUT",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"patch",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"PATCH",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"delete",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"DELETE",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}}]),t}(),L=s((function t(e){n(this,t),this.taskUid=e.taskUid,this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.enqueuedAt=new Date(e.enqueuedAt)})),F=s((function t(e){n(this,t),this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.uid=e.uid,this.details=e.details,this.canceledBy=e.canceledBy,this.error=e.error,this.duration=e.duration,this.startedAt=new Date(e.startedAt),this.enqueuedAt=new Date(e.enqueuedAt),this.finishedAt=new Date(e.finishedAt)})),I=function(){function t(e){n(this,t),this.httpRequest=new M(e)}return s(t,[{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="tasks/".concat(t),e.next=3,this.httpRequest.get(n);case 3:return i=e.sent,e.abrupt("return",new F(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks",e.next=3,this.httpRequest.get("tasks",E(t));case 3:return n=e.sent,e.abrupt("return",Object.assign(Object.assign({},n),{results:n.results.map((function(t){return new F(t)}))}));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){var n,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now();case 1:if(!(Date.now()-n<i)){e.next=11;break}return e.next=4,this.getTask(t);case 4:if(s=e.sent,["enqueued","processing"].includes(s.status)){e.next=7;break}return e.abrupt("return",s);case 7:return e.next=9,j(u);case 9:e.next=1;break;case 11:throw new O("timeout of ".concat(i,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."));case 12:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){var n,s,a,o,c;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],s=k(t),e.prev=2,s.s();case 4:if((a=s.n()).done){e.next=12;break}return o=a.value,e.next=8,this.waitForTask(o,{timeOutMs:i,intervalMs:u});case 8:c=e.sent,n.push(c);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),s.e(e.t0);case 17:return e.prev=17,s.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),r,this,[[2,14,17,20]])})))}},{key:"cancelTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks/cancel",e.next=3,this.httpRequest.post("tasks/cancel",{},E(t));case 3:return n=e.sent,e.abrupt("return",new L(n));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"deleteTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks",e.next=3,this.httpRequest.delete("tasks",{},E(t));case 3:return n=e.sent,e.abrupt("return",new L(n));case 5:case"end":return e.stop()}}),r,this)})))}}]),t}(),P=function(){function t(e,r,i){n(this,t),this.uid=r,this.primaryKey=i,this.httpRequest=new M(e),this.tasks=new I(e)}return s(t,[{key:"search",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/search"),e.next=3,this.httpRequest.post(s,S(Object.assign({q:t},r)),void 0,n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),i,this)})))}},{key:"searchGet",value:function(t,r,n){var i,s,u,a,o,c,h;return g(this,void 0,void 0,e().mark((function d(){var p,f,v;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p="indexes/".concat(this.uid,"/search"),f=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new A("The filter query parameter should be in string format when using searchGet")},v=Object.assign(Object.assign({q:t},r),{filter:f(null==r?void 0:r.filter),sort:null===(i=null==r?void 0:r.sort)||void 0===i?void 0:i.join(","),facets:null===(s=null==r?void 0:r.facets)||void 0===s?void 0:s.join(","),attributesToRetrieve:null===(u=null==r?void 0:r.attributesToRetrieve)||void 0===u?void 0:u.join(","),attributesToCrop:null===(a=null==r?void 0:r.attributesToCrop)||void 0===a?void 0:a.join(","),attributesToHighlight:null===(o=null==r?void 0:r.attributesToHighlight)||void 0===o?void 0:o.join(","),vector:null===(c=null==r?void 0:r.vector)||void 0===c?void 0:c.join(","),attributesToSearchOn:null===(h=null==r?void 0:r.attributesToSearchOn)||void 0===h?void 0:h.join(",")}),e.next=5,this.httpRequest.get(p,S(v),n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),d,this)})))}},{key:"searchForFacetValues",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/facet-search"),e.next=3,this.httpRequest.post(i,S(t),void 0,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),n,this)})))}},{key:"getRawInfo",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid),t.next=3,this.httpRequest.get(r);case 3:return n=t.sent,this.primaryKey=n.primaryKey,this.updatedAt=new Date(n.updatedAt),this.createdAt=new Date(n.createdAt),t.abrupt("return",n);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"fetchInfo",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return t.abrupt("return",this);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"fetchPrimaryKey",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return this.primaryKey=t.sent.primaryKey,t.abrupt("return",this.primaryKey);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"update",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"delete",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTasks(Object.assign(Object.assign({},t),{indexUids:[this.uid]}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTask(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getStats",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/stats"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getDocuments",value:function(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function n(){var i,s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===(r=S(r)).filter){e.next=15;break}return e.prev=2,i="indexes/".concat(this.uid,"/documents/fetch"),e.next=6,this.httpRequest.post(i,r);case 6:case 19:return e.abrupt("return",e.sent);case 9:throw e.prev=9,e.t0=e.catch(2),(e.t0 instanceof b||e.t0 instanceof m)&&(e.t0.message=T(e.t0.message,"getDocuments")),e.t0;case 13:e.next=20;break;case 15:return s="indexes/".concat(this.uid,"/documents"),u=Array.isArray(null==r?void 0:r.fields)?{fields:null===(t=null==r?void 0:r.fields)||void 0===t?void 0:t.join(",")}:{},e.next=19,this.httpRequest.get(s,Object.assign(Object.assign({},r),u));case 20:case"end":return e.stop()}}),n,this,[[2,9]])})))}},{key:"getDocument",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents/").concat(t),s=function(){var t;if(Array.isArray(null==r?void 0:r.fields))return null===(t=null==r?void 0:r.fields)||void 0===t?void 0:t.join(",")}(),e.next=4,this.httpRequest.get(i,S(Object.assign(Object.assign({},r),{fields:s})));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),n,this)})))}},{key:"addDocuments",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.post(i,t,r);case 3:return s=e.sent,e.abrupt("return",new L(s));case 5:case"end":return e.stop()}}),n,this)})))}},{key:"addDocumentsFromString",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.post(s,t,n,{headers:{"Content-Type":r}});case 3:return u=e.sent,e.abrupt("return",new L(u));case 5:case"end":return e.stop()}}),i,this)})))}},{key:"addDocumentsInBatches",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],u=0;case 2:if(!(u<t.length)){e.next=11;break}return e.t0=s,e.next=6,this.addDocuments(t.slice(u,u+r),n);case 6:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 8:u+=r,e.next=2;break;case 11:return e.abrupt("return",s);case 12:case"end":return e.stop()}}),i,this)})))}},{key:"updateDocuments",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.put(i,t,r);case 3:return s=e.sent,e.abrupt("return",new L(s));case 5:case"end":return e.stop()}}),n,this)})))}},{key:"updateDocumentsInBatches",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],u=0;case 2:if(!(u<t.length)){e.next=11;break}return e.t0=s,e.next=6,this.updateDocuments(t.slice(u,u+r),n);case 6:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 8:u+=r,e.next=2;break;case 11:return e.abrupt("return",s);case 12:case"end":return e.stop()}}),i,this)})))}},{key:"updateDocumentsFromString",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.put(s,t,n,{headers:{"Content-Type":r}});case 3:return u=e.sent,e.abrupt("return",new L(u));case 5:case"end":return e.stop()}}),i,this)})))}},{key:"deleteDocument",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),e.next=3,this.httpRequest.delete(n);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"deleteDocuments",value:function(t){return g(this,void 0,void 0,e().mark((function n(){var i,s,u,a;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=!Array.isArray(t)&&"object"===r(t),s=i?"documents/delete":"documents/delete-batch",u="indexes/".concat(this.uid,"/").concat(s),e.prev=3,e.next=6,this.httpRequest.post(u,t);case 6:return a=e.sent,e.abrupt("return",new L(a));case 10:throw e.prev=10,e.t0=e.catch(3),(e.t0 instanceof b&&i||e.t0 instanceof m)&&(e.t0.message=T(e.t0.message,"deleteDocuments")),e.t0;case 14:case"end":return e.stop()}}),n,this,[[3,10]])})))}},{key:"deleteAllDocuments",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/documents"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSettings",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSettings",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings"),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueued=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"resetSettings",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getPagination",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updatePagination",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/pagination"),e.next=3,this.httpRequest.patch(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetPagination",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getSynonyms",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSynonyms",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/synonyms"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSynonyms",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getStopWords",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateStopWords",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/stop-words"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetStopWords",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getRankingRules",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateRankingRules",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/ranking-rules"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetRankingRules",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDistinctAttribute",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDistinctAttribute",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/distinct-attribute"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDistinctAttribute",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFilterableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFilterableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/filterable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetFilterableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSortableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSortableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/sortable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSortableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSearchableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSearchableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/searchable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSearchableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDisplayedAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDisplayedAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/displayed-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDisplayedAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getTypoTolerance",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateTypoTolerance",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/typo-tolerance"),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"resetTypoTolerance",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFaceting",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFaceting",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/faceting"),e.next=3,this.httpRequest.patch(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetFaceting",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/separator-tokens"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSeparatorTokens",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/separator-tokens"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/separator-tokens"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getNonSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/non-separator-tokens"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateNonSeparatorTokens",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/non-separator-tokens"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetNonSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/non-separator-tokens"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDictionary",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/dictionary"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDictionary",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/dictionary"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDictionary",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/dictionary"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}}],[{key:"create",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"indexes",s=new M(n),e.next=4,s.post("indexes",Object.assign(Object.assign({},r),{uid:t}));case 4:return u=e.sent,