algoliasearch
Advanced tools
Comparing version 3.3.0 to 3.3.1
{ | ||
"name": "algoliasearch", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"homepage": "https://github.com/algolia/algoliasearch-client-js", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -1,2 +0,2 @@ | ||
/*! algoliasearch 3.3.0 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */ | ||
/*! algoliasearch 3.3.1 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */ | ||
(function(g){var l;"undefined"!==typeof window?l=window:"undefined"!==typeof self&&(l=self);l.ALGOLIA_MIGRATION_LAYER=g()})(function(){return function l(e,h,c){function b(f,p){if(!h[f]){if(!e[f]){var n="function"==typeof require&&require;if(!p&&n)return n(f,!0);if(k)return k(f,!0);n=Error("Cannot find module '"+f+"'");throw n.code="MODULE_NOT_FOUND",n;}n=h[f]={exports:{}};e[f][0].call(n.exports,function(c){var k=e[f][1][c];return b(k?k:c)},n,n.exports,l,e,h,c)}return h[f].exports}for(var k="function"== | ||
@@ -22,25 +22,25 @@ typeof require&&require,f=0;f<c.length;f++)b(c[f]);return b}({1:[function(l,e,h){function c(f,b){for(var c in b)f.setAttribute(c,b[c])}function b(f,b){f.onload=function(){this.onerror=this.onload=null;b(null,f)};f.onerror=function(){this.onerror=this.onload=null;b(Error("Failed to load "+this.src),f)}}function k(f,b){f.onreadystatechange=function(){if("complete"==this.readyState||"loaded"==this.readyState)this.onreadystatechange=null,b(null,f)}}e.exports=function(f,e,p){var n=document.head||document.getElementsByTagName("head")[0], | ||
1.5*c?Math.floor(b/c)+" "+f:Math.ceil(b/c)+" "+f+"s"}l.exports=function(b,e){e=e||{};return"string"==typeof b?h(b):e.long?c(b,864E5,"day")||c(b,36E5,"hour")||c(b,6E4,"minute")||c(b,1E3,"second")||b+" ms":864E5<=b?Math.round(b/864E5)+"d":36E5<=b?Math.round(b/36E5)+"h":6E4<=b?Math.round(b/6E4)+"m":1E3<=b?Math.round(b/1E3)+"s":b+"ms"}},{}],8:[function(g,l,e){(function(e,c){(function(){function b(a){return"function"===typeof a}function g(){return function(){e.nextTick(n)}}function f(){var a=0,d=new I(n), | ||
m=document.createTextNode("");d.observe(m,{characterData:!0});return function(){m.data=a=++a%2}}function v(){var a=new MessageChannel;a.port1.onmessage=n;return function(){a.port2.postMessage(0)}}function p(){return function(){setTimeout(n,1)}}function n(){for(var a=0;a<z;a+=2)(0,A[a])(A[a+1]),A[a]=void 0,A[a+1]=void 0;z=0}function r(){}function w(a,d,m,b){try{a.call(d,m,b)}catch(c){return c}}function a(a,d,b){B(function(a){var c=!1,f=w(b,d,function(b){c||(c=!0,d!==b?m(a,b):u(a,b))},function(d){c|| | ||
(c=!0,t(a,d))},"Settle: "+(a._label||" unknown promise"));!c&&f&&(c=!0,t(a,f))},a)}function d(a,d){1===d._state?u(a,d._result):2===a._state?t(a,d._result):C(d,void 0,function(d){m(a,d)},function(d){t(a,d)})}function m(m,c){if(m===c)t(m,new TypeError("You cannot resolve a promise with itself"));else if("function"===typeof c||"object"===typeof c&&null!==c)if(c.constructor===m.constructor)d(m,c);else{var f;try{f=c.then}catch(e){D.error=e,f=D}f===D?t(m,D.error):void 0===f?u(m,c):b(f)?a(m,c,f):u(m,c)}else u(m, | ||
c)}function q(a){a._onerror&&a._onerror(a._result);F(a)}function u(a,d){void 0===a._state&&(a._result=d,a._state=1,0!==a._subscribers.length&&B(F,a))}function t(a,d){void 0===a._state&&(a._state=2,a._result=d,B(q,a))}function C(a,d,m,b){var c=a._subscribers,f=c.length;a._onerror=null;c[f]=d;c[f+1]=m;c[f+2]=b;0===f&&a._state&&B(F,a)}function F(a){var d=a._subscribers,m=a._state;if(0!==d.length){for(var b,c,f=a._result,e=0;e<d.length;e+=3)b=d[e],c=d[e+m],b?J(m,b,c,f):c(f);a._subscribers.length=0}}function K(){this.error= | ||
null}function J(a,d,c,f){var e=b(c),q,g,k,h;if(e){try{q=c(f)}catch(l){G.error=l,q=G}q===G?(h=!0,g=q.error,q=null):k=!0;if(d===q){t(d,new TypeError("A promises callback cannot return that same promise."));return}}else q=f,k=!0;void 0===d._state&&(e&&k?m(d,q):h?t(d,g):1===a?u(d,q):2===a&&t(d,q))}function N(a,d){try{d(function(d){m(a,d)},function(d){t(a,d)})}catch(b){t(a,b)}}function x(a,d,m,b){this._instanceConstructor=a;this.promise=new a(r,b);this._abortOnReject=m;this._validateInput(d)?(this._input= | ||
d,this._remaining=this.length=d.length,this._init(),0===this.length?u(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&u(this.promise,this._result))):t(this.promise,this._validationError())}function y(a){this._id=O++;this._result=this._state=void 0;this._subscribers=[];if(r!==a){if(!b(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof y))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); | ||
N(this,a)}}var L=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},z=0,B=function(a,d){A[z]=a;A[z+1]=d;z+=2;2===z&&M()},E="undefined"!==typeof window?window:{},I=E.MutationObserver||E.WebKitMutationObserver,E="undefined"!==typeof Uint8ClampedArray&&"undefined"!==typeof importScripts&&"undefined"!==typeof MessageChannel,A=Array(1E3),M;M="undefined"!==typeof e&&"[object process]"==={}.toString.call(e)?g():I?f():E?v():p();var D=new K,G=new K;x.prototype._validateInput= | ||
m=document.createTextNode("");d.observe(m,{characterData:!0});return function(){m.data=a=++a%2}}function w(){var a=new MessageChannel;a.port1.onmessage=n;return function(){a.port2.postMessage(0)}}function p(){return function(){setTimeout(n,1)}}function n(){for(var a=0;a<z;a+=2)(0,A[a])(A[a+1]),A[a]=void 0,A[a+1]=void 0;z=0}function r(){}function u(a,d,m,b){try{a.call(d,m,b)}catch(c){return c}}function a(a,d,b){B(function(a){var c=!1,f=u(b,d,function(b){c||(c=!0,d!==b?m(a,b):v(a,b))},function(d){c|| | ||
(c=!0,t(a,d))},"Settle: "+(a._label||" unknown promise"));!c&&f&&(c=!0,t(a,f))},a)}function d(a,d){1===d._state?v(a,d._result):2===a._state?t(a,d._result):C(d,void 0,function(d){m(a,d)},function(d){t(a,d)})}function m(m,c){if(m===c)t(m,new TypeError("You cannot resolve a promise with itself"));else if("function"===typeof c||"object"===typeof c&&null!==c)if(c.constructor===m.constructor)d(m,c);else{var f;try{f=c.then}catch(e){D.error=e,f=D}f===D?t(m,D.error):void 0===f?v(m,c):b(f)?a(m,c,f):v(m,c)}else v(m, | ||
c)}function q(a){a._onerror&&a._onerror(a._result);F(a)}function v(a,d){void 0===a._state&&(a._result=d,a._state=1,0!==a._subscribers.length&&B(F,a))}function t(a,d){void 0===a._state&&(a._state=2,a._result=d,B(q,a))}function C(a,d,m,b){var c=a._subscribers,f=c.length;a._onerror=null;c[f]=d;c[f+1]=m;c[f+2]=b;0===f&&a._state&&B(F,a)}function F(a){var d=a._subscribers,m=a._state;if(0!==d.length){for(var b,c,f=a._result,e=0;e<d.length;e+=3)b=d[e],c=d[e+m],b?J(m,b,c,f):c(f);a._subscribers.length=0}}function K(){this.error= | ||
null}function J(a,d,c,f){var e=b(c),q,g,k,h;if(e){try{q=c(f)}catch(l){G.error=l,q=G}q===G?(h=!0,g=q.error,q=null):k=!0;if(d===q){t(d,new TypeError("A promises callback cannot return that same promise."));return}}else q=f,k=!0;void 0===d._state&&(e&&k?m(d,q):h?t(d,g):1===a?v(d,q):2===a&&t(d,q))}function N(a,d){try{d(function(d){m(a,d)},function(d){t(a,d)})}catch(b){t(a,b)}}function x(a,d,m,b){this._instanceConstructor=a;this.promise=new a(r,b);this._abortOnReject=m;this._validateInput(d)?(this._input= | ||
d,this._remaining=this.length=d.length,this._init(),0===this.length?v(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&v(this.promise,this._result))):t(this.promise,this._validationError())}function y(a){this._id=O++;this._result=this._state=void 0;this._subscribers=[];if(r!==a){if(!b(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof y))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); | ||
N(this,a)}}var L=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},z=0,B=function(a,d){A[z]=a;A[z+1]=d;z+=2;2===z&&M()},E="undefined"!==typeof window?window:{},I=E.MutationObserver||E.WebKitMutationObserver,E="undefined"!==typeof Uint8ClampedArray&&"undefined"!==typeof importScripts&&"undefined"!==typeof MessageChannel,A=Array(1E3),M;M="undefined"!==typeof e&&"[object process]"==={}.toString.call(e)?g():I?f():E?w():p();var D=new K,G=new K;x.prototype._validateInput= | ||
function(a){return L(a)};x.prototype._validationError=function(){return Error("Array Methods must be provided an Array")};x.prototype._init=function(){this._result=Array(this.length)};x.prototype._enumerate=function(){for(var a=this.length,d=this.promise,m=this._input,b=0;void 0===d._state&&b<a;b++)this._eachEntry(m[b],b)};x.prototype._eachEntry=function(a,d){var m=this._instanceConstructor;"object"===typeof a&&null!==a?a.constructor===m&&void 0!==a._state?(a._onerror=null,this._settledAt(a._state, | ||
d,a._result)):this._willSettleAt(m.resolve(a),d):(this._remaining--,this._result[d]=this._makeResult(1,d,a))};x.prototype._settledAt=function(a,d,m){var b=this.promise;void 0===b._state&&(this._remaining--,this._abortOnReject&&2===a?t(b,m):this._result[d]=this._makeResult(a,d,m));0===this._remaining&&u(b,this._result)};x.prototype._makeResult=function(a,d,m){return m};x.prototype._willSettleAt=function(a,d){var m=this;C(a,void 0,function(a){m._settledAt(1,d,a)},function(a){m._settledAt(2,d,a)})}; | ||
d,a._result)):this._willSettleAt(m.resolve(a),d):(this._remaining--,this._result[d]=this._makeResult(1,d,a))};x.prototype._settledAt=function(a,d,m){var b=this.promise;void 0===b._state&&(this._remaining--,this._abortOnReject&&2===a?t(b,m):this._result[d]=this._makeResult(a,d,m));0===this._remaining&&v(b,this._result)};x.prototype._makeResult=function(a,d,m){return m};x.prototype._willSettleAt=function(a,d){var m=this;C(a,void 0,function(a){m._settledAt(1,d,a)},function(a){m._settledAt(2,d,a)})}; | ||
var O=0;y.all=function(a,d){return(new x(this,a,!0,d)).promise};y.race=function(a,d){function b(a){m(f,a)}function c(a){t(f,a)}var f=new this(r,d);if(!L(a))return t(f,new TypeError("You must pass an array to race.")),f;for(var e=a.length,q=0;void 0===f._state&&q<e;q++)C(this.resolve(a[q]),void 0,b,c);return f};y.resolve=function(a,d){if(a&&"object"===typeof a&&a.constructor===this)return a;var b=new this(r,d);m(b,a);return b};y.reject=function(a,d){var m=new this(r,d);t(m,a);return m};y.prototype= | ||
{constructor:y,then:function(a,d){var m=this._state;if(1===m&&!a||2===m&&!d)return this;var b=new this.constructor(r),c=this._result;if(m){var f=arguments[m-1];B(function(){J(m,b,f,c)})}else C(this,b,a,d);return b},"catch":function(a){return this.then(null,a)}};var H={Promise:y,polyfill:function(){var a;a="undefined"!==typeof c?c:"undefined"!==typeof window&&window.document?window:self;"Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var d; | ||
new a.Promise(function(a){d=a});return b(d)}()||(a.Promise=y)}};"function"===typeof define&&define.amd?define(function(){return H}):"undefined"!==typeof l&&l.exports?l.exports=H:"undefined"!==typeof this&&(this.ES6Promise=H)}).call(this)}).call(this,g(1),"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{1:1}],9:[function(g,l,e){var h=Object.prototype.hasOwnProperty,c=Object.prototype.toString,b=g(10),k=function(b){if(!b||"[object Object]"!== | ||
c.call(b))return!1;var e=h.call(b,"constructor"),g=b.constructor&&b.constructor.prototype&&h.call(b.constructor.prototype,"isPrototypeOf");if(b.constructor&&!e&&!g)return!1;for(var k in b);return void 0===k||h.call(b,k)};l.exports=function v(){var c,e,g,h,a,d=arguments[0],m=1,q=arguments.length,u=!1;if("boolean"===typeof d)u=d,d=arguments[1]||{},m=2;else if("object"!==typeof d&&"function"!==typeof d||null==d)d={};for(;m<q;++m)if(c=arguments[m],null!=c)for(e in c)g=d[e],h=c[e],d!==h&&(u&&h&&(k(h)|| | ||
(a=b(h)))?(a?(a=!1,g=g&&b(g)?g:[]):g=g&&k(g)?g:{},d[e]=v(u,g,h)):void 0!==h&&(d[e]=h));return d}},{10:10}],10:[function(g,l,e){l.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],11:[function(g,l,e){var h=Object.prototype.hasOwnProperty,c=Object.prototype.toString;l.exports=function(b,e,f){if("[object Function]"!==c.call(e))throw new TypeError("iterator must be a function");var g=b.length;if(g===+g)for(var l=0;l<g;l++)e.call(f,b[l],l,b);else for(l in b)h.call(b, | ||
c.call(b))return!1;var e=h.call(b,"constructor"),g=b.constructor&&b.constructor.prototype&&h.call(b.constructor.prototype,"isPrototypeOf");if(b.constructor&&!e&&!g)return!1;for(var k in b);return void 0===k||h.call(b,k)};l.exports=function w(){var c,e,g,h,a,d=arguments[0],m=1,q=arguments.length,v=!1;if("boolean"===typeof d)v=d,d=arguments[1]||{},m=2;else if("object"!==typeof d&&"function"!==typeof d||null==d)d={};for(;m<q;++m)if(c=arguments[m],null!=c)for(e in c)g=d[e],h=c[e],d!==h&&(v&&h&&(k(h)|| | ||
(a=b(h)))?(a?(a=!1,g=g&&b(g)?g:[]):g=g&&k(g)?g:{},d[e]=w(v,g,h)):void 0!==h&&(d[e]=h));return d}},{10:10}],10:[function(g,l,e){l.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],11:[function(g,l,e){var h=Object.prototype.hasOwnProperty,c=Object.prototype.toString;l.exports=function(b,e,f){if("[object Function]"!==c.call(e))throw new TypeError("iterator must be a function");var g=b.length;if(g===+g)for(var l=0;l<g;l++)e.call(f,b[l],l,b);else for(l in b)h.call(b, | ||
l)&&e.call(f,b[l],l,b)}},{}],12:[function(g,l,e){l.exports="function"===typeof Object.create?function(e,c){e.super_=c;e.prototype=Object.create(c.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,c){e.super_=c;var b=function(){};b.prototype=c.prototype;e.prototype=new b;e.prototype.constructor=e}},{}],13:[function(g,l,e){(function(e){function c(a,d,m){var c=g(9);if(!a)throw Error("algoliasearch: Please provide an application ID. Usage: algoliasearch(applicationID, apiKey, opts)"); | ||
if(!d)throw Error("algoliasearch: Please provide an API key. Usage: algoliasearch(applicationID, apiKey, opts)");this.applicationID=a;this.apiKey=d;a=[this.applicationID+"-1.algolianet.com",this.applicationID+"-2.algolianet.com",this.applicationID+"-3.algolianet.com"];this.hosts={read:[],write:[]};this.hostIndex={read:0,write:0};m=m||{};d=m.protocol||"https:";var f=void 0===m.timeout?2E3:m.timeout;/:$/.test(d)||(d+=":");if("http:"!==m.protocol&&"https:"!==m.protocol)throw Error("algoliasearch: protocol must be `http:` or `https:` (was `"+ | ||
m.protocol+"`)");m.hosts?(this.hosts.read=c([],m.hosts),this.hosts.write=c([],m.hosts)):(this.hosts.read=[this.applicationID+"-dsn.algolia.net"].concat(a),this.hosts.write=[this.applicationID+".algolia.net"].concat(a));this.hosts.read=b(this.hosts.read,k(d));this.hosts.write=b(this.hosts.write,k(d));this.requestTimeout=f;this.extraHeaders=[];this.cache={};this._ua=m._ua;this._useCache=void 0===m._useCache?!0:m._useCache;this._setTimeout=m._setTimeout;r("init done, %j",this)}function b(a,d){for(var m= | ||
[],b=0;b<a.length;++b)m.push(d(a[b],b));return m}function k(a){return function(d){return a+"//"+d.toLowerCase()}}function f(){throw Error("algoliasearch: Not implemented in this environment.\nIf you feel this is a mistake, write to support@algolia.com");}function v(a,d){var b=a.toLowerCase().replace(".","").replace("()","");return"algoliasearch: `"+a+"` was replaced by `"+d+"`. Please see https://github.com/algolia/algoliasearch-client-js/wiki/Deprecated#"+b}function p(a,d){d(a,0)}function n(a,d){var b= | ||
!1;return function(){b||(console.log(d),b=!0);return a.apply(this,arguments)}}l.exports=c;"development"===e.env.NODE_ENV&&g(5).enable("algoliasearch*");var r=g(5)("algoliasearch"),w=g(11);c.prototype={deleteIndex:function(a,d){return this._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(a),hostType:"write",callback:d})},moveIndex:function(a,d,b){d={operation:"move",destination:d};return this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d, | ||
[],b=0;b<a.length;++b)m.push(d(a[b],b));return m}function k(a){return function(d){return a+"//"+d.toLowerCase()}}function f(){throw Error("algoliasearch: Not implemented in this environment.\nIf you feel this is a mistake, write to support@algolia.com");}function w(a,d){var b=a.toLowerCase().replace(".","").replace("()","");return"algoliasearch: `"+a+"` was replaced by `"+d+"`. Please see https://github.com/algolia/algoliasearch-client-js/wiki/Deprecated#"+b}function p(a,d){d(a,0)}function n(a,d){var b= | ||
!1;return function(){b||(console.log(d),b=!0);return a.apply(this,arguments)}}l.exports=c;"development"===e.env.NODE_ENV&&g(5).enable("algoliasearch*");var r=g(5)("algoliasearch"),u=g(11);c.prototype={deleteIndex:function(a,d){return this._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(a),hostType:"write",callback:d})},moveIndex:function(a,d,b){d={operation:"move",destination:d};return this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d, | ||
hostType:"write",callback:b})},copyIndex:function(a,d,b){d={operation:"copy",destination:d};return this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,hostType:"write",callback:b})},getLogs:function(a,d,b){if(0===arguments.length||"function"===typeof a)b=a,a=0,d=10;else if(1===arguments.length||"function"===typeof d)b=d,d=10;return this._jsonRequest({method:"GET",url:"/1/logs?offset="+a+"&length="+d,hostType:"read",callback:b})},listIndexes:function(a,d){var b= | ||
"";void 0===a||"function"===typeof a?d=a:b="?page="+a;return this._jsonRequest({method:"GET",url:"/1/indexes"+b,hostType:"read",callback:d})},initIndex:function(a){return new this.Index(this,a)},listUserKeys:function(a){return this._jsonRequest({method:"GET",url:"/1/keys",hostType:"read",callback:a})},getUserKeyACL:function(a,d){return this._jsonRequest({method:"GET",url:"/1/keys/"+a,hostType:"read",callback:d})},deleteUserKey:function(a,d){return this._jsonRequest({method:"DELETE",url:"/1/keys/"+ | ||
a,hostType:"write",callback:d})},addUserKey:function(a,d,b){if(1===arguments.length||"function"===typeof d)b=d,d=null;var c={acl:a};d&&(c.validity=d.validity,c.maxQueriesPerIPPerHour=d.maxQueriesPerIPPerHour,c.maxHitsPerQuery=d.maxHitsPerQuery,c.indexes=d.indexes);return this._jsonRequest({method:"POST",url:"/1/keys",body:c,hostType:"write",callback:b})},addUserKeyWithValidity:n(function(a,d,b){return this.addUserKey(a,d,b)},v("client.addUserKeyWithValidity()","client.addUserKey()")),updateUserKey:function(a, | ||
a,hostType:"write",callback:d})},addUserKey:function(a,d,b){if(1===arguments.length||"function"===typeof d)b=d,d=null;var c={acl:a};d&&(c.validity=d.validity,c.maxQueriesPerIPPerHour=d.maxQueriesPerIPPerHour,c.maxHitsPerQuery=d.maxHitsPerQuery,c.indexes=d.indexes);return this._jsonRequest({method:"POST",url:"/1/keys",body:c,hostType:"write",callback:b})},addUserKeyWithValidity:n(function(a,d,b){return this.addUserKey(a,d,b)},w("client.addUserKeyWithValidity()","client.addUserKey()")),updateUserKey:function(a, | ||
d,b,c){if(2===arguments.length||"function"===typeof b)c=b,b=null;var f={acl:d};b&&(f.validity=b.validity,f.maxQueriesPerIPPerHour=b.maxQueriesPerIPPerHour,f.maxHitsPerQuery=b.maxHitsPerQuery,f.indexes=b.indexes);return this._jsonRequest({method:"PUT",url:"/1/keys/"+a,body:f,hostType:"write",callback:c})},setSecurityTags:function(a){if("[object Array]"===Object.prototype.toString.call(a)){for(var d=[],b=0;b<a.length;++b)if("[object Array]"===Object.prototype.toString.call(a[b])){for(var c=[],f=0;f< | ||
a[b].length;++f)c.push(a[b][f]);d.push("("+c.join(",")+")")}else d.push(a[b]);a=d.join(",")}this.securityTags=a},setUserToken:function(a){this.userToken=a},startQueriesBatch:n(function(){this._batch=[]},v("client.startQueriesBatch()","client.search()")),addQueryInBatch:n(function(a,d,b){this._batch.push({indexName:a,query:d,params:b})},v("client.addQueryInBatch()","client.search()")),clearCache:function(){this.cache={}},sendQueriesBatch:n(function(a){return this.search(this._batch,a)},v("client.sendQueriesBatch()", | ||
a[b].length;++f)c.push(a[b][f]);d.push("("+c.join(",")+")")}else d.push(a[b]);a=d.join(",")}this.securityTags=a},setUserToken:function(a){this.userToken=a},startQueriesBatch:n(function(){this._batch=[]},w("client.startQueriesBatch()","client.search()")),addQueryInBatch:n(function(a,d,b){this._batch.push({indexName:a,query:d,params:b})},w("client.addQueryInBatch()","client.search()")),clearCache:function(){this.cache={}},sendQueriesBatch:n(function(a){return this.search(this._batch,a)},w("client.sendQueriesBatch()", | ||
"client.search()")),setRequestTimeout:function(a){a&&(this.requestTimeout=parseInt(a,10))},search:function(a,d){var c=this,f={requests:b(a,function(a){var d="";void 0!==a.query&&(d+="query="+encodeURIComponent(a.query));return{indexName:a.indexName,params:c._getSearchParams(a.params,d)}})};return this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:f,hostType:"read",callback:d})},destroy:f,enableRateLimitForward:f,disableRateLimitForward:f,useSecuredAPIKey:f,disableSecuredAPIKey:f, | ||
@@ -53,3 +53,3 @@ generateSecuredApiKey:f,Index:function(a,d){this.indexName=d;this.as=a;this.typeAheadValueOption=this.typeAheadArgs=null;this.cache={}},setExtraHeader:function(a,d){this.extraHeaders.push({name:a.toLowerCase(),value:d})},_sendQueriesBatch:function(a,d){return this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:a,hostType:"read",fallback:{method:"GET",url:"/1/indexes/*",body:{params:function(){for(var d="",b=0;b<a.requests.length;++b)var c="/1/indexes/"+encodeURIComponent(a.requests[b].indexName)+ | ||
e._setTimeout||setTimeout)});else return h},_getSearchParams:function(a,d){if(this._isUndefined(a)||null===a)return d;for(var b in a)null!==b&&a.hasOwnProperty(b)&&(d+=""===d?"":"&",d+=b+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[b])?JSON.stringify(a[b]):a[b]));return d},_isUndefined:function(a){return void 0===a},_computeRequestHeaders:function(){var a={"x-algolia-api-key":this.apiKey,"x-algolia-application-id":this.applicationID,"x-user-agent":this._ua};this.userToken&& | ||
(a["x-algolia-usertoken"]=this.userToken);this.securityTags&&(a["x-algolia-tagfilters"]=this.securityTags);this.extraHeaders&&w(this.extraHeaders,function(d){a[d.name]=d.value});return a}};c.prototype.Index.prototype={clearCache:function(){this.cache={}},addObject:function(a,d,b){if(1===arguments.length||"function"===typeof d)b=d,d=void 0;return this.as._jsonRequest({method:void 0!==d?"PUT":"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+(void 0!==d?"/"+encodeURIComponent(d):""),body:a, | ||
(a["x-algolia-usertoken"]=this.userToken);this.securityTags&&(a["x-algolia-tagfilters"]=this.securityTags);this.extraHeaders&&u(this.extraHeaders,function(d){a[d.name]=d.value});return a}};c.prototype.Index.prototype={clearCache:function(){this.cache={}},addObject:function(a,d,b){if(1===arguments.length||"function"===typeof d)b=d,d=void 0;return this.as._jsonRequest({method:void 0!==d?"PUT":"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+(void 0!==d?"/"+encodeURIComponent(d):""),body:a, | ||
hostType:"write",callback:b})},addObjects:function(a,d){for(var b={requests:[]},c=0;c<a.length;++c)b.requests.push({action:"addObject",body:a[c]});return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/batch",body:b,hostType:"write",callback:d})},getObject:function(a,d,b){if(1===arguments.length||"function"===typeof d)b=d,d=void 0;var c="";if(void 0!==d)for(var c="?attributes=",f=0;f<d.length;++f)0!==f&&(c+=","),c+=d[f];return this.as._jsonRequest({method:"GET", | ||
@@ -66,13 +66,13 @@ url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/"+encodeURIComponent(a)+c,hostType:"read",callback:b})},getObjects:function(a,d){var c=this,f={requests:b(a,function(a){return{indexName:c.indexName,objectID:a}})};return this.as._jsonRequest({method:"POST",url:"/1/indexes/*/objects",hostType:"read",body:f,callback:d})},partialUpdateObject:function(a,d){return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/"+encodeURIComponent(a.objectID)+"/partial", | ||
"/keys/"+a,hostType:"read",callback:b})},deleteUserKey:function(a,b){return this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/keys/"+a,hostType:"write",callback:b})},addUserKey:function(a,b,c){if(1===arguments.length||"function"===typeof b)c=b,b=null;var f={acl:a};b&&(f.validity=b.validity,f.maxQueriesPerIPPerHour=b.maxQueriesPerIPPerHour,f.maxHitsPerQuery=b.maxHitsPerQuery);return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+ | ||
"/keys",body:f,hostType:"write",callback:c})},addUserKeyWithValidity:n(function(a,b,c){return this.addUserKey(a,b,c)},v("index.addUserKeyWithValidity()","index.addUserKey()")),updateUserKey:function(a,b,c,f){if(2===arguments.length||"function"===typeof c)f=c,c=null;var e={acl:b};c&&(e.validity=c.validity,e.maxQueriesPerIPPerHour=c.maxQueriesPerIPPerHour,e.maxHitsPerQuery=c.maxHitsPerQuery);return this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/keys/"+a,body:e, | ||
"/keys",body:f,hostType:"write",callback:c})},addUserKeyWithValidity:n(function(a,b,c){return this.addUserKey(a,b,c)},w("index.addUserKeyWithValidity()","index.addUserKey()")),updateUserKey:function(a,b,c,f){if(2===arguments.length||"function"===typeof c)f=c,c=null;var e={acl:b};c&&(e.validity=c.validity,e.maxQueriesPerIPPerHour=c.maxQueriesPerIPPerHour,e.maxHitsPerQuery=c.maxHitsPerQuery);return this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/keys/"+a,body:e, | ||
hostType:"write",callback:f})},_search:function(a,b){return this.as._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:{params:a},hostType:"read",fallback:{method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName),body:{params:a}},callback:b})},as:null,indexName:null,typeAheadArgs:null,typeAheadValueOption:null}}).call(this,g(1))},{1:1,11:11,5:5,9:9}],14:[function(g,l,e){l.exports=function(c,b,e){function f(){b.debug("JSONP: success"); | ||
u||a||(u=!0,w||(b.debug("JSONP: Fail. Script loaded but did not call the callback"),l(),e(Error("Failed to load JSONP script"))))}function g(){"loaded"!==this.readyState&&"complete"!==this.readyState||f()}function l(){clearTimeout(t);m.onload=null;m.onreadystatechange=null;m.onerror=null;d.removeChild(m);try{delete window[q],delete window[q+"_loaded"]}catch(a){window[q]=null,window[q+"_loaded"]=null}}function n(){b.debug("JSONP: Script timeout");a=!0;l();e(Error("Timeout - Could not connect to endpoint "+ | ||
c))}function r(){b.debug("JSONP: Script error");u||a||(l(),e(Error("Failed to load JSONP script")))}if("GET"!==b.method)e(Error("Method "+b.method+" "+c+" is not supported by JSONP."));else{b.debug("JSONP: start");var w=!1,a=!1;h+=1;var d=document.getElementsByTagName("head")[0],m=document.createElement("script"),q="algoliaJSONP_"+h,u=!1;window[q]=function(b){try{delete window[q]}catch(d){window[q]=void 0}a||(w=!0,l(),e(null,{body:b}))};c+="&callback="+q;b.jsonBody&&b.jsonBody.params&&(c+="&"+b.jsonBody.params); | ||
var t=setTimeout(n,b.timeout);m.onreadystatechange=g;m.onload=f;m.onerror=r;m.async=!0;m.defer=!0;m.src=c;d.appendChild(m)}};var h=0},{}],15:[function(g,l,e){(function(e){var c=g(12),b=g(13),k=g(18),f=g(14);window.algoliasearch=g(16);e.angular.module("algoliasearch",[]).service("algolia",["$http","$q","$timeout",function(e,h,l){function r(a,b,c){var f=g(9),e=g(17);c=f(!0,{},c)||{};void 0===c.protocol&&(c.protocol=e());c._ua=r.ua;return new w(a,b,c)}function w(){b.apply(this,arguments)}r.version=g(19); | ||
r.ua="Algolia for AngularJS "+r.version;c(w,b);w.prototype._request=function(a,b){return h(function(c,f){var g,t=b.body;a=k(a,b.headers);var r=h(function(f){l(function(){g=!0;f("test");c(Error("Timeout - Could not connect to endpoint "+a))},b.timeout)});e({url:a,method:b.method,data:t,cache:!1,timeout:r}).then(function(a){c({statusCode:a.status,body:a.data})},function(a){g||(0===a.status?f(Error("Network error")):c({body:a.data,statusCode:a.status}))})})};w.prototype._request.fallback=function(a, | ||
b){a=k(a,b.headers);return h(function(c,e){f(a,b,function(a,b){a?e(a):c(b)})})};w.prototype._promise={reject:function(a){return h.reject(a)},resolve:function(a){return h.when(a)},delay:function(a){return h(function(b){l(b,a)})}};return{Client:function(a,b,c){return r(a,b,c)},ua:r.ua,version:r.version}}])}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{12:12,13:13,14:14,16:16,17:17,18:18,19:19,9:9}],16:[function(g,l,e){(function(e){function c(a, | ||
f,e){var h=g(9),k=g(17);e=h(!0,{},e)||{};void 0===e.protocol&&(e.protocol=k());e._ua=c.ua;return new b(a,f,e)}function b(){v.apply(this,arguments)}l.exports=c;var k=g(12),f=e.Promise||g(8).Promise,v=g(13),p=g(18),n=g(14);c.version=g(19);c.ua="Algolia for vanilla JavaScript "+c.version;var r="XDomainRequest"in window,w="withCredentials"in new XMLHttpRequest,a="timeout"in new XMLHttpRequest;k(b,v);b.prototype._request=function(b,c){return new f(function(e,f){function g(){if(!x){a||clearTimeout(v);var b= | ||
null;try{b=JSON.parse(n.responseText)}catch(c){}e({body:b,statusCode:n.status})}}function h(b){x||(a||clearTimeout(v),f(Error("Could not connect to host, error was:"+b)))}function k(){a||(x=!0,n.abort());e(Error("Timeout - Could not connect to endpoint "+b))}if(w||r){b=p(b,c.headers);var l=c.body,n=w?new XMLHttpRequest:new XDomainRequest,v,x;n instanceof XMLHttpRequest?n.open(c.method,b,!0):n.open(c.method,b);w&&l&&"GET"!==c.method&&n.setRequestHeader("content-type","application/x-www-form-urlencoded"); | ||
n.onprogress=function(){};n.onload=g;n.onerror=h;a?(n.timeout=c.timeout,n.ontimeout=k):v=setTimeout(k,c.timeout);n.send(l)}else f(Error("CORS not supported"))})};b.prototype._request.fallback=function(a,b){a=p(a,b.headers);return new f(function(c,e){n(a,b,function(a,b){a?e(a):c(b)})})};b.prototype._promise={reject:function(a){return f.reject(a)},resolve:function(a){return f.resolve(a)},delay:function(a){return new f(function(b){setTimeout(b,a)})}}}).call(this,"undefined"!==typeof global?global:"undefined"!== | ||
v||a||(v=!0,u||(b.debug("JSONP: Fail. Script loaded but did not call the callback"),l(),e(Error("Failed to load JSONP script"))))}function g(){"loaded"!==this.readyState&&"complete"!==this.readyState||f()}function l(){clearTimeout(t);m.onload=null;m.onreadystatechange=null;m.onerror=null;d.removeChild(m);try{delete window[q],delete window[q+"_loaded"]}catch(a){window[q]=null,window[q+"_loaded"]=null}}function n(){b.debug("JSONP: Script timeout");a=!0;l();e(Error("Timeout - Could not connect to endpoint "+ | ||
c))}function r(){b.debug("JSONP: Script error");v||a||(l(),e(Error("Failed to load JSONP script")))}if("GET"!==b.method)e(Error("Method "+b.method+" "+c+" is not supported by JSONP."));else{b.debug("JSONP: start");var u=!1,a=!1;h+=1;var d=document.getElementsByTagName("head")[0],m=document.createElement("script"),q="algoliaJSONP_"+h,v=!1;window[q]=function(b){try{delete window[q]}catch(d){window[q]=void 0}a||(u=!0,l(),e(null,{body:b}))};c+="&callback="+q;b.jsonBody&&b.jsonBody.params&&(c+="&"+b.jsonBody.params); | ||
var t=setTimeout(n,b.timeout);m.onreadystatechange=g;m.onload=f;m.onerror=r;m.async=!0;m.defer=!0;m.src=c;d.appendChild(m)}};var h=0},{}],15:[function(g,l,e){(function(e){var c=g(12),b=g(13),k=g(18),f=g(14);window.algoliasearch=g(16);e.angular.module("algoliasearch",[]).service("algolia",["$http","$q","$timeout",function(e,h,l){function r(a,b,c){var f=g(9),e=g(17);c=f(!0,{},c)||{};void 0===c.protocol&&(c.protocol=e());c._ua=r.ua;return new u(a,b,c)}function u(){b.apply(this,arguments)}r.version=g(19); | ||
r.ua="Algolia for AngularJS "+r.version;c(u,b);u.prototype._request=function(a,b){var c=h.defer(),f=c.resolve,g=c.reject,t,r=b.body;a=k(a,b.headers);var u=h(function(c){l(function(){t=!0;c("test");f(Error("Timeout - Could not connect to endpoint "+a))},b.timeout)});e({url:a,method:b.method,data:r,cache:!1,timeout:u}).then(function(a){f({statusCode:a.status,body:a.data})},function(a){t||(0===a.status?g(Error("Network error")):f({body:a.data,statusCode:a.status}))});return c.promise};u.prototype._request.fallback= | ||
function(a,b){a=k(a,b.headers);return h(function(c,e){f(a,b,function(a,b){a?e(a):c(b)})})};u.prototype._promise={reject:function(a){return h.reject(a)},resolve:function(a){return h.when(a)},delay:function(a){return h(function(b){l(b,a)})}};return{Client:function(a,b,c){return r(a,b,c)},ua:r.ua,version:r.version}}])}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{12:12,13:13,14:14,16:16,17:17,18:18,19:19,9:9}],16:[function(g,l, | ||
e){(function(e){function c(a,f,e){var h=g(9),k=g(17);e=h(!0,{},e)||{};void 0===e.protocol&&(e.protocol=k());e._ua=c.ua;return new b(a,f,e)}function b(){w.apply(this,arguments)}l.exports=c;var k=g(12),f=e.Promise||g(8).Promise,w=g(13),p=g(18),n=g(14);c.version=g(19);c.ua="Algolia for vanilla JavaScript "+c.version;var r="XDomainRequest"in window,u="withCredentials"in new XMLHttpRequest,a="timeout"in new XMLHttpRequest;k(b,w);b.prototype._request=function(b,c){return new f(function(e,f){function g(){if(!x){a|| | ||
clearTimeout(w);var b=null;try{b=JSON.parse(n.responseText)}catch(c){}e({body:b,statusCode:n.status})}}function h(b){x||(a||clearTimeout(w),f(Error("Could not connect to host, error was:"+b)))}function k(){a||(x=!0,n.abort());e(Error("Timeout - Could not connect to endpoint "+b))}if(u||r){b=p(b,c.headers);var l=c.body,n=u?new XMLHttpRequest:new XDomainRequest,w,x;n instanceof XMLHttpRequest?n.open(c.method,b,!0):n.open(c.method,b);u&&l&&"GET"!==c.method&&n.setRequestHeader("content-type","application/x-www-form-urlencoded"); | ||
n.onprogress=function(){};n.onload=g;n.onerror=h;a?(n.timeout=c.timeout,n.ontimeout=k):w=setTimeout(k,c.timeout);n.send(l)}else f(Error("CORS not supported"))})};b.prototype._request.fallback=function(a,b){a=p(a,b.headers);return new f(function(c,e){n(a,b,function(a,b){a?e(a):c(b)})})};b.prototype._promise={reject:function(a){return f.reject(a)},resolve:function(a){return f.resolve(a)},delay:function(a){return new f(function(b){setTimeout(b,a)})}}}).call(this,"undefined"!==typeof global?global:"undefined"!== | ||
typeof self?self:"undefined"!==typeof window?window:{})},{12:12,13:13,14:14,17:17,18:18,19:19,8:8,9:9}],17:[function(g,l,e){(function(e){l.exports=function(){var c=e.document.location.protocol;"http:"!==c&&"https:"!==c&&(c="http:");return c}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],18:[function(g,l,e){l.exports=function(c,b){c=/\?/.test(c)?c+"&":c+"?";return c+h.encode(b)};var h=g(4)},{4:4}],19:[function(g,l,e){l.exports= | ||
"3.3.0"},{}]},{},[15]); | ||
"3.3.1"},{}]},{},[15]); |
@@ -1,2 +0,2 @@ | ||
/*! algoliasearch 3.3.0 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */ | ||
/*! algoliasearch 3.3.1 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */ | ||
(function(g){var h;"undefined"!==typeof window?h=window:"undefined"!==typeof self&&(h=self);h.ALGOLIA_MIGRATION_LAYER=g()})(function(){return function h(d,n,c){function b(f,p){if(!n[f]){if(!d[f]){var l="function"==typeof require&&require;if(!p&&l)return l(f,!0);if(k)return k(f,!0);l=Error("Cannot find module '"+f+"'");throw l.code="MODULE_NOT_FOUND",l;}l=n[f]={exports:{}};d[f][0].call(l.exports,function(c){var k=d[f][1][c];return b(k?k:c)},l,l.exports,h,d,n,c)}return n[f].exports}for(var k="function"== | ||
@@ -75,2 +75,2 @@ typeof require&&require,f=0;f<c.length;f++)b(c[f]);return b}({1:[function(h,d,n){function c(f,b){for(var c in b)f.setAttribute(c,b[c])}function b(f,b){f.onload=function(){this.onerror=this.onload=null;b(null,f)};f.onerror=function(){this.onerror=this.onload=null;b(Error("Failed to load "+this.src),f)}}function k(f,b){f.onreadystatechange=function(){if("complete"==this.readyState||"loaded"==this.readyState)this.onreadystatechange=null,b(null,f)}}d.exports=function(f,d,p){var l=document.head||document.getElementsByTagName("head")[0], | ||
typeof self?self:"undefined"!==typeof window?window:{})},{12:12,13:13,14:14,17:17,18:18,19:19,8:8,9:9}],17:[function(g,h,d){(function(d){h.exports=function(){var c=d.document.location.protocol;"http:"!==c&&"https:"!==c&&(c="http:");return c}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],18:[function(g,h,d){h.exports=function(c,b){c=/\?/.test(c)?c+"&":c+"?";return c+n.encode(b)};var n=g(4)},{4:4}],19:[function(g,h,d){h.exports= | ||
"3.3.0"},{}]},{},[15]); | ||
"3.3.1"},{}]},{},[15]); |
@@ -1,2 +0,2 @@ | ||
/*! algoliasearch 3.3.0 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */ | ||
/*! algoliasearch 3.3.1 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */ | ||
(function(C){var c;"undefined"!==typeof window?c=window:"undefined"!==typeof self&&(c=self);c.ALGOLIA_MIGRATION_LAYER=C()})(function(){return function c(h,e,m){function g(d,k){if(!e[d]){if(!h[d]){var p="function"==typeof require&&require;if(!k&&p)return p(d,!0);if(b)return b(d,!0);p=Error("Cannot find module '"+d+"'");throw p.code="MODULE_NOT_FOUND",p;}p=e[d]={exports:{}};h[d][0].call(p.exports,function(b){var k=h[d][1][b];return g(k?k:b)},p,p.exports,c,h,e,m)}return e[d].exports}for(var b="function"== | ||
@@ -72,2 +72,2 @@ typeof require&&require,k=0;k<m.length;k++)g(m[k]);return g}({1:[function(c,h,e){function m(b,d){for(var g in d)b.setAttribute(g,d[g])}function g(b,d){b.onload=function(){this.onerror=this.onload=null;d(null,b)};b.onerror=function(){this.onerror=this.onload=null;d(Error("Failed to load "+this.src),b)}}function b(b,d){b.onreadystatechange=function(){if("complete"==this.readyState||"loaded"==this.readyState)this.onreadystatechange=null,d(null,b)}}h.exports=function(k,d,c){var p=document.head||document.getElementsByTagName("head")[0], | ||
b.prototype._request.fallback=function(a,b){a=p(a,b.headers);return new d(function(c,d){n(a,b,function(a,b){a?d(a):c(b)})})};b.prototype._promise={reject:function(a){return d.reject(a)},resolve:function(a){return d.resolve(a)},delay:function(a){return new d(function(b){setTimeout(b,a)})}}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{12:12,13:13,14:14,16:16,17:17,18:18,8:8,9:9}],16:[function(c,h,e){(function(c){h.exports=function(){var e= | ||
c.document.location.protocol;"http:"!==e&&"https:"!==e&&(e="http:");return e}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],17:[function(c,h,e){h.exports=function(c,b){c=/\?/.test(c)?c+"&":c+"?";return c+m.encode(b)};var m=c(4)},{4:4}],18:[function(c,h,e){h.exports="3.3.0"},{}]},{},[15])(15)}); | ||
c.document.location.protocol;"http:"!==e&&"https:"!==e&&(e="http:");return e}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],17:[function(c,h,e){h.exports=function(c,b){c=/\?/.test(c)?c+"&":c+"?";return c+m.encode(b)};var m=c(4)},{4:4}],18:[function(c,h,e){h.exports="3.3.1"},{}]},{},[15])(15)}); |
{ | ||
"name": "algoliasearch", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "AlgoliaSearch API JavaScript client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -44,45 +44,51 @@ // This is the AngularJS Algolia Search module | ||
AlgoliaSearchAngular.prototype._request = function(url, opts) { | ||
return $q(function(resolve, reject) { | ||
var timedOut; | ||
var body = opts.body; | ||
// Support most Angular.js versions by using $q.defer() instead | ||
// of the new $q() constructor | ||
var deferred = $q.defer(); | ||
var resolve = deferred.resolve; | ||
var reject = deferred.reject; | ||
url = inlineHeaders(url, opts.headers); | ||
var timedOut; | ||
var body = opts.body; | ||
var timeout = $q(function(resolveTimeout) { | ||
$timeout(function() { | ||
timedOut = true; | ||
// will cancel the xhr | ||
resolveTimeout('test'); | ||
resolve(new Error('Timeout - Could not connect to endpoint ' + url)); | ||
}, opts.timeout); | ||
url = inlineHeaders(url, opts.headers); | ||
var timeout = $q(function(resolveTimeout) { | ||
$timeout(function() { | ||
timedOut = true; | ||
// will cancel the xhr | ||
resolveTimeout('test'); | ||
resolve(new Error('Timeout - Could not connect to endpoint ' + url)); | ||
}, opts.timeout); | ||
}); | ||
$http({ | ||
url: url, | ||
method: opts.method, | ||
data: body, | ||
cache: false, | ||
timeout: timeout | ||
}).then(function success(response) { | ||
resolve({ | ||
statusCode: response.status, | ||
body: response.data | ||
}); | ||
}, function error(response) { | ||
if (timedOut) { | ||
return; | ||
} | ||
$http({ | ||
url: url, | ||
method: opts.method, | ||
data: body, | ||
cache: false, | ||
timeout: timeout | ||
}).then(function success(response) { | ||
resolve({ | ||
statusCode: response.status, | ||
body: response.data | ||
}); | ||
}, function error(response) { | ||
if (timedOut) { | ||
return; | ||
} | ||
// network error | ||
if (response.status === 0) { | ||
reject(new Error('Network error')); | ||
return; | ||
} | ||
// network error | ||
if (response.status === 0) { | ||
reject(new Error('Network error')); | ||
return; | ||
} | ||
resolve({ | ||
body: response.data, | ||
statusCode: response.status | ||
}); | ||
resolve({ | ||
body: response.data, | ||
statusCode: response.status | ||
}); | ||
}); | ||
return deferred.promise; | ||
}; | ||
@@ -89,0 +95,0 @@ |
@@ -1,1 +0,1 @@ | ||
"3.3.0" | ||
"3.3.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
896636
19577