Socket
Socket
Sign inDemoInstall

appbase-js

Package Overview
Dependencies
10
Maintainers
7
Versions
118
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.3.0 to 5.3.1

10

dist/appbase-js.cjs.js

@@ -295,2 +295,3 @@ 'use strict';

* @param {Object} config.endpoint
* @param {Object} config.httpRequestTimeout
* A callback function which will be invoked before a fetch request made

@@ -364,2 +365,6 @@ */

if (config.httpRequestTimeout) {
this.httpRequestTimeout = config.httpRequestTimeout;
}
if (typeof config.enableTelemetry === 'boolean') {

@@ -847,5 +852,4 @@ this.enableTelemetry = config.enableTelemetry;

* @param {boolean} settings.customEvents
* @param {number} httpRequestTimeout
*/
function reactiveSearchv3Api(query, settings, params, httpRequestTimeout) {
function reactiveSearchv3Api(query, settings, params) {
var parsedSettings = removeUndefined(settings);

@@ -875,3 +879,3 @@

params: params,
httpRequestTimeout: httpRequestTimeout || 0
httpRequestTimeout: this.httpRequestTimeout || 0
});

@@ -878,0 +882,0 @@ }

@@ -291,2 +291,3 @@ import URL$1 from 'url-parser-lite';

* @param {Object} config.endpoint
* @param {Object} config.httpRequestTimeout
* A callback function which will be invoked before a fetch request made

@@ -360,2 +361,6 @@ */

if (config.httpRequestTimeout) {
this.httpRequestTimeout = config.httpRequestTimeout;
}
if (typeof config.enableTelemetry === 'boolean') {

@@ -843,5 +848,4 @@ this.enableTelemetry = config.enableTelemetry;

* @param {boolean} settings.customEvents
* @param {number} httpRequestTimeout
*/
function reactiveSearchv3Api(query, settings, params, httpRequestTimeout) {
function reactiveSearchv3Api(query, settings, params) {
var parsedSettings = removeUndefined(settings);

@@ -871,3 +875,3 @@

params: params,
httpRequestTimeout: httpRequestTimeout || 0
httpRequestTimeout: this.httpRequestTimeout || 0
});

@@ -874,0 +878,0 @@ }

@@ -309,2 +309,3 @@ (function (global, factory) {

* @param {Object} config.endpoint
* @param {Object} config.httpRequestTimeout
* A callback function which will be invoked before a fetch request made

@@ -378,2 +379,6 @@ */

if (config.httpRequestTimeout) {
this.httpRequestTimeout = config.httpRequestTimeout;
}
if (typeof config.enableTelemetry === 'boolean') {

@@ -1579,5 +1584,4 @@ this.enableTelemetry = config.enableTelemetry;

* @param {boolean} settings.customEvents
* @param {number} httpRequestTimeout
*/
function reactiveSearchv3Api(query, settings, params, httpRequestTimeout) {
function reactiveSearchv3Api(query, settings, params) {
var parsedSettings = removeUndefined(settings);

@@ -1607,3 +1611,3 @@

params: params,
httpRequestTimeout: httpRequestTimeout || 0
httpRequestTimeout: this.httpRequestTimeout || 0
});

@@ -1610,0 +1614,0 @@ }

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Appbase=t()}(this,function(){"use strict";var e=function(e){var t=RegExp("^(([^:/?#]*)?://)?(((.*)?@)?([^/?#]*)?)([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);return{protocol:r[2],auth:r[5],host:r[6],path:r[7],query:r[9],hash:r[11]}},t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e){if(e&&"[object Array]"===Object.prototype.toString.call(e)){for(var t=0;t<e.length;t+=1){var r=e[t];if(!r)return new Error("query object can not have an empty value");if(!r.id)return new Error("'id' field must be present in query object")}return!0}return new Error("invalid query value, 'query' value must be an array")}function o(e,r){var o=[],n={object:null,string:"",number:0};Object.keys(r).forEach(function(i){var s=r[i].split("|").find(function(r){return t(e[i])===r});s&&e[i]!==n[s]||o.push(i)});for(var i="",s=0;s<o.length;s+=1)i+=o[s]+", ";return!(o.length>0)||new Error("fields missing: "+i)}function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e||0!==Object.keys(e).length||e.constructor!==Object?JSON.parse(JSON.stringify(e)):null}function i(e,t){var r={};return e&&(r.index=e),t&&(t.db&&(r.db=t.db),t.collection&&(r.collection=t.collection)),r}function s(e,t){var r={};return t?(Object.assign(r,{"X-Search-Client":"Appbase JS"}),!1===e&&Object.assign(r,{"X-Enable-Telemetry":e}),r):r}var a={MONGODB:"mongodb",ELASTICSEARCH:"elasticsearch"},u="array",d="object",c="boolean",p="string",h=function(e){return(void 0===e?"undefined":t(e))===d?Array.isArray(e)?u:d:void 0===e?"undefined":t(e)};var f={mongodb:{url:{type:p,required:!0},app:{type:p,required:!1},credentials:{type:p,required:!1},enableTelemetry:{type:c,required:!1},mongodb:{type:d,required:!0},username:{type:p,required:!1},password:{type:p,required:!1}},elasticsearch:{url:{type:p,required:!0},app:{type:p,required:!0},credentials:{type:p,required:!1},enableTelemetry:{type:c,required:!1},username:{type:p,required:!1},password:{type:p,required:!1}}};function l(t){var r=e((t.endpoint?t.endpoint.url:t.url)||""),o=r.auth,n=void 0===o?null:o,i=r.host,s=void 0===i?"":i,u=r.path,d=void 0===u?"":u,c=r.protocol,p=void 0===c?"":c,l=t.url;"/"===(l=s+d).slice(-1)&&(l=l.slice(0,-1));var y=a[t.mongodb?"MONGODB":"ELASTICSEARCH"],b=f[y];if(t.endpoint&&function(e){var t=void 0;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}(t.endpoint.url)&&(b.url.required=!1,b.app.required=!1,b.credentials.required=!1),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=Object.keys(e).filter(function(t){return!!e[t]}),n=Object.keys(t),i=[];n.forEach(function(e){t[e].required&&i.push(e)}),i.forEach(function(e){if(!o.includes(e))throw new Error(e+" is required when using the "+r+" Search backend.")}),o.forEach(function(o){if(!n.includes(o))throw new Error(o+" property isn't accepted property by "+r+" backend.");var i=Array.isArray(t[o].type)?t[o].type:[].concat(t[o].type),s=h(e[o]);if(!i.includes(s))throw new Error("The property "+o+" is expected with type(s) ["+i.join(", ")+"], but type was set as "+s+".")})}({url:t.url,app:t.app,credentials:t.credentials,username:t.username,password:t.password,enableTelemetry:t.enableTelemetry,mongodb:t.mongodb},b,y),"string"!=typeof p||""===p)throw new Error("Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io");var m=n||null;if("string"==typeof t.credentials&&""!==t.credentials?m=t.credentials:"string"==typeof t.username&&""!==t.username&&"string"==typeof t.password&&""!==t.password&&(m=t.username+":"+t.password),!t.mongodb&&function(e){return t="scalr.api.appbase.io",-1!==e.indexOf(t);var t}(l)&&null===m)throw new Error("Authentication information is not present. Did you add credentials?");this.url=l,this.protocol=p,this.app=t.app,this.credentials=m,t.mongodb&&(this.mongodb=t.mongodb),"boolean"==typeof t.enableTelemetry&&(this.enableTelemetry=t.enableTelemetry)}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var b=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function m(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function v(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?g(w(e),function(o){var n=encodeURIComponent(m(o))+r;return b(e[o])?g(e[o],function(e){return n+encodeURIComponent(m(e))}).join(t):n+encodeURIComponent(m(e[o]))}).join(t):o?encodeURIComponent(m(o))+r+encodeURIComponent(m(e)):""}function g(e,t){if(e.map)return e.map(t);for(var r=[],o=0;o<e.length;o++)r.push(t(e[o],o));return r}var w=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t};function O(e,t,r,o){t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var i=/\+/g;e=e.split(t);var s=1e3;o&&"number"==typeof o.maxKeys&&(s=o.maxKeys);var a=e.length;s>0&&a>s&&(a=s);for(var u=0;u<a;++u){var d,c,p,h,f=e[u].replace(i,"%20"),l=f.indexOf(r);l>=0?(d=f.substr(0,l),c=f.substr(l+1)):(d=f,c=""),p=decodeURIComponent(d),h=decodeURIComponent(c),y(n,p)?b(n[p])?n[p].push(h):n[p]=[n[p],h]:n[p]=h}return n}var A={encode:v,stringify:v,decode:O,parse:O},E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var j,R,T=(function(e,t){var r="undefined"!=typeof self?self:E,o=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&o.indexOf(Object.prototype.toString.call(e))>-1};function i(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function s(e){return"string"!=typeof e&&(e=String(e)),e}function a(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function d(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function p(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=h(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var e,t,r,o=d(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),o=0;o<t.length;o++)r[o]=String.fromCharCode(t[o]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=i(e),t=s(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},u.prototype.delete=function(e){delete this.map[i(e)]},u.prototype.get=function(e){return e=i(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(i(e))},u.prototype.set=function(e,t){this.map[i(e)]=s(t)},u.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),a(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),a(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),a(e)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var l=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(e,t){var r,o,n=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new u(t.headers)),this.method=(r=t.method||this.method||"GET",o=r.toUpperCase(),l.indexOf(o)>-1?o:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),o=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(n))}}),t}function m(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},f.call(y.prototype),f.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var v=[301,302,303,307,308];m.redirect=function(e,t){if(-1===v.indexOf(t))throw new RangeError("Invalid status code");return new m(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function g(e,o){return new Promise(function(n,i){var s=new y(e,o);if(s.signal&&s.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function d(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new u,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var r=e.split(":"),o=r.shift().trim();if(o){var n=r.join(":").trim();t.append(o,n)}}),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new m(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r.blob&&(a.responseType="blob"),s.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),s.signal&&(s.signal.addEventListener("abort",d),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",d)}),a.send(void 0===s._bodyInit?null:s._bodyInit)})}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=u,e.Request=y,e.Response=m),t.Headers=u,t.Request=y,t.Response=m,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}(o),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var n=o;(t=n.fetch).default=n.fetch,t.fetch=n.fetch,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,e.exports=t}(j={exports:{}},j.exports),j.exports),q=(R=T)&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R;T.fetch,T.Headers,T.Request,T.Response;function _(e){var t=this;return new Promise(function(r,o){var i=n(e);try{var s=i.method,a=i.path,u=i.params,d=i.body,c=i.isRSAPI,p=i.isSuggestionsAPI,h=i.isMongoRequest,f=void 0!==h&&h,l=i.httpRequestTimeout,y=void 0===l?0:l,b=p?".suggestions":t.app,m=d,v=a.endsWith("msearch")||a.endsWith("bulk")?"application/x-ndjson":"application/json",g=Object.assign({},{Accept:"application/json","Content-Type":v},e.headers,t.headers),w=Date.now();t.credentials&&(g.Authorization="Basic "+function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r="",o=0,n=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.charAt(0|n)||(i="=",n%1);r+=i.charAt(63&o>>8-n%1*8)){if((e=t.charCodeAt(n+=.75))>255)throw new Error('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');o=o<<8|e}return r}(t.credentials));var O={method:s,headers:g};if(Array.isArray(m)){var E="";m.forEach(function(e){E+=JSON.stringify(e),E+="\n"}),m=E}else m=JSON.stringify(m)||{};0!==Object.keys(m).length&&(O.body=m);var j={},R="";u&&(R="?"+A.stringify(u));var T=f?t.protocol+"://"+t.url:t.protocol+"://"+t.url+"/"+b+"/"+a+R;return function(e){if(t.transformRequest&&"function"==typeof t.transformRequest){var r=t.transformRequest(e);return r instanceof Promise?r:Promise.resolve(r)}return Promise.resolve(e)}(Object.assign({},{url:T},O)).then(function(e){var t=Object.assign({},e),n=t.url;delete t.url;var i=q(n||T,Object.assign({},t,{headers:c&&!f?Object.assign({},t.headers,{"x-timestamp":(new Date).getTime()}):t.headers})),s=new Promise(function(e,t){y>0&&setTimeout(function(){t(new Error("Request timeout"))},y)});return Promise.race([i,s]).then(function(e){return e.status>=500?o(e):(j=e.headers,e.json().then(function(t){if(e.status>=400)return o(e);if(t&&t.error)return o(t);if(c&&t&&"[object Object]"===Object.prototype.toString.call(t)&&d&&d.query&&d.query instanceof Array){var n=0,i=d.query.filter(function(e){return e.execute||void 0===e.execute}).length;if(t&&Object.keys(t).forEach(function(e){t[e]&&Object.prototype.hasOwnProperty.call(t[e],"error")&&t[e].error&&(n+=1)}),n>0&&i===n)return o(t)}if(t&&t.responses instanceof Array&&t.responses.length===t.responses.filter(function(e){return Object.prototype.hasOwnProperty.call(e,"error")}).length)return o(t);var s=Object.assign({},t,{_timestamp:w,_headers:j});return r(s)}).catch(function(e){return o(e)}))}).catch(function(e){return o(e)})}).catch(function(e){return o(e)})}catch(e){return o(e)}})}function x(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id,u=t.body;delete t.type,delete t.body,delete t.id;var d=void 0;return d=a?s?s+"/"+encodeURIComponent(a):encodeURIComponent(a):s,this.performFetchRequest({method:"POST",path:d,params:t,body:u})}function P(e){var t=n(e),r=o(t,{id:"string|number"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id;delete t.type,delete t.id;var u=s+"/"+encodeURIComponent(a);return this.performFetchRequest({method:"GET",path:u,params:t})}function S(e){var t=n(e),r=o(t,{id:"string|number",body:"object"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id,u=t.body;delete t.type,delete t.id,delete t.body;var d=s+"/"+encodeURIComponent(a)+"/_update";return this.performFetchRequest({method:"POST",path:d,params:t,body:u})}function B(e){var t=n(e),r=o(t,{id:"string|number"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id;delete t.type,delete t.id;var u=s+"/"+encodeURIComponent(a);return this.performFetchRequest({method:"DELETE",path:u,params:t})}function U(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=t.type,s=t.body;delete t.type,delete t.body;var a=void 0;return a=i?i+"/_bulk":"_bulk",this.performFetchRequest({method:"POST",path:a,params:t,body:s})}function I(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=void 0;i=Array.isArray(t.type)?t.type.join():t.type;var s=t.body;delete t.type,delete t.body;var a=void 0;return a=i?i+"/_search":"_search",this.performFetchRequest({method:"POST",path:a,params:t,body:s})}function D(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=void 0;i=Array.isArray(t.type)?t.type.join():t.type;var s=t.body;delete t.type,delete t.body;var a=void 0;return a=i?i+"/_msearch":"_msearch",this.performFetchRequest({method:"POST",path:a,params:t,body:s})}function C(e,t,o){var a=n(t),u=r(e);if(!0!==u)throw u;var d={settings:a,query:e};return this.mongodb&&Object.assign(d,{mongodb:i(this.app,this.mongodb)}),this.performFetchRequest({method:"POST",path:"_reactivesearch",body:d,headers:s(this.enableTelemetry,!this.mongodb),isRSAPI:!0,isMongoRequest:!!this.mongodb,params:o})}function F(e,t,o,a){var u=n(t),d=r(e);if(!0!==d)throw d;var c={settings:u,query:e};return this.mongodb&&Object.assign(c,{mongodb:i(this.app,this.mongodb)}),this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:c,headers:s(this.enableTelemetry,!this.mongodb),isRSAPI:!0,isMongoRequest:!!this.mongodb,params:o,httpRequestTimeout:a||0})}function M(){return this.performFetchRequest({method:"GET",path:"_mapping"})}function k(e,t){var o=n(t),a=r(e);if(!0!==a)throw a;var u={settings:o,query:e};return this.mongodb&&Object.assign(u,{mongodb:i(this.app,this.mongodb)}),this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:u,headers:s(this.enableTelemetry),isRSAPI:!0,isSuggestionsAPI:!0,isMongoRequest:!!this.mongodb})}return function(e){var t=new l(e);return l.prototype.performFetchRequest=_,l.prototype.index=x,l.prototype.get=P,l.prototype.update=S,l.prototype.delete=B,l.prototype.bulk=U,l.prototype.search=I,l.prototype.msearch=D,l.prototype.reactiveSearch=C,l.prototype.reactiveSearchv3=F,l.prototype.getQuerySuggestions=k,l.prototype.getMappings=M,l.prototype.setHeaders=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.headers=t?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={};return t?Object.keys(e).forEach(function(t){r[t]=encodeURI(e[t])}):r=e,r}(e):e},"undefined"!=typeof window&&(window.Appbase=t),t}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Appbase=t()}(this,function(){"use strict";var e=function(e){var t=RegExp("^(([^:/?#]*)?://)?(((.*)?@)?([^/?#]*)?)([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);return{protocol:r[2],auth:r[5],host:r[6],path:r[7],query:r[9],hash:r[11]}},t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e){if(e&&"[object Array]"===Object.prototype.toString.call(e)){for(var t=0;t<e.length;t+=1){var r=e[t];if(!r)return new Error("query object can not have an empty value");if(!r.id)return new Error("'id' field must be present in query object")}return!0}return new Error("invalid query value, 'query' value must be an array")}function o(e,r){var o=[],n={object:null,string:"",number:0};Object.keys(r).forEach(function(i){var s=r[i].split("|").find(function(r){return t(e[i])===r});s&&e[i]!==n[s]||o.push(i)});for(var i="",s=0;s<o.length;s+=1)i+=o[s]+", ";return!(o.length>0)||new Error("fields missing: "+i)}function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e||0!==Object.keys(e).length||e.constructor!==Object?JSON.parse(JSON.stringify(e)):null}function i(e,t){var r={};return e&&(r.index=e),t&&(t.db&&(r.db=t.db),t.collection&&(r.collection=t.collection)),r}function s(e,t){var r={};return t?(Object.assign(r,{"X-Search-Client":"Appbase JS"}),!1===e&&Object.assign(r,{"X-Enable-Telemetry":e}),r):r}var a={MONGODB:"mongodb",ELASTICSEARCH:"elasticsearch"},u="array",d="object",c="boolean",p="string",h=function(e){return(void 0===e?"undefined":t(e))===d?Array.isArray(e)?u:d:void 0===e?"undefined":t(e)};var f={mongodb:{url:{type:p,required:!0},app:{type:p,required:!1},credentials:{type:p,required:!1},enableTelemetry:{type:c,required:!1},mongodb:{type:d,required:!0},username:{type:p,required:!1},password:{type:p,required:!1}},elasticsearch:{url:{type:p,required:!0},app:{type:p,required:!0},credentials:{type:p,required:!1},enableTelemetry:{type:c,required:!1},username:{type:p,required:!1},password:{type:p,required:!1}}};function l(t){var r=e((t.endpoint?t.endpoint.url:t.url)||""),o=r.auth,n=void 0===o?null:o,i=r.host,s=void 0===i?"":i,u=r.path,d=void 0===u?"":u,c=r.protocol,p=void 0===c?"":c,l=t.url;"/"===(l=s+d).slice(-1)&&(l=l.slice(0,-1));var y=a[t.mongodb?"MONGODB":"ELASTICSEARCH"],b=f[y];if(t.endpoint&&function(e){var t=void 0;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}(t.endpoint.url)&&(b.url.required=!1,b.app.required=!1,b.credentials.required=!1),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=Object.keys(e).filter(function(t){return!!e[t]}),n=Object.keys(t),i=[];n.forEach(function(e){t[e].required&&i.push(e)}),i.forEach(function(e){if(!o.includes(e))throw new Error(e+" is required when using the "+r+" Search backend.")}),o.forEach(function(o){if(!n.includes(o))throw new Error(o+" property isn't accepted property by "+r+" backend.");var i=Array.isArray(t[o].type)?t[o].type:[].concat(t[o].type),s=h(e[o]);if(!i.includes(s))throw new Error("The property "+o+" is expected with type(s) ["+i.join(", ")+"], but type was set as "+s+".")})}({url:t.url,app:t.app,credentials:t.credentials,username:t.username,password:t.password,enableTelemetry:t.enableTelemetry,mongodb:t.mongodb},b,y),"string"!=typeof p||""===p)throw new Error("Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io");var m=n||null;if("string"==typeof t.credentials&&""!==t.credentials?m=t.credentials:"string"==typeof t.username&&""!==t.username&&"string"==typeof t.password&&""!==t.password&&(m=t.username+":"+t.password),!t.mongodb&&function(e){return t="scalr.api.appbase.io",-1!==e.indexOf(t);var t}(l)&&null===m)throw new Error("Authentication information is not present. Did you add credentials?");this.url=l,this.protocol=p,this.app=t.app,this.credentials=m,t.mongodb&&(this.mongodb=t.mongodb),t.httpRequestTimeout&&(this.httpRequestTimeout=t.httpRequestTimeout),"boolean"==typeof t.enableTelemetry&&(this.enableTelemetry=t.enableTelemetry)}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var b=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function m(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function v(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?g(w(e),function(o){var n=encodeURIComponent(m(o))+r;return b(e[o])?g(e[o],function(e){return n+encodeURIComponent(m(e))}).join(t):n+encodeURIComponent(m(e[o]))}).join(t):o?encodeURIComponent(m(o))+r+encodeURIComponent(m(e)):""}function g(e,t){if(e.map)return e.map(t);for(var r=[],o=0;o<e.length;o++)r.push(t(e[o],o));return r}var w=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t};function O(e,t,r,o){t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var i=/\+/g;e=e.split(t);var s=1e3;o&&"number"==typeof o.maxKeys&&(s=o.maxKeys);var a=e.length;s>0&&a>s&&(a=s);for(var u=0;u<a;++u){var d,c,p,h,f=e[u].replace(i,"%20"),l=f.indexOf(r);l>=0?(d=f.substr(0,l),c=f.substr(l+1)):(d=f,c=""),p=decodeURIComponent(d),h=decodeURIComponent(c),y(n,p)?b(n[p])?n[p].push(h):n[p]=[n[p],h]:n[p]=h}return n}var A={encode:v,stringify:v,decode:O,parse:O},E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var R,j,T=(function(e,t){var r="undefined"!=typeof self?self:E,o=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&o.indexOf(Object.prototype.toString.call(e))>-1};function i(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function s(e){return"string"!=typeof e&&(e=String(e)),e}function a(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function d(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function p(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=h(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var e,t,r,o=d(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),o=0;o<t.length;o++)r[o]=String.fromCharCode(t[o]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=i(e),t=s(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},u.prototype.delete=function(e){delete this.map[i(e)]},u.prototype.get=function(e){return e=i(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(i(e))},u.prototype.set=function(e,t){this.map[i(e)]=s(t)},u.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),a(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),a(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),a(e)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var l=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(e,t){var r,o,n=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new u(t.headers)),this.method=(r=t.method||this.method||"GET",o=r.toUpperCase(),l.indexOf(o)>-1?o:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),o=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(n))}}),t}function m(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},f.call(y.prototype),f.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var v=[301,302,303,307,308];m.redirect=function(e,t){if(-1===v.indexOf(t))throw new RangeError("Invalid status code");return new m(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function g(e,o){return new Promise(function(n,i){var s=new y(e,o);if(s.signal&&s.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function d(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new u,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var r=e.split(":"),o=r.shift().trim();if(o){var n=r.join(":").trim();t.append(o,n)}}),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new m(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r.blob&&(a.responseType="blob"),s.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),s.signal&&(s.signal.addEventListener("abort",d),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",d)}),a.send(void 0===s._bodyInit?null:s._bodyInit)})}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=u,e.Request=y,e.Response=m),t.Headers=u,t.Request=y,t.Response=m,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}(o),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var n=o;(t=n.fetch).default=n.fetch,t.fetch=n.fetch,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,e.exports=t}(R={exports:{}},R.exports),R.exports),q=(j=T)&&j.__esModule&&Object.prototype.hasOwnProperty.call(j,"default")?j.default:j;T.fetch,T.Headers,T.Request,T.Response;function _(e){var t=this;return new Promise(function(r,o){var i=n(e);try{var s=i.method,a=i.path,u=i.params,d=i.body,c=i.isRSAPI,p=i.isSuggestionsAPI,h=i.isMongoRequest,f=void 0!==h&&h,l=i.httpRequestTimeout,y=void 0===l?0:l,b=p?".suggestions":t.app,m=d,v=a.endsWith("msearch")||a.endsWith("bulk")?"application/x-ndjson":"application/json",g=Object.assign({},{Accept:"application/json","Content-Type":v},e.headers,t.headers),w=Date.now();t.credentials&&(g.Authorization="Basic "+function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r="",o=0,n=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.charAt(0|n)||(i="=",n%1);r+=i.charAt(63&o>>8-n%1*8)){if((e=t.charCodeAt(n+=.75))>255)throw new Error('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');o=o<<8|e}return r}(t.credentials));var O={method:s,headers:g};if(Array.isArray(m)){var E="";m.forEach(function(e){E+=JSON.stringify(e),E+="\n"}),m=E}else m=JSON.stringify(m)||{};0!==Object.keys(m).length&&(O.body=m);var R={},j="";u&&(j="?"+A.stringify(u));var T=f?t.protocol+"://"+t.url:t.protocol+"://"+t.url+"/"+b+"/"+a+j;return function(e){if(t.transformRequest&&"function"==typeof t.transformRequest){var r=t.transformRequest(e);return r instanceof Promise?r:Promise.resolve(r)}return Promise.resolve(e)}(Object.assign({},{url:T},O)).then(function(e){var t=Object.assign({},e),n=t.url;delete t.url;var i=q(n||T,Object.assign({},t,{headers:c&&!f?Object.assign({},t.headers,{"x-timestamp":(new Date).getTime()}):t.headers})),s=new Promise(function(e,t){y>0&&setTimeout(function(){t(new Error("Request timeout"))},y)});return Promise.race([i,s]).then(function(e){return e.status>=500?o(e):(R=e.headers,e.json().then(function(t){if(e.status>=400)return o(e);if(t&&t.error)return o(t);if(c&&t&&"[object Object]"===Object.prototype.toString.call(t)&&d&&d.query&&d.query instanceof Array){var n=0,i=d.query.filter(function(e){return e.execute||void 0===e.execute}).length;if(t&&Object.keys(t).forEach(function(e){t[e]&&Object.prototype.hasOwnProperty.call(t[e],"error")&&t[e].error&&(n+=1)}),n>0&&i===n)return o(t)}if(t&&t.responses instanceof Array&&t.responses.length===t.responses.filter(function(e){return Object.prototype.hasOwnProperty.call(e,"error")}).length)return o(t);var s=Object.assign({},t,{_timestamp:w,_headers:R});return r(s)}).catch(function(e){return o(e)}))}).catch(function(e){return o(e)})}).catch(function(e){return o(e)})}catch(e){return o(e)}})}function x(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id,u=t.body;delete t.type,delete t.body,delete t.id;var d=void 0;return d=a?s?s+"/"+encodeURIComponent(a):encodeURIComponent(a):s,this.performFetchRequest({method:"POST",path:d,params:t,body:u})}function P(e){var t=n(e),r=o(t,{id:"string|number"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id;delete t.type,delete t.id;var u=s+"/"+encodeURIComponent(a);return this.performFetchRequest({method:"GET",path:u,params:t})}function S(e){var t=n(e),r=o(t,{id:"string|number",body:"object"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id,u=t.body;delete t.type,delete t.id,delete t.body;var d=s+"/"+encodeURIComponent(a)+"/_update";return this.performFetchRequest({method:"POST",path:d,params:t,body:u})}function B(e){var t=n(e),r=o(t,{id:"string|number"});if(!0!==r)throw r;var i=t.type,s=void 0===i?"_doc":i,a=t.id;delete t.type,delete t.id;var u=s+"/"+encodeURIComponent(a);return this.performFetchRequest({method:"DELETE",path:u,params:t})}function U(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=t.type,s=t.body;delete t.type,delete t.body;var a=void 0;return a=i?i+"/_bulk":"_bulk",this.performFetchRequest({method:"POST",path:a,params:t,body:s})}function I(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=void 0;i=Array.isArray(t.type)?t.type.join():t.type;var s=t.body;delete t.type,delete t.body;var a=void 0;return a=i?i+"/_search":"_search",this.performFetchRequest({method:"POST",path:a,params:t,body:s})}function D(e){var t=n(e),r=o(t,{body:"object"});if(!0!==r)throw r;var i=void 0;i=Array.isArray(t.type)?t.type.join():t.type;var s=t.body;delete t.type,delete t.body;var a=void 0;return a=i?i+"/_msearch":"_msearch",this.performFetchRequest({method:"POST",path:a,params:t,body:s})}function C(e,t,o){var a=n(t),u=r(e);if(!0!==u)throw u;var d={settings:a,query:e};return this.mongodb&&Object.assign(d,{mongodb:i(this.app,this.mongodb)}),this.performFetchRequest({method:"POST",path:"_reactivesearch",body:d,headers:s(this.enableTelemetry,!this.mongodb),isRSAPI:!0,isMongoRequest:!!this.mongodb,params:o})}function F(e,t,o){var a=n(t),u=r(e);if(!0!==u)throw u;var d={settings:a,query:e};return this.mongodb&&Object.assign(d,{mongodb:i(this.app,this.mongodb)}),this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:d,headers:s(this.enableTelemetry,!this.mongodb),isRSAPI:!0,isMongoRequest:!!this.mongodb,params:o,httpRequestTimeout:this.httpRequestTimeout||0})}function M(){return this.performFetchRequest({method:"GET",path:"_mapping"})}function k(e,t){var o=n(t),a=r(e);if(!0!==a)throw a;var u={settings:o,query:e};return this.mongodb&&Object.assign(u,{mongodb:i(this.app,this.mongodb)}),this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:u,headers:s(this.enableTelemetry),isRSAPI:!0,isSuggestionsAPI:!0,isMongoRequest:!!this.mongodb})}return function(e){var t=new l(e);return l.prototype.performFetchRequest=_,l.prototype.index=x,l.prototype.get=P,l.prototype.update=S,l.prototype.delete=B,l.prototype.bulk=U,l.prototype.search=I,l.prototype.msearch=D,l.prototype.reactiveSearch=C,l.prototype.reactiveSearchv3=F,l.prototype.getQuerySuggestions=k,l.prototype.getMappings=M,l.prototype.setHeaders=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.headers=t?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={};return t?Object.keys(e).forEach(function(t){r[t]=encodeURI(e[t])}):r=e,r}(e):e},"undefined"!=typeof window&&(window.Appbase=t),t}});
//# sourceMappingURL=appbase-js.umd.min.js.map
{
"name": "appbase-js",
"version": "5.3.0",
"version": "5.3.1",
"main": "dist/appbase-js.cjs.js",

@@ -5,0 +5,0 @@ "jsnext:main": "dist/appbase-js.es.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc