Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appbase-js

Package Overview
Dependencies
Maintainers
6
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appbase-js - npm Package Compare versions

Comparing version 4.4.0 to 4.4.1

2

dist/appbase-js.cjs.js

@@ -221,3 +221,3 @@ 'use strict';

'Content-Type': contentType
}, _this.headers, args.headers);
}, args.headers, _this.headers);
var timestamp = Date.now();

@@ -224,0 +224,0 @@ if (_this.credentials) {

@@ -217,3 +217,3 @@ import URL from 'url-parser-lite';

'Content-Type': contentType
}, _this.headers, args.headers);
}, args.headers, _this.headers);
var timestamp = Date.now();

@@ -220,0 +220,0 @@ if (_this.credentials) {

@@ -840,3 +840,3 @@ (function (global, factory) {

'Content-Type': contentType
}, _this.headers, args.headers);
}, args.headers, _this.headers);
var timestamp = Date.now();

@@ -843,0 +843,0 @@ if (_this.credentials) {

@@ -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){var t={};return Object.assign(t,{"X-Search-Client":"Appbase JS"}),!1===e&&Object.assign(t,{"X-Enable-Telemetry":e}),t}function s(t){var r=e(t.url||""),o=r.auth,n=void 0===o?null:o,i=r.host,s=void 0===i?"":i,a=r.path,u=void 0===a?"":a,p=r.protocol,f=void 0===p?"":p,d=s+u;if("string"!=typeof d||""===d)throw new Error("URL not present in options.");if("string"!=typeof t.app||""===t.app)throw new Error("App name is not present in options.");if("string"!=typeof f||""===f)throw new Error("Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io");"/"===d.slice(-1)&&(d=d.slice(0,-1));var h=n||null;if("string"==typeof t.credentials&&""!==t.credentials?h=t.credentials:"string"==typeof t.username&&""!==t.username&&"string"==typeof t.password&&""!==t.password&&(h=t.username+":"+t.password),function(e){return t="scalr.api.appbase.io",-1!==e.indexOf(t);var t}(d)&&null===h)throw new Error("Authentication information is not present. Did you add credentials?");this.url=d,this.protocol=f,this.app=t.app,this.credentials=h,"boolean"==typeof t.enableTelemetry&&(this.enableTelemetry=t.enableTelemetry)}var a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e,t){return e(t={exports:{}},t.exports),t.exports}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var f=function(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 f,d,h,c,y=e[u].replace(i,"%20"),l=y.indexOf(r);l>=0?(f=y.substr(0,l),d=y.substr(l+1)):(f=y,d=""),h=decodeURIComponent(f),c=decodeURIComponent(d),p(n,h)?Array.isArray(n[h])?n[h].push(c):n[h]=[n[h],c]:n[h]=c}return n},d=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},h=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var n=encodeURIComponent(d(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return n+encodeURIComponent(d(e))}).join(t):n+encodeURIComponent(d(e[o]))}).join(t):o?encodeURIComponent(d(o))+r+encodeURIComponent(d(e)):""},c=u(function(e,t){t.decode=t.parse=f,t.encode=t.stringify=h}),y=(c.decode,c.parse,c.encode,c.stringify,u(function(e){var t=function(e){function t(){this.fetch=!1}return t.prototype=e,new t}("undefined"!=typeof self?self:a);(function(e){!function(e){if(!e.fetch){var t={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(t.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=function(e){return e&&DataView.prototype.isPrototypeOf(e)},n=ArrayBuffer.isView||function(e){return e&&r.indexOf(Object.prototype.toString.call(e))>-1};f.prototype.append=function(e,t){e=a(e),t=u(t);var r=this.map[e];this.map[e]=r?r+","+t:t},f.prototype.delete=function(e){delete this.map[a(e)]},f.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},f.prototype.set=function(e,t){this.map[a(e)]=u(t)},f.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},f.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),p(e)},f.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),p(e)},f.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),p(e)},t.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},l.call(b.prototype),l.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:0,statusText:""});return e.type="error",e};var s=[301,302,303,307,308];v.redirect=function(e,t){if(-1===s.indexOf(t))throw new RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})},e.Headers=f,e.Request=b,e.Response=v,e.fetch=function(e,r){return new Promise(function(o,n){var i=new b(e,r),s=new XMLHttpRequest;s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new f,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 s?s.responseURL:r.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;o(new v(n,r))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&t.blob&&(s.responseType="blob"),i.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function a(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 u(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(r[Symbol.iterator]=function(){return r}),r}function f(e){this.map={},e instanceof f?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 h(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function c(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function l(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&o(e))this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!n(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=y(e)}else 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):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.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(c)}),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=h(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)},t.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(e,t){var r,o,n=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new f(t.headers)),this.method=(r=t.method||this.method||"GET",o=r.toUpperCase(),i.indexOf(o)>-1?o:r),this.mode=t.mode||this.mode||null,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 m(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 v(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 f(t.headers),this.url=t.url||"",this._initBody(e)}}(void 0!==e?e:this)}).call(t,void 0);var r=t.fetch;r.Response=t.Response,r.Request=t.Request,r.Headers=t.Headers;e.exports&&(e.exports=r,e.exports.default=r)}));function l(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,p=i.body,f=i.isRSAPI,d=i.isSuggestionsAPI?".suggestions":t.app,h=p,l=a.endsWith("msearch")||a.endsWith("bulk")?"application/x-ndjson":"application/json",b=Object.assign({},{Accept:"application/json","Content-Type":l},t.headers,e.headers),m=Date.now();t.credentials&&(b.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 v={method:s,headers:b};if(Array.isArray(h)){var w="";h.forEach(function(e){w+=JSON.stringify(e),w+="\n"}),h=w}else h=JSON.stringify(h)||{};0!==Object.keys(h).length&&(v.body=h);var g={},A="";u&&(A="?"+c.stringify(u));var j=t.protocol+"://"+t.url+"/"+d+"/"+a+A;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:j},v)).then(function(e){var t=Object.assign({},e),n=t.url;return delete t.url,y(n||j,Object.assign({},t,{headers:f?Object.assign({},t.headers,{"x-timestamp":(new Date).getTime()}):t.headers})).then(function(e){return e.status>=500?o(e):(g=e.headers,e.json().then(function(t){if(e.status>=400)return o(e);if(t&&t.error)return o(t);if(f&&t&&"[object Object]"===Object.prototype.toString.call(t)&&p&&p.query&&p.query instanceof Array){var n=0,i=p.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")&&(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:m,_headers:g});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 b(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 p=void 0;return p=a?s?s+"/"+encodeURIComponent(a):encodeURIComponent(a):s,this.performFetchRequest({method:"POST",path:p,params:t,body:u})}function m(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 v(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 p=s+"/"+encodeURIComponent(a)+"/_update";return this.performFetchRequest({method:"POST",path:p,params:t,body:u})}function w(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 g(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 A(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 j(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 O(e,t){var o=n(t),s=r(e);if(!0!==s)throw s;var a={settings:o,query:e};return this.performFetchRequest({method:"POST",path:"_reactivesearch",body:a,headers:i(this.enableTelemetry),isRSAPI:!0})}function R(e,t){var o=n(t),s=r(e);if(!0!==s)throw s;var a={settings:o,query:e};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:a,headers:i(this.enableTelemetry),isRSAPI:!0})}function T(){return this.performFetchRequest({method:"GET",path:"_mapping"})}function _(e,t){var o=n(t),s=r(e);if(!0!==s)throw s;var a={settings:o,query:e};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:a,headers:i(this.enableTelemetry),isRSAPI:!0,isSuggestionsAPI:!0})}return function(e){var t=new s(e);return s.prototype.performFetchRequest=l,s.prototype.index=b,s.prototype.get=m,s.prototype.update=v,s.prototype.delete=w,s.prototype.bulk=g,s.prototype.search=A,s.prototype.msearch=j,s.prototype.reactiveSearch=O,s.prototype.reactiveSearchv3=R,s.prototype.getQuerySuggestions=_,s.prototype.getMappings=T,s.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){var t={};return Object.assign(t,{"X-Search-Client":"Appbase JS"}),!1===e&&Object.assign(t,{"X-Enable-Telemetry":e}),t}function s(t){var r=e(t.url||""),o=r.auth,n=void 0===o?null:o,i=r.host,s=void 0===i?"":i,a=r.path,u=void 0===a?"":a,p=r.protocol,f=void 0===p?"":p,d=s+u;if("string"!=typeof d||""===d)throw new Error("URL not present in options.");if("string"!=typeof t.app||""===t.app)throw new Error("App name is not present in options.");if("string"!=typeof f||""===f)throw new Error("Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io");"/"===d.slice(-1)&&(d=d.slice(0,-1));var h=n||null;if("string"==typeof t.credentials&&""!==t.credentials?h=t.credentials:"string"==typeof t.username&&""!==t.username&&"string"==typeof t.password&&""!==t.password&&(h=t.username+":"+t.password),function(e){return t="scalr.api.appbase.io",-1!==e.indexOf(t);var t}(d)&&null===h)throw new Error("Authentication information is not present. Did you add credentials?");this.url=d,this.protocol=f,this.app=t.app,this.credentials=h,"boolean"==typeof t.enableTelemetry&&(this.enableTelemetry=t.enableTelemetry)}var a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e,t){return e(t={exports:{}},t.exports),t.exports}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var f=function(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 f,d,h,c,y=e[u].replace(i,"%20"),l=y.indexOf(r);l>=0?(f=y.substr(0,l),d=y.substr(l+1)):(f=y,d=""),h=decodeURIComponent(f),c=decodeURIComponent(d),p(n,h)?Array.isArray(n[h])?n[h].push(c):n[h]=[n[h],c]:n[h]=c}return n},d=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},h=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var n=encodeURIComponent(d(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return n+encodeURIComponent(d(e))}).join(t):n+encodeURIComponent(d(e[o]))}).join(t):o?encodeURIComponent(d(o))+r+encodeURIComponent(d(e)):""},c=u(function(e,t){t.decode=t.parse=f,t.encode=t.stringify=h}),y=(c.decode,c.parse,c.encode,c.stringify,u(function(e){var t=function(e){function t(){this.fetch=!1}return t.prototype=e,new t}("undefined"!=typeof self?self:a);(function(e){!function(e){if(!e.fetch){var t={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(t.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=function(e){return e&&DataView.prototype.isPrototypeOf(e)},n=ArrayBuffer.isView||function(e){return e&&r.indexOf(Object.prototype.toString.call(e))>-1};f.prototype.append=function(e,t){e=a(e),t=u(t);var r=this.map[e];this.map[e]=r?r+","+t:t},f.prototype.delete=function(e){delete this.map[a(e)]},f.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},f.prototype.set=function(e,t){this.map[a(e)]=u(t)},f.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},f.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),p(e)},f.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),p(e)},f.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),p(e)},t.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},l.call(b.prototype),l.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:0,statusText:""});return e.type="error",e};var s=[301,302,303,307,308];v.redirect=function(e,t){if(-1===s.indexOf(t))throw new RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})},e.Headers=f,e.Request=b,e.Response=v,e.fetch=function(e,r){return new Promise(function(o,n){var i=new b(e,r),s=new XMLHttpRequest;s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new f,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 s?s.responseURL:r.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;o(new v(n,r))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&t.blob&&(s.responseType="blob"),i.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function a(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 u(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(r[Symbol.iterator]=function(){return r}),r}function f(e){this.map={},e instanceof f?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 h(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function c(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function l(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&o(e))this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!n(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=y(e)}else 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):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.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(c)}),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=h(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)},t.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(e,t){var r,o,n=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new f(t.headers)),this.method=(r=t.method||this.method||"GET",o=r.toUpperCase(),i.indexOf(o)>-1?o:r),this.mode=t.mode||this.mode||null,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 m(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 v(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 f(t.headers),this.url=t.url||"",this._initBody(e)}}(void 0!==e?e:this)}).call(t,void 0);var r=t.fetch;r.Response=t.Response,r.Request=t.Request,r.Headers=t.Headers;e.exports&&(e.exports=r,e.exports.default=r)}));function l(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,p=i.body,f=i.isRSAPI,d=i.isSuggestionsAPI?".suggestions":t.app,h=p,l=a.endsWith("msearch")||a.endsWith("bulk")?"application/x-ndjson":"application/json",b=Object.assign({},{Accept:"application/json","Content-Type":l},e.headers,t.headers),m=Date.now();t.credentials&&(b.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 v={method:s,headers:b};if(Array.isArray(h)){var w="";h.forEach(function(e){w+=JSON.stringify(e),w+="\n"}),h=w}else h=JSON.stringify(h)||{};0!==Object.keys(h).length&&(v.body=h);var g={},A="";u&&(A="?"+c.stringify(u));var j=t.protocol+"://"+t.url+"/"+d+"/"+a+A;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:j},v)).then(function(e){var t=Object.assign({},e),n=t.url;return delete t.url,y(n||j,Object.assign({},t,{headers:f?Object.assign({},t.headers,{"x-timestamp":(new Date).getTime()}):t.headers})).then(function(e){return e.status>=500?o(e):(g=e.headers,e.json().then(function(t){if(e.status>=400)return o(e);if(t&&t.error)return o(t);if(f&&t&&"[object Object]"===Object.prototype.toString.call(t)&&p&&p.query&&p.query instanceof Array){var n=0,i=p.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")&&(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:m,_headers:g});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 b(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 p=void 0;return p=a?s?s+"/"+encodeURIComponent(a):encodeURIComponent(a):s,this.performFetchRequest({method:"POST",path:p,params:t,body:u})}function m(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 v(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 p=s+"/"+encodeURIComponent(a)+"/_update";return this.performFetchRequest({method:"POST",path:p,params:t,body:u})}function w(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 g(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 A(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 j(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 O(e,t){var o=n(t),s=r(e);if(!0!==s)throw s;var a={settings:o,query:e};return this.performFetchRequest({method:"POST",path:"_reactivesearch",body:a,headers:i(this.enableTelemetry),isRSAPI:!0})}function R(e,t){var o=n(t),s=r(e);if(!0!==s)throw s;var a={settings:o,query:e};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:a,headers:i(this.enableTelemetry),isRSAPI:!0})}function T(){return this.performFetchRequest({method:"GET",path:"_mapping"})}function _(e,t){var o=n(t),s=r(e);if(!0!==s)throw s;var a={settings:o,query:e};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:a,headers:i(this.enableTelemetry),isRSAPI:!0,isSuggestionsAPI:!0})}return function(e){var t=new s(e);return s.prototype.performFetchRequest=l,s.prototype.index=b,s.prototype.get=m,s.prototype.update=v,s.prototype.delete=w,s.prototype.bulk=g,s.prototype.search=A,s.prototype.msearch=j,s.prototype.reactiveSearch=O,s.prototype.reactiveSearchv3=R,s.prototype.getQuerySuggestions=_,s.prototype.getMappings=T,s.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": "4.4.0",
"version": "4.4.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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc