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

contentstack

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contentstack - npm Package Compare versions

Comparing version 1.0.3 to 3.0.0

dist/contentstack-3.0.0.js

6

config.js
module.exports = exports = {
protocol: "https",
host: "api.contentstack.io",
host: "cdn.contentstack.io",
port: 443,
version: "v2",
version: "v3",
urls: {

@@ -11,2 +11,2 @@ content_types: "/content_types/",

}
}
}

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

!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";var Stack=__webpack_require__(1),Utils=__webpack_require__(3),CacheProvider=__webpack_require__(31),Contentstack=function(){};Contentstack.prototype.Stack=Stack.initialize(),Contentstack.prototype.CachePolicy=CacheProvider.policies;var contentstack=new Contentstack;Utils.isBrowser()?window.Contentstack=contentstack:module.exports=contentstack},function(module,exports,__webpack_require__){"use strict";function Stack(){this.config=Config}var Request=__webpack_require__(2),Utils=__webpack_require__(3),cache=__webpack_require__(27),Config=__webpack_require__(29),Entry=__webpack_require__(30),Query=__webpack_require__(33),CacheProvider=__webpack_require__(31);Stack.prototype.setPort=function(port){return"number"==typeof port&&(this.config.port=port),this._environment(this.environment,this.headers.api_key,!0),this},Stack.prototype.setProtocol=function(protocol){return"string"==typeof protocol&&~["https","http"].indexOf(protocol)&&(this.config.protocol=protocol),this._environment(this.environment,this.headers.api_key,!0),this},Stack.prototype.setHost=function(host){return"string"==typeof host&&host&&(this.config.host=host),this._environment(this.environment,this.headers.api_key,!0),this},Stack.prototype.initialize=function(){var self=this;return self.cachePolicy=CacheProvider.policies.IGNORE_CACHE,self.provider=CacheProvider.providers("localstorage"),function(){switch(arguments.length){case 1:if("object"==typeof arguments[0]&&"string"==typeof arguments[0].api_key&&"string"==typeof arguments[0].access_token&&"string"==typeof arguments[0].environment)return self.headers={api_key:arguments[0].api_key,access_token:arguments[0].access_token},self.environment=arguments[0].environment,self._environment(self.environment,self.headers.api_key),self;console.error("Kindly provide valid object parameters.");case 3:if("string"==typeof arguments[0]&&"string"==typeof arguments[1]&&"string"==typeof arguments[2])return self.headers={api_key:arguments[0],access_token:arguments[1]},self.environment=arguments[2],self._environment(self.environment,self.headers.api_key),self;console.error("Kindly provide valid string parameters.");default:console.error("Kindly provide valid parameters to initialize the Built.io Contentstack javascript-SDK Stack.")}}},Stack.prototype._environment=function(env,api_key,force){var self=this,key=api_key+".environment."+env,environmentUid=self.environment_uid||cache.get(key);environmentUid&&!force?self.environment_uid=environmentUid:Request({url:self.config.protocol+"://"+self.config.host+":"+self.config.port+"/"+self.config.version+self.config.urls.environments+env,headers:self.headers}).then(function(data){try{data&&data.environment&&data.environment.uid&&(cache.set(key,data.environment.uid),self.environment_uid=data.environment.uid)}catch(e){console.error("Could not retrieve the environment due to %s error: ",e.message)}})["catch"](function(err){console.error("Could not retrieve the environment due to %s error: ",err.message)})},Stack.prototype.setCachePolicy=function(policy){return"number"==typeof policy&&policy>=-1&&4>policy?this._query?this.queryCachePolicy=policy:this.cachePolicy=policy:console.error("Kindly provide the valid policy"),this},Stack.prototype.setCacheProvider=function(provider){return provider&&"object"==typeof provider&&(this.provider=provider),this},Stack.prototype.clearByQuery=function(){return this.provider&&"function"==typeof this.provider.clearByQuery?this.provider.clearByQuery.apply(this.provider,arguments):void 0},Stack.prototype.clearByContentType=function(){return this.provider&&"function"==typeof this.provider.clearByContentType?this.provider.clearByContentType.apply(this.provider,arguments):void 0},Stack.prototype.clearAll=function(){return this.provider&&"function"==typeof this.provider.clearAll?this.provider.clearAll.apply(this.provider,arguments):void 0},Stack.prototype.getCacheProvider=function(){return this.provider},Stack.prototype.ContentType=function(uid){return uid&&"string"==typeof uid&&(this.content_type_uid=uid),this},Stack.prototype.Entry=function(uid){var entry=new Entry;return uid&&"string"==typeof uid&&(entry.entry_uid=uid),Utils.merge(entry,this)},Stack.prototype.Query=function(){var query=new Query;return Utils.merge(query,this)},Stack.prototype.getLastActivities=function(){var query={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",query:{only_last_activity:!0}}};return this.environment_uid?query.body.query.environment_uid=this.environment_uid:query.body.query.environment=this.environment,Request(query)},module.exports=new Stack},function(module,exports,__webpack_require__){"use strict";function Request(options){var deferred=when.defer(),xhr=new HTTPRequest,method=options.method||"GET",url=options.url,headers=options.headers;xhr.open(method,url,!0),xhr.setRequestHeader("Content-Type","application/json; charset=UTF-8");for(var header in headers)xhr.setRequestHeader(header,headers[header]);return options.body&&"POST"==method||"PUT"==method?"object"==typeof options.body?xhr.send(JSON.stringify(options.body)):xhr.send(options.body):xhr.send(),xhr.onreadystatechange=function(){if(4===xhr.readyState){var error,data=xhr.responseText;try{data=JSON.parse(data)}catch(e){error={error_code:141,message:"Could not parse the response received from the server."}}xhr.status>=200&&xhr.status<300?deferred.resolve(data):deferred.reject(data||error)}},deferred.promise}var HTTPRequest,Utils=__webpack_require__(3),when=__webpack_require__(5);HTTPRequest=Utils.isBrowser()&&XMLHttpRequest?XMLHttpRequest:__webpack_require__(26).XMLHttpRequest,module.exports=Request},function(module,exports,__webpack_require__){(function(process){"use strict";var when=__webpack_require__(5),utils={};module.exports=exports=utils,exports._type=function(val){var _typeof,__typeof=typeof val;switch(__typeof){case"object":_typeof=__typeof,Array.isArray(val)&&(__typeof="array");break;default:_typeof=__typeof}return __typeof},exports.mergeDeep=function(target,source){var self=this,_merge_recursive=function(target,source){for(var key in source)"object"==self._type(source[key])&&self._type(target[key])==self._type(source[key])?_merge_recursive(target[key],source[key]):"array"==self._type(source[key])&&self._type(target[key])==self._type(source[key])?target[key]=target[key].concat(source[key]):target[key]=source[key]};return _merge_recursive(target,source),target},exports.merge=function(target,source){if(target&&source)for(var key in source)target[key]=source[key];return target},exports.setAccessToken=function(entry){if("object"==typeof entry)for(var key in entry)"content_type"===key&&entry.url&&entry.uid?entry.url+=(~entry.url.indexOf("?")?"&":"?")+this.token_queryString:"string"==typeof entry[key]?entry[key]=entry[key].replace(/https:[\/][\/](dev-|stag-|)api.(built|contentstack).io[\/](.*?)[\/]download(.*?)uid=([a-z0-9]+)/gi,function(val){return val+"&"+this.token_queryString}.bind(this)):"object"==typeof entry[key]&&this.setAccessToken(entry[key]);return entry},exports.getData=function(data,token_queryString){return this.token_queryString="AUTHTOKEN="+token_queryString,data&&Array.isArray(data.entries)?data.entries.forEach(function(val){this.setAccessToken(val)}.bind(this)):data&&data.entry&&this.setAccessToken(data.entry),data},exports.isBrowser=function(){return"undefined"!=typeof window&&"object"==typeof process&&"browser"===process.title},exports.parseQueryFromParams=function(queryObject,single,toJSON){if(queryObject&&queryObject.requestParams){var _query=this.merge({},queryObject.requestParams.body?queryObject.requestParams.body.query||{}:{});return _query.environment_uid&&(delete _query.environment_uid,_query.environment=queryObject.environment),{content_type_uid:queryObject.content_type_uid,locale:_query.locale||"en-us",query:_query,entry_uid:queryObject.entry_uid,single:single||"false",toJSON:toJSON||"false",api_key:queryObject.requestParams.headers?queryObject.requestParams.headers.api_key:""}}},exports.getHash=function(query){try{var hashValue=utils.generateHash(JSON.stringify(query)),keyArray=[];return keyArray.push(query.content_type_uid),keyArray.push(query.locale),query.entry_uid&&keyArray.push(query.entry_uid),keyArray.push(hashValue),keyArray.join(".")}catch(e){}},exports.generateHash=function(str){var i,chr,len,hash=0;if(0===str.length)return hash;for(i=0,len=str.length;len>i;i++)chr=str.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return-1>hash?-1*hash:hash},exports.resultWrapper=function(result){var Result=__webpack_require__(25);if(result&&result.entries&&"undefined"!=typeof result.entries)if(result.entries&&result.entries.length)for(var i=0,_i=result.entries.length;_i>i;i++)result.entries[i]=Result(result.entries[i]);else result.entries=[];else result&&"undefined"!=typeof result.entry&&(result.entry=Result(result.entry));return result},exports.spreadResult=function(result){var _results=[];return result&&"object"==typeof result&&Object.keys(result).length&&("undefined"!=typeof result.entries&&_results.push(result.entries),"undefined"!=typeof result.schema&&_results.push(result.schema),"undefined"!=typeof result.count&&_results.push(result.count),"undefined"!=typeof result.entry&&(_results=result.entry)),_results},exports.sendRequest=function(queryObject){var Request=__webpack_require__(2),env_uid=queryObject.environment_uid;env_uid?queryObject._query.environment_uid=env_uid:queryObject._query.environment=queryObject.environment;var spreadResult,deferred=when.defer(),self=queryObject,cachePolicy="undefined"!=typeof self.queryCachePolicy?self.queryCachePolicy:self.cachePolicy,tojson="undefined"!=typeof self.tojson?self.tojson:!1,isSingle=!(!self.entry_uid&&!self.singleEntry),hashQuery=utils.getHash(utils.parseQueryFromParams(self,isSingle,tojson)),getCacheCallback=function(){return function(err,entries){try{if(err)throw err;return tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),deferred.resolve(spreadResult)}catch(e){return deferred.reject(e)}}},callback=function(continueFlag){continueFlag&&Request(queryObject.requestParams).then(function(data){try{self.entry_uid=self.tojson=self.queryCachePolicy=void 0;var entries={};if(queryObject.singleEntry){if(queryObject.singleEntry=!1,data.schema&&(entries.schema=data.schema),!data.entries||!data.entries.length)return 2!==cachePolicy?deferred.reject({error_code:141,error_message:"The requested entry doesn't exist."}):void self.provider.get(hashQuery,getCacheCallback());entries.entry=utils.getData(data,queryObject.headers.access_token).entries[0]}else entries=utils.getData(data,queryObject.headers.access_token);if(-1===cachePolicy)return tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),deferred.resolve(spreadResult);self.provider.set(hashQuery,entries,function(err){try{if(err)throw err;return tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),deferred.resolve(spreadResult)}catch(e){return deferred.reject(e)}})}catch(e){return deferred.reject({message:e.message})}}.bind(self))["catch"](function(error){return 2!==cachePolicy?deferred.reject(error):void self.provider.get(hashQuery,getCacheCallback())})};switch(cachePolicy){case 1:self.provider.get(hashQuery,function(err,_data){try{if(!err&&_data)return tojson||(_data=utils.resultWrapper(_data)),spreadResult=utils.spreadResult(_data),deferred.resolve(spreadResult);callback(!0)}catch(e){return deferred.reject(e)}});break;case 2:case 0:case-1:callback(!0)}return 3!==cachePolicy?deferred.promise:{cache:function(){var Defer=when.defer();return self.provider.get(hashQuery,function(err,_data){try{return err?Defer.reject(err):(tojson||(_data=utils.resultWrapper(_data)),spreadResult=utils.spreadResult(_data),Defer.resolve(spreadResult))}catch(e){return Defer.reject(e)}}),Defer.promise}(),network:function(){return callback(!0),deferred.promise}(),both:function(_callback_){self.provider.get(hashQuery,function(err,entries){tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),_callback_(err,spreadResult)}),Request(queryObject.requestParams).then(function(data){try{self.entry_uid=self.tojson=self.queryCachePolicy=void 0;var entries={},error=null;queryObject.singleEntry?(queryObject.singleEntry=!1,data.schema&&(entries.schema=data.schema),data.entries&&data.entries.length?entries.entry=utils.getData(data,queryObject.headers.access_token).entries[0]:error={error_code:141,error_message:"The requested entry doesn't exist."}):entries=utils.getData(data,queryObject.headers.access_token),tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),_callback_(error,spreadResult)}catch(e){_callback_(e)}}.bind(self))["catch"](function(error){_callback_(error)})}}}}).call(exports,__webpack_require__(4))},function(module,exports){function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=cachedSetTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,cachedClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout=setTimeout}catch(e){cachedSetTimeout=function(){throw new Error("setTimeout is not defined")}}try{cachedClearTimeout=clearTimeout}catch(e){cachedClearTimeout=function(){throw new Error("clearTimeout is not defined")}}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||cachedSetTimeout(drainQueue,0)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function when(x,onFulfilled,onRejected,onProgress){var p=Promise.resolve(x);return arguments.length<2?p:p.then(onFulfilled,onRejected,onProgress)}function promise(resolver){return new Promise(resolver)}function lift(f){return function(){for(var i=0,l=arguments.length,a=new Array(l);l>i;++i)a[i]=arguments[i];return apply(f,this,a)}}function attempt(f){for(var i=0,l=arguments.length-1,a=new Array(l);l>i;++i)a[i]=arguments[i+1];return apply(f,this,a)}function defer(){return new Deferred}function Deferred(){function resolve(x){p._handler.resolve(x)}function reject(x){p._handler.reject(x)}function notify(x){p._handler.notify(x)}var p=Promise._defer();this.promise=p,this.resolve=resolve,this.reject=reject,this.notify=notify,this.resolver={resolve:resolve,reject:reject,notify:notify}}function isPromiseLike(x){return x&&"function"==typeof x.then}function join(){return Promise.all(arguments)}function all(promises){return when(promises,Promise.all)}function settle(promises){return when(promises,Promise.settle)}function map(promises,mapFunc){return when(promises,function(promises){return Promise.map(promises,mapFunc)})}function filter(promises,predicate){return when(promises,function(promises){return Promise.filter(promises,predicate)})}var timed=__webpack_require__(6),array=__webpack_require__(11),flow=__webpack_require__(14),fold=__webpack_require__(15),inspect=__webpack_require__(16),generate=__webpack_require__(17),progress=__webpack_require__(18),withThis=__webpack_require__(19),unhandledRejection=__webpack_require__(20),TimeoutError=__webpack_require__(10),Promise=[array,flow,fold,generate,progress,inspect,withThis,timed,unhandledRejection].reduce(function(Promise,feature){return feature(Promise)},__webpack_require__(22)),apply=__webpack_require__(13)(Promise);return when.promise=promise,when.resolve=Promise.resolve,when.reject=Promise.reject,when.lift=lift,when["try"]=attempt,when.attempt=attempt,when.iterate=Promise.iterate,when.unfold=Promise.unfold,when.join=join,when.all=all,when.settle=settle,when.any=lift(Promise.any),when.some=lift(Promise.some),when.race=lift(Promise.race),when.map=map,when.filter=filter,when.reduce=lift(Promise.reduce),when.reduceRight=lift(Promise.reduceRight),when.isPromiseLike=isPromiseLike,when.Promise=Promise,when.defer=defer,when.TimeoutError=TimeoutError,when}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function setTimeout(f,ms,x,y){return env.setTimer(function(){f(x,y,ms)},ms)}var env=__webpack_require__(7),TimeoutError=__webpack_require__(10);return function(Promise){function handleDelay(ms,x,h){setTimeout(resolveDelay,ms,x,h)}function resolveDelay(x,h){h.resolve(x)}function onTimeout(reason,h,ms){var e="undefined"==typeof reason?new TimeoutError("timed out after "+ms+"ms"):reason;h.reject(e)}return Promise.prototype.delay=function(ms){var p=this._beget();return this._handler.fold(handleDelay,ms,void 0,p._handler),p},Promise.prototype.timeout=function(ms,reason){var p=this._beget(),h=p._handler,t=setTimeout(onTimeout,ms,reason,p._handler);return this._handler.visit(h,function(x){env.clearTimer(t),this.resolve(x)},function(x){env.clearTimer(t),this.reject(x)},h.notify),p},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;(function(process){!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function isNode(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function hasMutationObserver(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function initMutationObserver(MutationObserver){function run(){var f=scheduled;scheduled=void 0,f()}var scheduled,node=document.createTextNode(""),o=new MutationObserver(run);o.observe(node,{characterData:!0});var i=0;return function(f){scheduled=f,node.data=i^=1}}var MutationObs,capturedSetTimeout="undefined"!=typeof setTimeout&&setTimeout,setTimer=function(f,ms){return setTimeout(f,ms)},clearTimer=function(t){return clearTimeout(t)},asap=function(f){return capturedSetTimeout(f,0)};if(isNode())asap=function(f){return process.nextTick(f)};else if(MutationObs=hasMutationObserver())asap=initMutationObserver(MutationObs);else if(!capturedSetTimeout){var vertx=__webpack_require__(8);setTimer=function(f,ms){return vertx.setTimer(ms,f)},clearTimer=vertx.cancelTimer,asap=vertx.runOnLoop||vertx.runOnContext}return{setTimer:setTimer,clearTimer:clearTimer,asap:asap}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))}).call(exports,__webpack_require__(4))},function(module,exports){},function(module,exports){module.exports=function(){throw new Error("define cannot be used indirect")}},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function TimeoutError(message){Error.call(this),this.message=message,this.name=TimeoutError.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,TimeoutError)}return TimeoutError.prototype=Object.create(Error.prototype),TimeoutError.prototype.constructor=TimeoutError,TimeoutError}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){var state=__webpack_require__(12),applier=__webpack_require__(13);return function(Promise){function any(promises){function handleFulfill(x){errors=null,this.resolve(x)}function handleReject(e){this.resolved||(errors.push(e),0===--pending&&this.reject(errors))}for(var h,x,p=Promise._defer(),resolver=p._handler,l=promises.length>>>0,pending=l,errors=[],i=0;l>i;++i)if(x=promises[i],void 0!==x||i in promises){if(h=Promise._handler(x),h.state()>0){resolver.become(h),Promise._visitRemaining(promises,i,h);break}h.visit(resolver,handleFulfill,handleReject)}else--pending;return 0===pending&&resolver.reject(new RangeError("any(): array must not be empty")),p}function some(promises,n){function fulfill(x){this.resolved||(results.push(x),0===--nFulfill&&(errors=null,this.resolve(results)))}function reject(e){this.resolved||(errors.push(e),0===--nReject&&(results=null,this.reject(errors)))}var nReject,x,i,p=Promise._defer(),resolver=p._handler,results=[],errors=[],l=promises.length>>>0,nFulfill=0;for(i=0;l>i;++i)x=promises[i],(void 0!==x||i in promises)&&++nFulfill;for(n=Math.max(n,0),nReject=nFulfill-n+1,nFulfill=Math.min(n,nFulfill),n>nFulfill?resolver.reject(new RangeError("some(): array must contain at least "+n+" item(s), but had "+nFulfill)):0===nFulfill&&resolver.resolve(results),i=0;l>i;++i)x=promises[i],(void 0!==x||i in promises)&&Promise._handler(x).visit(resolver,fulfill,reject,resolver.notify);return p}function map(promises,f){return Promise._traverse(f,promises)}function filter(promises,predicate){var a=slice.call(promises);return Promise._traverse(predicate,a).then(function(keep){return filterSync(a,keep)})}function filterSync(promises,keep){for(var l=keep.length,filtered=new Array(l),i=0,j=0;l>i;++i)keep[i]&&(filtered[j++]=Promise._handler(promises[i]).value);return filtered.length=j,filtered}function settle(promises){return all(promises.map(settleOne))}function settleOne(p){var h=Promise._handler(p);return 0===h.state()?toPromise(p).then(state.fulfilled,state.rejected):(h._unreport(),state.inspect(h))}function reduce(promises,f){return arguments.length>2?ar.call(promises,liftCombine(f),arguments[2]):ar.call(promises,liftCombine(f))}function reduceRight(promises,f){return arguments.length>2?arr.call(promises,liftCombine(f),arguments[2]):arr.call(promises,liftCombine(f))}function liftCombine(f){return function(z,x,i){return applyFold(f,void 0,[z,x,i])}}var applyFold=applier(Promise),toPromise=Promise.resolve,all=Promise.all,ar=Array.prototype.reduce,arr=Array.prototype.reduceRight,slice=Array.prototype.slice;return Promise.any=any,Promise.some=some,Promise.settle=settle,Promise.map=map,Promise.filter=filter,Promise.reduce=reduce,Promise.reduceRight=reduceRight,Promise.prototype.spread=function(onFulfilled){return this.then(all).then(function(array){return onFulfilled.apply(this,array)})},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function toPendingState(){return{state:"pending"}}function toRejectedState(e){return{state:"rejected",reason:e}}function toFulfilledState(x){return{state:"fulfilled",value:x}}function inspect(handler){var state=handler.state();return 0===state?toPendingState():state>0?toFulfilledState(handler.value):toRejectedState(handler.value)}return{pending:toPendingState,fulfilled:toFulfilledState,rejected:toRejectedState,inspect:inspect}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function makeApply(Promise,call){function apply(f,thisArg,args){var p=Promise._defer(),l=args.length,params=new Array(l);return callAndResolve({f:f,thisArg:thisArg,args:args,params:params,i:l-1,call:call},p._handler),p}function callAndResolve(c,h){if(c.i<0)return call(c.f,c.thisArg,c.params,h);var handler=Promise._handler(c.args[c.i]);handler.fold(callAndResolveNext,c,void 0,h)}function callAndResolveNext(c,x,h){c.params[c.i]=x,c.i-=1,callAndResolve(c,h)}return arguments.length<2&&(call=tryCatchResolve),apply}function tryCatchResolve(f,thisArg,args,resolver){try{resolver.resolve(f.apply(thisArg,args))}catch(e){resolver.reject(e)}}return makeApply.tryCatchResolve=tryCatchResolve,makeApply}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function rejectInvalidPredicate(){throw new TypeError("catch predicate must be a function")}function evaluatePredicate(e,predicate){return isError(predicate)?e instanceof predicate:predicate(e)}function isError(predicate){return predicate===Error||null!=predicate&&predicate.prototype instanceof Error}function maybeThenable(x){return("object"==typeof x||"function"==typeof x)&&null!==x}function identity(x){return x}return function(Promise){function createCatchFilter(handler,predicate){return function(e){return evaluatePredicate(e,predicate)?handler.call(this,e):reject(e)}}function runSideEffect(handler,thisArg,propagate,value){var result=handler.call(thisArg);return maybeThenable(result)?propagateValue(result,propagate,value):propagate(value)}function propagateValue(result,propagate,x){return resolve(result).then(function(){return propagate(x)})}var resolve=Promise.resolve,reject=Promise.reject,origCatch=Promise.prototype["catch"];return Promise.prototype.done=function(onResult,onError){this._handler.visit(this._handler.receiver,onResult,onError)},Promise.prototype["catch"]=Promise.prototype.otherwise=function(onRejected){return arguments.length<2?origCatch.call(this,onRejected):"function"!=typeof onRejected?this.ensure(rejectInvalidPredicate):origCatch.call(this,createCatchFilter(arguments[1],onRejected))},Promise.prototype["finally"]=Promise.prototype.ensure=function(handler){return"function"!=typeof handler?this:this.then(function(x){return runSideEffect(handler,this,identity,x)},function(e){return runSideEffect(handler,this,reject,e)})},Promise.prototype["else"]=Promise.prototype.orElse=function(defaultValue){return this.then(void 0,function(){return defaultValue})},Promise.prototype["yield"]=function(value){return this.then(function(){return value})},Promise.prototype.tap=function(onFulfilledSideEffect){return this.then(onFulfilledSideEffect)["yield"](this)},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){return Promise.prototype.fold=function(f,z){var promise=this._beget();return this._handler.fold(function(z,x,to){Promise._handler(z).fold(function(x,z,to){to.resolve(f.call(this,z,x))},x,this,to)},z,promise._handler.receiver,promise._handler),promise},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){var inspect=__webpack_require__(12).inspect;return function(Promise){return Promise.prototype.inspect=function(){return inspect(Promise._handler(this))},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){function iterate(f,condition,handler,x){return unfold(function(x){return[x,f(x)]},condition,handler,x)}function unfold(unspool,condition,handler,x){function next(item,newSeed){return resolve(handler(item)).then(function(){return unfold(unspool,condition,handler,newSeed)})}return resolve(x).then(function(seed){return resolve(condition(seed)).then(function(done){return done?seed:resolve(unspool(seed)).spread(next)})})}var resolve=Promise.resolve;return Promise.iterate=iterate,Promise.unfold=unfold,Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){return Promise.prototype.progress=function(onProgress){return this.then(void 0,void 0,onProgress)},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){return Promise.prototype["with"]=Promise.prototype.withThis=function(receiver){var p=this._beget(),child=p._handler;return child.receiver=receiver,this._handler.chain(child,receiver),p},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function throwit(e){throw e}function noop(){}var setTimer=__webpack_require__(7).setTimer,format=__webpack_require__(21);return function(Promise){function report(r){r.handled||(reported.push(r),logError("Potentially unhandled rejection ["+r.id+"] "+format.formatError(r.value)))}function unreport(r){var i=reported.indexOf(r);i>=0&&(reported.splice(i,1),logInfo("Handled previous rejection ["+r.id+"] "+format.formatObject(r.value)))}function enqueue(f,x){tasks.push(f,x),null===running&&(running=setTimer(flush,0));
}function flush(){for(running=null;tasks.length>0;)tasks.shift()(tasks.shift())}var localConsole,logError=noop,logInfo=noop;"undefined"!=typeof console&&(localConsole=console,logError="undefined"!=typeof localConsole.error?function(e){localConsole.error(e)}:function(e){localConsole.log(e)},logInfo="undefined"!=typeof localConsole.info?function(e){localConsole.info(e)}:function(e){localConsole.log(e)}),Promise.onPotentiallyUnhandledRejection=function(rejection){enqueue(report,rejection)},Promise.onPotentiallyUnhandledRejectionHandled=function(rejection){enqueue(unreport,rejection)},Promise.onFatalRejection=function(rejection){enqueue(throwit,rejection.value)};var tasks=[],reported=[],running=null;return Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function formatError(e){var s="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:formatObject(e);return e instanceof Error?s:s+" (WARNING: non-Error used)"}function formatObject(o){var s=String(o);return"[object Object]"===s&&"undefined"!=typeof JSON&&(s=tryStringify(o,s)),s}function tryStringify(x,defaultValue){try{return JSON.stringify(x)}catch(e){return defaultValue}}return{formatError:formatError,formatObject:formatObject,tryStringify:tryStringify}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){var makePromise=__webpack_require__(23),Scheduler=__webpack_require__(24),async=__webpack_require__(7).asap;return makePromise({scheduler:new Scheduler(async)})}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;(function(process){!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(environment){function Promise(resolver,handler){this._handler=resolver===Handler?handler:init(resolver)}function init(resolver){function promiseResolve(x){handler.resolve(x)}function promiseReject(reason){handler.reject(reason)}function promiseNotify(x){handler.notify(x)}var handler=new Pending;try{resolver(promiseResolve,promiseReject,promiseNotify)}catch(e){promiseReject(e)}return handler}function resolve(x){return isPromise(x)?x:new Promise(Handler,new Async(getHandler(x)))}function reject(x){return new Promise(Handler,new Async(new Rejected(x)))}function never(){return foreverPendingPromise}function defer(){return new Promise(Handler,new Pending)}function begetFrom(parent,Promise){var child=new Pending(parent.receiver,parent.join().context);return new Promise(Handler,child)}function all(promises){return traverseWith(snd,null,promises)}function traverse(f,promises){return traverseWith(tryCatch2,f,promises)}function traverseWith(tryMap,f,promises){function mapAt(i,x,resolver){resolver.resolved||traverseAt(promises,settleAt,i,tryMap(f,x,i),resolver)}function settleAt(i,x,resolver){results[i]=x,0===--pending&&resolver.become(new Fulfilled(results))}for(var x,handler="function"==typeof f?mapAt:settleAt,resolver=new Pending,pending=promises.length>>>0,results=new Array(pending),i=0;i<promises.length&&!resolver.resolved;++i)x=promises[i],void 0!==x||i in promises?traverseAt(promises,handler,i,x,resolver):--pending;return 0===pending&&resolver.become(new Fulfilled(results)),new Promise(Handler,resolver)}function traverseAt(promises,handler,i,x,resolver){if(maybeThenable(x)){var h=getHandlerMaybeThenable(x),s=h.state();0===s?h.fold(handler,i,void 0,resolver):s>0?handler(i,h.value,resolver):(resolver.become(h),visitRemaining(promises,i+1,h))}else handler(i,x,resolver)}function visitRemaining(promises,start,handler){for(var i=start;i<promises.length;++i)markAsHandled(getHandler(promises[i]),handler)}function markAsHandled(h,handler){if(h!==handler){var s=h.state();0===s?h.visit(h,void 0,h._unreport):0>s&&h._unreport()}}function race(promises){return"object"!=typeof promises||null===promises?reject(new TypeError("non-iterable passed to race()")):0===promises.length?never():1===promises.length?resolve(promises[0]):runRace(promises)}function runRace(promises){var i,x,h,resolver=new Pending;for(i=0;i<promises.length;++i)if(x=promises[i],void 0!==x||i in promises){if(h=getHandler(x),0!==h.state()){resolver.become(h),visitRemaining(promises,i+1,h);break}h.visit(resolver,resolver.resolve,resolver.reject)}return new Promise(Handler,resolver)}function getHandler(x){return isPromise(x)?x._handler.join():maybeThenable(x)?getHandlerUntrusted(x):new Fulfilled(x)}function getHandlerMaybeThenable(x){return isPromise(x)?x._handler.join():getHandlerUntrusted(x)}function getHandlerUntrusted(x){try{var untrustedThen=x.then;return"function"==typeof untrustedThen?new Thenable(untrustedThen,x):new Fulfilled(x)}catch(e){return new Rejected(e)}}function Handler(){}function FailIfRejected(){}function Pending(receiver,inheritedContext){Promise.createContext(this,inheritedContext),this.consumers=void 0,this.receiver=receiver,this.handler=void 0,this.resolved=!1}function Async(handler){this.handler=handler}function Thenable(then,thenable){Pending.call(this),tasks.enqueue(new AssimilateTask(then,thenable,this))}function Fulfilled(x){Promise.createContext(this),this.value=x}function Rejected(x){Promise.createContext(this),this.id=++errorId,this.value=x,this.handled=!1,this.reported=!1,this._report()}function ReportTask(rejection,context){this.rejection=rejection,this.context=context}function UnreportTask(rejection){this.rejection=rejection}function cycle(){return new Rejected(new TypeError("Promise cycle"))}function ContinuationTask(continuation,handler){this.continuation=continuation,this.handler=handler}function ProgressTask(value,handler){this.handler=handler,this.value=value}function AssimilateTask(then,thenable,resolver){this._then=then,this.thenable=thenable,this.resolver=resolver}function tryAssimilate(then,thenable,resolve,reject,notify){try{then.call(thenable,resolve,reject,notify)}catch(e){reject(e)}}function Fold(f,z,c,to){this.f=f,this.z=z,this.c=c,this.to=to,this.resolver=failIfRejected,this.receiver=this}function isPromise(x){return x instanceof Promise}function maybeThenable(x){return("object"==typeof x||"function"==typeof x)&&null!==x}function runContinuation1(f,h,receiver,next){return"function"!=typeof f?next.become(h):(Promise.enterContext(h),tryCatchReject(f,h.value,receiver,next),void Promise.exitContext())}function runContinuation3(f,x,h,receiver,next){return"function"!=typeof f?next.become(h):(Promise.enterContext(h),tryCatchReject3(f,x,h.value,receiver,next),void Promise.exitContext())}function runNotify(f,x,h,receiver,next){return"function"!=typeof f?next.notify(x):(Promise.enterContext(h),tryCatchReturn(f,x,receiver,next),void Promise.exitContext())}function tryCatch2(f,a,b){try{return f(a,b)}catch(e){return reject(e)}}function tryCatchReject(f,x,thisArg,next){try{next.become(getHandler(f.call(thisArg,x)))}catch(e){next.become(new Rejected(e))}}function tryCatchReject3(f,x,y,thisArg,next){try{f.call(thisArg,x,y,next)}catch(e){next.become(new Rejected(e))}}function tryCatchReturn(f,x,thisArg,next){try{next.notify(f.call(thisArg,x))}catch(e){next.notify(e)}}function inherit(Parent,Child){Child.prototype=objectCreate(Parent.prototype),Child.prototype.constructor=Child}function snd(x,y){return y}function noop(){}function initEmitRejection(){return"undefined"!=typeof process&&null!==process&&"function"==typeof process.emit?function(type,rejection){return"unhandledRejection"===type?process.emit(type,rejection.value,rejection):process.emit(type,rejection)}:"undefined"!=typeof self&&"function"==typeof CustomEvent?function(noop,self,CustomEvent){var hasCustomEvent=!1;try{var ev=new CustomEvent("unhandledRejection");hasCustomEvent=ev instanceof CustomEvent}catch(e){}return hasCustomEvent?function(type,rejection){var ev=new CustomEvent(type,{detail:{reason:rejection.value,key:rejection},bubbles:!1,cancelable:!0});return!self.dispatchEvent(ev)}:noop}(noop,self,CustomEvent):noop}var tasks=environment.scheduler,emitRejection=initEmitRejection(),objectCreate=Object.create||function(proto){function Child(){}return Child.prototype=proto,new Child};Promise.resolve=resolve,Promise.reject=reject,Promise.never=never,Promise._defer=defer,Promise._handler=getHandler,Promise.prototype.then=function(onFulfilled,onRejected,onProgress){var parent=this._handler,state=parent.join().state();if("function"!=typeof onFulfilled&&state>0||"function"!=typeof onRejected&&0>state)return new this.constructor(Handler,parent);var p=this._beget(),child=p._handler;return parent.chain(child,parent.receiver,onFulfilled,onRejected,onProgress),p},Promise.prototype["catch"]=function(onRejected){return this.then(void 0,onRejected)},Promise.prototype._beget=function(){return begetFrom(this._handler,this.constructor)},Promise.all=all,Promise.race=race,Promise._traverse=traverse,Promise._visitRemaining=visitRemaining,Handler.prototype.when=Handler.prototype.become=Handler.prototype.notify=Handler.prototype.fail=Handler.prototype._unreport=Handler.prototype._report=noop,Handler.prototype._state=0,Handler.prototype.state=function(){return this._state},Handler.prototype.join=function(){for(var h=this;void 0!==h.handler;)h=h.handler;return h},Handler.prototype.chain=function(to,receiver,fulfilled,rejected,progress){this.when({resolver:to,receiver:receiver,fulfilled:fulfilled,rejected:rejected,progress:progress})},Handler.prototype.visit=function(receiver,fulfilled,rejected,progress){this.chain(failIfRejected,receiver,fulfilled,rejected,progress)},Handler.prototype.fold=function(f,z,c,to){this.when(new Fold(f,z,c,to))},inherit(Handler,FailIfRejected),FailIfRejected.prototype.become=function(h){h.fail()};var failIfRejected=new FailIfRejected;inherit(Handler,Pending),Pending.prototype._state=0,Pending.prototype.resolve=function(x){this.become(getHandler(x))},Pending.prototype.reject=function(x){this.resolved||this.become(new Rejected(x))},Pending.prototype.join=function(){if(!this.resolved)return this;for(var h=this;void 0!==h.handler;)if(h=h.handler,h===this)return this.handler=cycle();return h},Pending.prototype.run=function(){var q=this.consumers,handler=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var i=0;i<q.length;++i)handler.when(q[i])},Pending.prototype.become=function(handler){this.resolved||(this.resolved=!0,this.handler=handler,void 0!==this.consumers&&tasks.enqueue(this),void 0!==this.context&&handler._report(this.context))},Pending.prototype.when=function(continuation){this.resolved?tasks.enqueue(new ContinuationTask(continuation,this.handler)):void 0===this.consumers?this.consumers=[continuation]:this.consumers.push(continuation)},Pending.prototype.notify=function(x){this.resolved||tasks.enqueue(new ProgressTask(x,this))},Pending.prototype.fail=function(context){var c="undefined"==typeof context?this.context:context;this.resolved&&this.handler.join().fail(c)},Pending.prototype._report=function(context){this.resolved&&this.handler.join()._report(context)},Pending.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},inherit(Handler,Async),Async.prototype.when=function(continuation){tasks.enqueue(new ContinuationTask(continuation,this))},Async.prototype._report=function(context){this.join()._report(context)},Async.prototype._unreport=function(){this.join()._unreport()},inherit(Pending,Thenable),inherit(Handler,Fulfilled),Fulfilled.prototype._state=1,Fulfilled.prototype.fold=function(f,z,c,to){runContinuation3(f,z,this,c,to)},Fulfilled.prototype.when=function(cont){runContinuation1(cont.fulfilled,this,cont.receiver,cont.resolver)};var errorId=0;inherit(Handler,Rejected),Rejected.prototype._state=-1,Rejected.prototype.fold=function(f,z,c,to){to.become(this)},Rejected.prototype.when=function(cont){"function"==typeof cont.rejected&&this._unreport(),runContinuation1(cont.rejected,this,cont.receiver,cont.resolver)},Rejected.prototype._report=function(context){tasks.afterQueue(new ReportTask(this,context))},Rejected.prototype._unreport=function(){this.handled||(this.handled=!0,tasks.afterQueue(new UnreportTask(this)))},Rejected.prototype.fail=function(context){this.reported=!0,emitRejection("unhandledRejection",this),Promise.onFatalRejection(this,void 0===context?this.context:context)},ReportTask.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,emitRejection("unhandledRejection",this.rejection)||Promise.onPotentiallyUnhandledRejection(this.rejection,this.context))},UnreportTask.prototype.run=function(){this.rejection.reported&&(emitRejection("rejectionHandled",this.rejection)||Promise.onPotentiallyUnhandledRejectionHandled(this.rejection))},Promise.createContext=Promise.enterContext=Promise.exitContext=Promise.onPotentiallyUnhandledRejection=Promise.onPotentiallyUnhandledRejectionHandled=Promise.onFatalRejection=noop;var foreverPendingHandler=new Handler,foreverPendingPromise=new Promise(Handler,foreverPendingHandler);return ContinuationTask.prototype.run=function(){this.handler.join().when(this.continuation)},ProgressTask.prototype.run=function(){var q=this.handler.consumers;if(void 0!==q)for(var c,i=0;i<q.length;++i)c=q[i],runNotify(c.progress,this.value,this.handler,c.receiver,c.resolver)},AssimilateTask.prototype.run=function(){function _resolve(x){h.resolve(x)}function _reject(x){h.reject(x)}function _notify(x){h.notify(x)}var h=this.resolver;tryAssimilate(this._then,this.thenable,_resolve,_reject,_notify)},Fold.prototype.fulfilled=function(x){this.f.call(this.c,this.z,x,this.to)},Fold.prototype.rejected=function(x){this.to.reject(x)},Fold.prototype.progress=function(x){this.to.notify(x)},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))}).call(exports,__webpack_require__(4))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function Scheduler(async){this._async=async,this._running=!1,this._queue=this,this._queueLen=0,this._afterQueue={},this._afterQueueLen=0;var self=this;this.drain=function(){self._drain()}}return Scheduler.prototype.enqueue=function(task){this._queue[this._queueLen++]=task,this.run()},Scheduler.prototype.afterQueue=function(task){this._afterQueue[this._afterQueueLen++]=task,this.run()},Scheduler.prototype.run=function(){this._running||(this._running=!0,this._async(this.drain))},Scheduler.prototype._drain=function(){for(var i=0;i<this._queueLen;++i)this._queue[i].run(),this._queue[i]=void 0;for(this._queueLen=0,this._running=!1,i=0;i<this._afterQueueLen;++i)this._afterQueue[i].run(),this._afterQueue[i]=void 0;this._afterQueueLen=0},Scheduler}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){"use strict";function Result(object){return object&&(this.object=function(){return object}),this}var Utils=__webpack_require__(3);Result.prototype.toJSON=function(){return this.object()?Utils.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null},Result.prototype.get=function(key){if(this.object()&&key){var fields=key.split("."),value=fields.reduce(function(prev,field){return prev[field]},this.object());return value}},module.exports=function(object){return new Result(object)}},function(module,exports){},function(module,exports,__webpack_require__){"use strict";var cacheStorage,Utils=__webpack_require__(3);cacheStorage=Utils.isBrowser()&&localStorage?localStorage:__webpack_require__(28),exports.get=function(key){var data=cacheStorage.getItem(key);try{data=JSON.parse(data)}catch(e){return data}return data||null},exports.set=function(key,data){"object"==typeof data?cacheStorage.setItem(key,JSON.stringify(data)):cacheStorage.setItem(key,data)},exports.getStorage=function(){return cacheStorage||null},exports.getKeys=function(){return cacheStorage?Object.keys(cacheStorage):[]}},function(module,exports){},function(module,exports){module.exports=exports={protocol:"https",host:"api.contentstack.io",port:443,version:"v2",urls:{content_types:"/content_types/",entries:"/entries/",environments:"/environments/"}}},function(module,exports,__webpack_require__){function Entry(){return this._query={},this}var Utils=(__webpack_require__(2),__webpack_require__(3)),_extend=(__webpack_require__(31),function(type){return function(){switch(this._query[type]=this._query[type]||{},arguments.length){case 1:if(Array.isArray(arguments[0])||"string"==typeof arguments[0]){var query=this._query[type].BASE||[];return query=query.concat(arguments[0]),this._query[type].BASE=query,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var query=this._query[type][arguments[0]]||[];return query=query.concat(arguments[1]),this._query[type][arguments[0]]=query,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}});Entry.prototype.only=_extend("only"),Entry.prototype.except=_extend("except"),Entry.prototype.includeReference=function(val){return Array.isArray(val)||"string"==typeof val?(this._query.include=this._query.include||[],this._query.include=this._query.include.concat(val),this):void console.error("Argument should be a String or an Array.")},Entry.prototype.language=function(language_code){return language_code&&"string"==typeof language_code?(this._query.locale=language_code,this):void console.error("Argument should be a String.")},Entry.prototype.addQuery=function(key,value){return key&&value&&"string"==typeof key?(this._query[key]=value,this):void console.error("First argument should be a String.")},Entry.prototype.includeSchema=function(){return this._query.include_schema=!0,this},Entry.prototype.includeOwner=function(){return this._query.include_owner=!0,this},Entry.prototype.toJSON=function(){return this.tojson=!0,this},Entry.prototype.fetch=function(){return this.entry_uid?(this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries+this.entry_uid,body:{_method:"GET",query:this._query}},Utils.sendRequest(this)):void console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')")},module.exports=Entry},function(module,exports,__webpack_require__){"use strict";var CacheProvider={};module.exports=exports=CacheProvider,CacheProvider.providers=function(provider){return provider?__webpack_require__(32):void console.error("Kindly provide valid provider.")},CacheProvider.policies={IGNORE_CACHE:-1,ONLY_NETWORK:0,CACHE_ELSE_NETWORK:1,NETWORK_ELSE_CACHE:2,CACHE_THEN_NETWORK:3}},function(module,exports,__webpack_require__){"use strict";function clearValuesForKey(keyArray,append){!append&&keyArray&&keyArray.length&&keyArray.push("");var _key,keys=cache.getKeys(),storage=cache.getStorage();if(keyArray&&keyArray.length){_key=keyArray.join(".");for(var i=0,_i=keys.length;_i>i;i++)keys[i]&&0===keys[i].indexOf(_key)&&delete storage[keys[i]]}else for(var i=0,_i=keys.length;_i>i;i++)delete storage[keys[i]]}var cache=__webpack_require__(27),localStorage={};module.exports=exports=localStorage,localStorage.get=function(key,callback){try{callback(null,cache.get(key))}catch(e){callback(e)}},localStorage.set=function(key,value,callback){try{key&&value&&cache.set(key,value),callback()}catch(e){callback(e)}},localStorage.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var args=Array.prototype.slice.call(arguments),callback=args.splice(-1,1).pop(),valueArray=[];valueArray.push.apply(valueArray,args),clearValuesForKey(valueArray),callback()}}catch(e){callback(e)}},localStorage.clearByQuery=function(query,callback){try{for(var keys=cache.getKeys(),storage=cache.getStorage(),i=0,_i=keys.length;_i>i;i++)keys[i]&&~keys[i].indexOf(query)&&delete storage[keys[i]];callback()}catch(e){callback(e)}},localStorage.clearAll=function(callback){try{clearValuesForKey(),callback()}catch(e){callback(e)}}},function(module,exports,__webpack_require__){"use strict";function Query(){Entry.call(this),this._query=this._query||{},this._query.query=this._query.query||{}}var Utils=(__webpack_require__(2),__webpack_require__(3)),Entry=__webpack_require__(30),_extend={compare:function(type){return function(key,value){return key&&value&&"string"==typeof key&&"undefined"!=typeof value?(this._query.query[key]=this._query.query[key]||{},this._query.query[key][type]=value,this):void console.error("Kindly provide valid parameters.")}},contained:function(bool){var type=bool?"$in":"$nin";return function(key,value){return key&&value&&"string"==typeof key&&Array.isArray(value)?(this._query.query[key]=this._query.query[key]||{},this._query.query[key][type]=this._query.query[key][type]||[],this._query.query[key][type]=this._query.query[key][type].concat(value),this):void console.error("Kindly provide valid parameters.")}},exists:function(bool){return function(key){return key&&"string"==typeof key?(this._query.query[key]=this._query.query[key]||{},this._query.query[key].$exists=bool,this):void console.error("Kindly provide valid parameters.")}},logical:function(type){return function(){for(var _query=[],i=0,_i=arguments.length;_i>i;i++)arguments[i]instanceof Query&&arguments[i]._query.query?_query.push(arguments[i]._query.query):"object"==typeof arguments[i]&&_query.push(arguments[i]);return this._query.query[type]?this._query.query[type]=this._query.query[type].concat(_query):this._query.query[type]=_query,this}},sort:function(type){return function(key){return key&&"string"==typeof key?(this._query[type]=key,this):void console.error("Argument should be a string.")}},pagination:function(type){return function(value){return"number"==typeof value?(this._query[type]=value,this):void console.error("Argument should be a number.")}}};Query.prototype=Object.create(Entry.prototype),Query.prototype.lessThan=_extend.compare("$lt"),Query.prototype.lessThanOrEqualTo=_extend.compare("$lte"),Query.prototype.greaterThan=_extend.compare("$gt"),Query.prototype.greaterThanOrEqualTo=_extend.compare("$gte"),Query.prototype.equalTo=Query.prototype.where=function(key,value){return key&&value&&"string"==typeof key&&"string"==typeof value?(this._query.query[key]=value,this):void console.error("Kindly provide valid parameters.")},Query.prototype.notEqualTo=_extend.compare("$ne"),Query.prototype.containedIn=_extend.contained(!0),Query.prototype.notContainedIn=_extend.contained(!1),Query.prototype.exists=_extend.exists(!0),Query.prototype.notExists=_extend.exists(!1),Query.prototype.ascending=_extend.sort("asc"),Query.prototype.descending=_extend.sort("desc"),Query.prototype.beforeUid=_extend.sort("before_uid"),Query.prototype.afterUid=_extend.sort("after_uid"),Query.prototype.skip=_extend.pagination("skip"),Query.prototype.limit=_extend.pagination("limit"),Query.prototype.count=function(){return this._query.count=!0,this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries,body:{_method:"GET",query:this._query}},this},Query.prototype.or=_extend.logical("$or"),Query.prototype.and=_extend.logical("$and"),Query.prototype.query=function(query){return"object"==typeof query?(this._query.query=Utils.mergeDeep(this._query.query,query),this):void console.error("Kindly provide valid parameters")},Query.prototype.tags=function(values){return Array.isArray(values)?(this._query.tags=values,this):void console.error("Kindly provide valid parameters")},Query.prototype.includeCount=function(){return this._query.include_count=!0,this},Query.prototype.getQuery=function(){return this._query.query||{}},Query.prototype.regex=function(key,value,options){return key&&value&&"string"==typeof key&&"string"==typeof value?(this._query.query[key]={$regex:value},options&&(this._query.query[key].$options=options),this):void console.error("Kindly provide valid parameters.")},Query.prototype.search=function(value){return value&&"string"==typeof value?(this._query.typeahead=value,this):void console.error("Kindly provide valid parameters.")},Query.prototype.find=function(){return this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries,body:{_method:"GET",query:this._query}},Utils.sendRequest(this)},Query.prototype.findOne=function(){return this.singleEntry=!0,this._query.limit=1,this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries,body:{_method:"GET",query:this._query}},Utils.sendRequest(this)},module.exports=Query}]);
!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";var Stack=__webpack_require__(1),Utils=__webpack_require__(3),CacheProvider=__webpack_require__(31),Contentstack=function(){};Contentstack.prototype.Stack=Stack.initialize(),Contentstack.prototype.CachePolicy=CacheProvider.policies;var contentstack=new Contentstack;Utils.isBrowser()?window.Contentstack=contentstack:module.exports=contentstack},function(module,exports,__webpack_require__){"use strict";function Stack(){this.config=Config}var Request=__webpack_require__(2),Utils=__webpack_require__(3),Config=(__webpack_require__(27),__webpack_require__(29)),Entry=__webpack_require__(30),Query=__webpack_require__(33),CacheProvider=__webpack_require__(31);Stack.prototype.setPort=function(port){return"number"==typeof port&&(this.config.port=port),this},Stack.prototype.setProtocol=function(protocol){return"string"==typeof protocol&&~["https","http"].indexOf(protocol)&&(this.config.protocol=protocol),this},Stack.prototype.setHost=function(host){return"string"==typeof host&&host&&(this.config.host=host),this},Stack.prototype.initialize=function(){var self=this;return self.cachePolicy=CacheProvider.policies.IGNORE_CACHE,self.provider=CacheProvider.providers("localstorage"),function(){switch(arguments.length){case 1:if("object"==typeof arguments[0]&&"string"==typeof arguments[0].api_key&&"string"==typeof arguments[0].access_token&&"string"==typeof arguments[0].environment)return self.headers={api_key:arguments[0].api_key,access_token:arguments[0].access_token},self.environment=arguments[0].environment,self;console.error("Kindly provide valid object parameters.");case 3:if("string"==typeof arguments[0]&&"string"==typeof arguments[1]&&"string"==typeof arguments[2])return self.headers={api_key:arguments[0],access_token:arguments[1]},self.environment=arguments[2],self;console.error("Kindly provide valid string parameters.");default:console.error("Kindly provide valid parameters to initialize the Built.io Contentstack javascript-SDK Stack.")}}},Stack.prototype.setCachePolicy=function(policy){return"number"==typeof policy&&policy>=-1&&policy<4?this._query?this.queryCachePolicy=policy:this.cachePolicy=policy:console.error("Kindly provide the valid policy"),this},Stack.prototype.setCacheProvider=function(provider){return provider&&"object"==typeof provider&&(this.provider=provider),this},Stack.prototype.clearByQuery=function(){if(this.provider&&"function"==typeof this.provider.clearByQuery)return this.provider.clearByQuery.apply(this.provider,arguments)},Stack.prototype.clearByContentType=function(){if(this.provider&&"function"==typeof this.provider.clearByContentType)return this.provider.clearByContentType.apply(this.provider,arguments)},Stack.prototype.clearAll=function(){if(this.provider&&"function"==typeof this.provider.clearAll)return this.provider.clearAll.apply(this.provider,arguments)},Stack.prototype.getCacheProvider=function(){return this.provider},Stack.prototype.ContentType=function(uid){return uid&&"string"==typeof uid&&(this.content_type_uid=uid),this},Stack.prototype.Entry=function(uid){var entry=new Entry;return uid&&"string"==typeof uid&&(entry.entry_uid=uid),Utils.merge(entry,this)},Stack.prototype.Query=function(){var query=new Query;return Utils.merge(query,this)},Stack.prototype.getLastActivities=function(){var query={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return Request(query)},module.exports=new Stack},function(module,exports,__webpack_require__){"use strict";function Request(options){var serialize=function(obj,prefix){var p,str=[];for(p in obj)if(obj.hasOwnProperty(p)){var k=prefix?prefix+"["+p+"]":p,v=obj[p];str.push(null!==v&&"object"==typeof v&&"query"!==p?serialize(v,k):encodeURIComponent(k)+"="+("query"!==p?encodeURIComponent(v):JSON.stringify(v)))}return str.join("&")},deferred=when.defer(),xhr=new HTTPRequest,method="GET",url=options.url,headers=options.headers;if(options.body&&"object"==typeof options.body){delete options.body._method;var queryParams=serialize(options.body)}xhr.open(method,url+"?"+queryParams,!0),xhr.setRequestHeader("Content-Type","application/json; charset=UTF-8");for(var header in headers)xhr.setRequestHeader(header,headers[header]);return options.body&&"POST"==method||"PUT"==method?"object"==typeof options.body?xhr.send(JSON.stringify(options.body)):xhr.send(options.body):xhr.send(),xhr.onreadystatechange=function(){if(4===xhr.readyState){var error,data=xhr.responseText;try{data=JSON.parse(data)}catch(e){error={error_code:141,message:"Could not parse the response received from the server."}}xhr.status>=200&&xhr.status<300?deferred.resolve(data):deferred.reject(data||error)}},deferred.promise}var HTTPRequest,Utils=__webpack_require__(3),when=__webpack_require__(5);HTTPRequest=Utils.isBrowser()&&XMLHttpRequest?XMLHttpRequest:__webpack_require__(26).XMLHttpRequest,module.exports=Request},function(module,exports,__webpack_require__){(function(process){"use strict";var when=__webpack_require__(5),utils={};module.exports=exports=utils,exports._type=function(val){var _typeof,__typeof=typeof val;switch(__typeof){case"object":_typeof=__typeof,Array.isArray(val)&&(__typeof="array");break;default:_typeof=__typeof}return __typeof},exports.mergeDeep=function(target,source){var self=this,_merge_recursive=function(target,source){for(var key in source)"object"==self._type(source[key])&&self._type(target[key])==self._type(source[key])?_merge_recursive(target[key],source[key]):"array"==self._type(source[key])&&self._type(target[key])==self._type(source[key])?target[key]=target[key].concat(source[key]):target[key]=source[key]};return _merge_recursive(target,source),target},exports.merge=function(target,source){if(target&&source)for(var key in source)target[key]=source[key];return target},exports.setAccessToken=function(entry){if("object"==typeof entry)for(var key in entry)"content_type"===key&&entry.url&&entry.uid?entry.url+=(~entry.url.indexOf("?")?"&":"?")+this.token_queryString:"string"==typeof entry[key]?entry[key]=entry[key].replace(/https:[\/][\/](dev-|stag-|)api.(built|contentstack).io[\/](.*?)[\/]download(.*?)uid=([a-z0-9]+)/gi,function(val){return val+"&"+this.token_queryString}.bind(this)):"object"==typeof entry[key]&&this.setAccessToken(entry[key]);return entry},exports.getData=function(data,token_queryString){return this.token_queryString="AUTHTOKEN="+token_queryString,data&&Array.isArray(data.entries)?data.entries.forEach(function(val){this.setAccessToken(val)}.bind(this)):data&&data.entry&&this.setAccessToken(data.entry),data},exports.isBrowser=function(){return"undefined"!=typeof window&&"object"==typeof process&&"browser"===process.title},exports.parseQueryFromParams=function(queryObject,single,toJSON){if(queryObject&&queryObject.requestParams){var _query=this.merge({},queryObject.requestParams.body?queryObject.requestParams.body.query||{}:{});return _query.environment_uid&&(delete _query.environment_uid,_query.environment=queryObject.environment),_query.environment=queryObject.environment,{content_type_uid:queryObject.content_type_uid,locale:_query.locale||"en-us",query:_query,entry_uid:queryObject.entry_uid,single:single||"false",toJSON:toJSON||"false",api_key:queryObject.requestParams.headers?queryObject.requestParams.headers.api_key:""}}},exports.getHash=function(query){try{var hashValue=utils.generateHash(JSON.stringify(query)),keyArray=[];return keyArray.push(query.content_type_uid),keyArray.push(query.locale),query.entry_uid&&keyArray.push(query.entry_uid),keyArray.push(hashValue),keyArray.join(".")}catch(e){}},exports.generateHash=function(str){var i,chr,len,hash=0;if(0===str.length)return hash;for(i=0,len=str.length;i<len;i++)chr=str.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return hash<-1?hash*-1:hash},exports.resultWrapper=function(result){var Result=__webpack_require__(25);if(result&&result.entries&&"undefined"!=typeof result.entries)if(result.entries&&result.entries.length)for(var i=0,_i=result.entries.length;i<_i;i++)result.entries[i]=Result(result.entries[i]);else result.entries=[];else result&&"undefined"!=typeof result.entry&&(result.entry=Result(result.entry));return result},exports.spreadResult=function(result){var _results=[];return result&&"object"==typeof result&&Object.keys(result).length&&("undefined"!=typeof result.entries&&_results.push(result.entries),"undefined"!=typeof result.schema&&_results.push(result.schema),"undefined"!=typeof result.count&&_results.push(result.count),"undefined"!=typeof result.entry&&(_results=result.entry)),_results},exports.sendRequest=function(queryObject){var Request=__webpack_require__(2),env_uid=queryObject.environment_uid;env_uid?queryObject._query.environment_uid=env_uid:queryObject._query.environment=queryObject.environment;var spreadResult,deferred=when.defer(),self=queryObject,cachePolicy="undefined"!=typeof self.queryCachePolicy?self.queryCachePolicy:self.cachePolicy,tojson="undefined"!=typeof self.tojson&&self.tojson,isSingle=!(!self.entry_uid&&!self.singleEntry),hashQuery=utils.getHash(utils.parseQueryFromParams(self,isSingle,tojson));if(queryObject&&queryObject.requestParams&&queryObject.requestParams.body&&queryObject.requestParams.body.query){var cloneQueryObj=JSON.parse(JSON.stringify(queryObject.requestParams.body.query));"object"!=typeof cloneQueryObj&&(cloneQueryObj=JSON.parse(cloneQueryObj)),delete queryObject.requestParams.body.query,queryObject.requestParams.body=this.merge(queryObject.requestParams.body,cloneQueryObj)}var getCacheCallback=function(){return function(err,entries){try{if(err)throw err;return tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),deferred.resolve(spreadResult)}catch(e){return deferred.reject(e)}}},callback=function(continueFlag){continueFlag&&Request(queryObject.requestParams).then(function(data){try{self.entry_uid=self.tojson=self.queryCachePolicy=void 0;var entries={};if(queryObject.singleEntry){if(queryObject.singleEntry=!1,data.schema&&(entries.schema=data.schema),!data.entries||!data.entries.length)return 2!==cachePolicy?deferred.reject({error_code:141,error_message:"The requested entry doesn't exist."}):void self.provider.get(hashQuery,getCacheCallback());entries.entry=utils.getData(data,queryObject.headers.access_token).entries[0]}else entries=utils.getData(data,queryObject.headers.access_token);if(cachePolicy===-1)return tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),deferred.resolve(spreadResult);self.provider.set(hashQuery,entries,function(err){try{if(err)throw err;return tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),deferred.resolve(spreadResult)}catch(e){return deferred.reject(e)}})}catch(e){return deferred.reject({message:e.message})}}.bind(self)).catch(function(error){return 2!==cachePolicy?deferred.reject(error):void self.provider.get(hashQuery,getCacheCallback())})};switch(cachePolicy){case 1:self.provider.get(hashQuery,function(err,_data){try{if(!err&&_data)return tojson||(_data=utils.resultWrapper(_data)),spreadResult=utils.spreadResult(_data),deferred.resolve(spreadResult);callback(!0)}catch(e){return deferred.reject(e)}});break;case 2:case 0:case-1:callback(!0)}return 3!==cachePolicy?deferred.promise:{cache:function(){var Defer=when.defer();return self.provider.get(hashQuery,function(err,_data){try{return err?Defer.reject(err):(tojson||(_data=utils.resultWrapper(_data)),spreadResult=utils.spreadResult(_data),Defer.resolve(spreadResult))}catch(e){return Defer.reject(e)}}),Defer.promise}(),network:function(){return callback(!0),deferred.promise}(),both:function(_callback_){self.provider.get(hashQuery,function(err,entries){tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),_callback_(err,spreadResult)}),Request(queryObject.requestParams).then(function(data){try{self.entry_uid=self.tojson=self.queryCachePolicy=void 0;var entries={},error=null;queryObject.singleEntry?(queryObject.singleEntry=!1,data.schema&&(entries.schema=data.schema),data.entries&&data.entries.length?entries.entry=utils.getData(data,queryObject.headers.access_token).entries[0]:error={error_code:141,error_message:"The requested entry doesn't exist."}):entries=utils.getData(data,queryObject.headers.access_token),tojson||(entries=utils.resultWrapper(entries)),spreadResult=utils.spreadResult(entries),_callback_(error,spreadResult)}catch(e){_callback_(e)}}.bind(self)).catch(function(error){_callback_(error)})}}}}).call(exports,__webpack_require__(4))},function(module,exports){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,runClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function when(x,onFulfilled,onRejected,onProgress){var p=Promise.resolve(x);return arguments.length<2?p:p.then(onFulfilled,onRejected,onProgress)}function promise(resolver){return new Promise(resolver)}function lift(f){return function(){for(var i=0,l=arguments.length,a=new Array(l);i<l;++i)a[i]=arguments[i];return apply(f,this,a)}}function attempt(f){for(var i=0,l=arguments.length-1,a=new Array(l);i<l;++i)a[i]=arguments[i+1];return apply(f,this,a)}function defer(){return new Deferred}function Deferred(){function resolve(x){p._handler.resolve(x)}function reject(x){p._handler.reject(x)}function notify(x){p._handler.notify(x)}var p=Promise._defer();this.promise=p,this.resolve=resolve,this.reject=reject,this.notify=notify,this.resolver={resolve:resolve,reject:reject,notify:notify}}function isPromiseLike(x){return x&&"function"==typeof x.then}function join(){return Promise.all(arguments)}function all(promises){return when(promises,Promise.all)}function settle(promises){return when(promises,Promise.settle)}function map(promises,mapFunc){return when(promises,function(promises){return Promise.map(promises,mapFunc)})}function filter(promises,predicate){return when(promises,function(promises){return Promise.filter(promises,predicate)})}var timed=__webpack_require__(6),array=__webpack_require__(11),flow=__webpack_require__(14),fold=__webpack_require__(15),inspect=__webpack_require__(16),generate=__webpack_require__(17),progress=__webpack_require__(18),withThis=__webpack_require__(19),unhandledRejection=__webpack_require__(20),TimeoutError=__webpack_require__(10),Promise=[array,flow,fold,generate,progress,inspect,withThis,timed,unhandledRejection].reduce(function(Promise,feature){return feature(Promise)},__webpack_require__(22)),apply=__webpack_require__(13)(Promise);return when.promise=promise,when.resolve=Promise.resolve,when.reject=Promise.reject,when.lift=lift,when.try=attempt,when.attempt=attempt,when.iterate=Promise.iterate,when.unfold=Promise.unfold,when.join=join,when.all=all,when.settle=settle,when.any=lift(Promise.any),when.some=lift(Promise.some),when.race=lift(Promise.race),when.map=map,when.filter=filter,when.reduce=lift(Promise.reduce),when.reduceRight=lift(Promise.reduceRight),when.isPromiseLike=isPromiseLike,when.Promise=Promise,when.defer=defer,when.TimeoutError=TimeoutError,when}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function setTimeout(f,ms,x,y){return env.setTimer(function(){f(x,y,ms)},ms)}var env=__webpack_require__(7),TimeoutError=__webpack_require__(10);return function(Promise){function handleDelay(ms,x,h){setTimeout(resolveDelay,ms,x,h)}function resolveDelay(x,h){h.resolve(x)}function onTimeout(reason,h,ms){var e="undefined"==typeof reason?new TimeoutError("timed out after "+ms+"ms"):reason;h.reject(e)}return Promise.prototype.delay=function(ms){var p=this._beget();return this._handler.fold(handleDelay,ms,void 0,p._handler),p},Promise.prototype.timeout=function(ms,reason){var p=this._beget(),h=p._handler,t=setTimeout(onTimeout,ms,reason,p._handler);return this._handler.visit(h,function(x){env.clearTimer(t),this.resolve(x)},function(x){env.clearTimer(t),this.reject(x)},h.notify),p},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;(function(process){!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function isNode(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function hasMutationObserver(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function initMutationObserver(MutationObserver){function run(){var f=scheduled;scheduled=void 0,f()}var scheduled,node=document.createTextNode(""),o=new MutationObserver(run);o.observe(node,{characterData:!0});var i=0;return function(f){scheduled=f,node.data=i^=1}}var MutationObs,capturedSetTimeout="undefined"!=typeof setTimeout&&setTimeout,setTimer=function(f,ms){return setTimeout(f,ms)},clearTimer=function(t){return clearTimeout(t)},asap=function(f){return capturedSetTimeout(f,0)};if(isNode())asap=function(f){return process.nextTick(f)};else if(MutationObs=hasMutationObserver())asap=initMutationObserver(MutationObs);else if(!capturedSetTimeout){var vertx=__webpack_require__(8);setTimer=function(f,ms){return vertx.setTimer(ms,f)},clearTimer=vertx.cancelTimer,asap=vertx.runOnLoop||vertx.runOnContext}return{setTimer:setTimer,clearTimer:clearTimer,asap:asap}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))}).call(exports,__webpack_require__(4))},function(module,exports){},function(module,exports){module.exports=function(){throw new Error("define cannot be used indirect")}},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function TimeoutError(message){Error.call(this),this.message=message,this.name=TimeoutError.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,TimeoutError)}return TimeoutError.prototype=Object.create(Error.prototype),TimeoutError.prototype.constructor=TimeoutError,TimeoutError}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){var state=__webpack_require__(12),applier=__webpack_require__(13);return function(Promise){function any(promises){function handleFulfill(x){errors=null,this.resolve(x)}function handleReject(e){this.resolved||(errors.push(e),0===--pending&&this.reject(errors))}for(var h,x,p=Promise._defer(),resolver=p._handler,l=promises.length>>>0,pending=l,errors=[],i=0;i<l;++i)if(x=promises[i],void 0!==x||i in promises){if(h=Promise._handler(x),h.state()>0){resolver.become(h),Promise._visitRemaining(promises,i,h);break}h.visit(resolver,handleFulfill,handleReject)}else--pending;return 0===pending&&resolver.reject(new RangeError("any(): array must not be empty")),p}function some(promises,n){function fulfill(x){this.resolved||(results.push(x),0===--nFulfill&&(errors=null,this.resolve(results)))}function reject(e){this.resolved||(errors.push(e),0===--nReject&&(results=null,this.reject(errors)))}var nReject,x,i,p=Promise._defer(),resolver=p._handler,results=[],errors=[],l=promises.length>>>0,nFulfill=0;for(i=0;i<l;++i)x=promises[i],(void 0!==x||i in promises)&&++nFulfill;for(n=Math.max(n,0),nReject=nFulfill-n+1,nFulfill=Math.min(n,nFulfill),n>nFulfill?resolver.reject(new RangeError("some(): array must contain at least "+n+" item(s), but had "+nFulfill)):0===nFulfill&&resolver.resolve(results),i=0;i<l;++i)x=promises[i],(void 0!==x||i in promises)&&Promise._handler(x).visit(resolver,fulfill,reject,resolver.notify);return p}function map(promises,f){return Promise._traverse(f,promises)}function filter(promises,predicate){var a=slice.call(promises);return Promise._traverse(predicate,a).then(function(keep){return filterSync(a,keep)})}function filterSync(promises,keep){for(var l=keep.length,filtered=new Array(l),i=0,j=0;i<l;++i)keep[i]&&(filtered[j++]=Promise._handler(promises[i]).value);return filtered.length=j,filtered}function settle(promises){return all(promises.map(settleOne))}function settleOne(p){var h=Promise._handler(p);return 0===h.state()?toPromise(p).then(state.fulfilled,state.rejected):(h._unreport(),state.inspect(h))}function reduce(promises,f){return arguments.length>2?ar.call(promises,liftCombine(f),arguments[2]):ar.call(promises,liftCombine(f))}function reduceRight(promises,f){return arguments.length>2?arr.call(promises,liftCombine(f),arguments[2]):arr.call(promises,liftCombine(f))}function liftCombine(f){return function(z,x,i){return applyFold(f,void 0,[z,x,i])}}var applyFold=applier(Promise),toPromise=Promise.resolve,all=Promise.all,ar=Array.prototype.reduce,arr=Array.prototype.reduceRight,slice=Array.prototype.slice;return Promise.any=any,Promise.some=some,Promise.settle=settle,Promise.map=map,Promise.filter=filter,Promise.reduce=reduce,Promise.reduceRight=reduceRight,Promise.prototype.spread=function(onFulfilled){return this.then(all).then(function(array){return onFulfilled.apply(this,array)})},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function toPendingState(){return{state:"pending"}}function toRejectedState(e){return{state:"rejected",reason:e}}function toFulfilledState(x){return{state:"fulfilled",value:x}}function inspect(handler){var state=handler.state();return 0===state?toPendingState():state>0?toFulfilledState(handler.value):toRejectedState(handler.value)}return{pending:toPendingState,fulfilled:toFulfilledState,rejected:toRejectedState,inspect:inspect}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function makeApply(Promise,call){function apply(f,thisArg,args){var p=Promise._defer(),l=args.length,params=new Array(l);return callAndResolve({f:f,thisArg:thisArg,args:args,params:params,i:l-1,call:call},p._handler),p}function callAndResolve(c,h){if(c.i<0)return call(c.f,c.thisArg,c.params,h);var handler=Promise._handler(c.args[c.i]);handler.fold(callAndResolveNext,c,void 0,h)}function callAndResolveNext(c,x,h){c.params[c.i]=x,c.i-=1,callAndResolve(c,h)}return arguments.length<2&&(call=tryCatchResolve),apply}function tryCatchResolve(f,thisArg,args,resolver){try{resolver.resolve(f.apply(thisArg,args))}catch(e){resolver.reject(e)}}return makeApply.tryCatchResolve=tryCatchResolve,makeApply}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function rejectInvalidPredicate(){throw new TypeError("catch predicate must be a function")}function evaluatePredicate(e,predicate){return isError(predicate)?e instanceof predicate:predicate(e)}function isError(predicate){return predicate===Error||null!=predicate&&predicate.prototype instanceof Error}function maybeThenable(x){return("object"==typeof x||"function"==typeof x)&&null!==x}function identity(x){return x}return function(Promise){function createCatchFilter(handler,predicate){return function(e){return evaluatePredicate(e,predicate)?handler.call(this,e):reject(e)}}function runSideEffect(handler,thisArg,propagate,value){var result=handler.call(thisArg);return maybeThenable(result)?propagateValue(result,propagate,value):propagate(value)}function propagateValue(result,propagate,x){return resolve(result).then(function(){return propagate(x)})}var resolve=Promise.resolve,reject=Promise.reject,origCatch=Promise.prototype.catch;return Promise.prototype.done=function(onResult,onError){this._handler.visit(this._handler.receiver,onResult,onError)},Promise.prototype.catch=Promise.prototype.otherwise=function(onRejected){return arguments.length<2?origCatch.call(this,onRejected):"function"!=typeof onRejected?this.ensure(rejectInvalidPredicate):origCatch.call(this,createCatchFilter(arguments[1],onRejected))},Promise.prototype.finally=Promise.prototype.ensure=function(handler){return"function"!=typeof handler?this:this.then(function(x){return runSideEffect(handler,this,identity,x)},function(e){return runSideEffect(handler,this,reject,e)})},Promise.prototype.else=Promise.prototype.orElse=function(defaultValue){return this.then(void 0,function(){return defaultValue})},Promise.prototype.yield=function(value){return this.then(function(){return value})},Promise.prototype.tap=function(onFulfilledSideEffect){return this.then(onFulfilledSideEffect).yield(this)},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){return Promise.prototype.fold=function(f,z){var promise=this._beget();return this._handler.fold(function(z,x,to){Promise._handler(z).fold(function(x,z,to){to.resolve(f.call(this,z,x))},x,this,to)},z,promise._handler.receiver,promise._handler),promise},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){var inspect=__webpack_require__(12).inspect;return function(Promise){return Promise.prototype.inspect=function(){return inspect(Promise._handler(this))},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){function iterate(f,condition,handler,x){return unfold(function(x){return[x,f(x)]},condition,handler,x)}function unfold(unspool,condition,handler,x){function next(item,newSeed){return resolve(handler(item)).then(function(){return unfold(unspool,condition,handler,newSeed)})}return resolve(x).then(function(seed){return resolve(condition(seed)).then(function(done){return done?seed:resolve(unspool(seed)).spread(next)})})}var resolve=Promise.resolve;return Promise.iterate=iterate,Promise.unfold=unfold,Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){return Promise.prototype.progress=function(onProgress){return this.then(void 0,void 0,onProgress)},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(Promise){return Promise.prototype.with=Promise.prototype.withThis=function(receiver){var p=this._beget(),child=p._handler;return child.receiver=receiver,this._handler.chain(child,receiver),p},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;
!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){function throwit(e){throw e}function noop(){}var setTimer=__webpack_require__(7).setTimer,format=__webpack_require__(21);return function(Promise){function report(r){r.handled||(reported.push(r),logError("Potentially unhandled rejection ["+r.id+"] "+format.formatError(r.value)))}function unreport(r){var i=reported.indexOf(r);i>=0&&(reported.splice(i,1),logInfo("Handled previous rejection ["+r.id+"] "+format.formatObject(r.value)))}function enqueue(f,x){tasks.push(f,x),null===running&&(running=setTimer(flush,0))}function flush(){for(running=null;tasks.length>0;)tasks.shift()(tasks.shift())}var localConsole,logError=noop,logInfo=noop;"undefined"!=typeof console&&(localConsole=console,logError="undefined"!=typeof localConsole.error?function(e){localConsole.error(e)}:function(e){localConsole.log(e)},logInfo="undefined"!=typeof localConsole.info?function(e){localConsole.info(e)}:function(e){localConsole.log(e)}),Promise.onPotentiallyUnhandledRejection=function(rejection){enqueue(report,rejection)},Promise.onPotentiallyUnhandledRejectionHandled=function(rejection){enqueue(unreport,rejection)},Promise.onFatalRejection=function(rejection){enqueue(throwit,rejection.value)};var tasks=[],reported=[],running=null;return Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function formatError(e){var s="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:formatObject(e);return e instanceof Error?s:s+" (WARNING: non-Error used)"}function formatObject(o){var s=String(o);return"[object Object]"===s&&"undefined"!=typeof JSON&&(s=tryStringify(o,s)),s}function tryStringify(x,defaultValue){try{return JSON.stringify(x)}catch(e){return defaultValue}}return{formatError:formatError,formatObject:formatObject,tryStringify:tryStringify}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(require){var makePromise=__webpack_require__(23),Scheduler=__webpack_require__(24),async=__webpack_require__(7).asap;return makePromise({scheduler:new Scheduler(async)})}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;(function(process){!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){return function(environment){function Promise(resolver,handler){this._handler=resolver===Handler?handler:init(resolver)}function init(resolver){function promiseResolve(x){handler.resolve(x)}function promiseReject(reason){handler.reject(reason)}function promiseNotify(x){handler.notify(x)}var handler=new Pending;try{resolver(promiseResolve,promiseReject,promiseNotify)}catch(e){promiseReject(e)}return handler}function resolve(x){return isPromise(x)?x:new Promise(Handler,new Async(getHandler(x)))}function reject(x){return new Promise(Handler,new Async(new Rejected(x)))}function never(){return foreverPendingPromise}function defer(){return new Promise(Handler,new Pending)}function begetFrom(parent,Promise){var child=new Pending(parent.receiver,parent.join().context);return new Promise(Handler,child)}function all(promises){return traverseWith(snd,null,promises)}function traverse(f,promises){return traverseWith(tryCatch2,f,promises)}function traverseWith(tryMap,f,promises){function mapAt(i,x,resolver){resolver.resolved||traverseAt(promises,settleAt,i,tryMap(f,x,i),resolver)}function settleAt(i,x,resolver){results[i]=x,0===--pending&&resolver.become(new Fulfilled(results))}for(var x,handler="function"==typeof f?mapAt:settleAt,resolver=new Pending,pending=promises.length>>>0,results=new Array(pending),i=0;i<promises.length&&!resolver.resolved;++i)x=promises[i],void 0!==x||i in promises?traverseAt(promises,handler,i,x,resolver):--pending;return 0===pending&&resolver.become(new Fulfilled(results)),new Promise(Handler,resolver)}function traverseAt(promises,handler,i,x,resolver){if(maybeThenable(x)){var h=getHandlerMaybeThenable(x),s=h.state();0===s?h.fold(handler,i,void 0,resolver):s>0?handler(i,h.value,resolver):(resolver.become(h),visitRemaining(promises,i+1,h))}else handler(i,x,resolver)}function visitRemaining(promises,start,handler){for(var i=start;i<promises.length;++i)markAsHandled(getHandler(promises[i]),handler)}function markAsHandled(h,handler){if(h!==handler){var s=h.state();0===s?h.visit(h,void 0,h._unreport):s<0&&h._unreport()}}function race(promises){return"object"!=typeof promises||null===promises?reject(new TypeError("non-iterable passed to race()")):0===promises.length?never():1===promises.length?resolve(promises[0]):runRace(promises)}function runRace(promises){var i,x,h,resolver=new Pending;for(i=0;i<promises.length;++i)if(x=promises[i],void 0!==x||i in promises){if(h=getHandler(x),0!==h.state()){resolver.become(h),visitRemaining(promises,i+1,h);break}h.visit(resolver,resolver.resolve,resolver.reject)}return new Promise(Handler,resolver)}function getHandler(x){return isPromise(x)?x._handler.join():maybeThenable(x)?getHandlerUntrusted(x):new Fulfilled(x)}function getHandlerMaybeThenable(x){return isPromise(x)?x._handler.join():getHandlerUntrusted(x)}function getHandlerUntrusted(x){try{var untrustedThen=x.then;return"function"==typeof untrustedThen?new Thenable(untrustedThen,x):new Fulfilled(x)}catch(e){return new Rejected(e)}}function Handler(){}function FailIfRejected(){}function Pending(receiver,inheritedContext){Promise.createContext(this,inheritedContext),this.consumers=void 0,this.receiver=receiver,this.handler=void 0,this.resolved=!1}function Async(handler){this.handler=handler}function Thenable(then,thenable){Pending.call(this),tasks.enqueue(new AssimilateTask(then,thenable,this))}function Fulfilled(x){Promise.createContext(this),this.value=x}function Rejected(x){Promise.createContext(this),this.id=++errorId,this.value=x,this.handled=!1,this.reported=!1,this._report()}function ReportTask(rejection,context){this.rejection=rejection,this.context=context}function UnreportTask(rejection){this.rejection=rejection}function cycle(){return new Rejected(new TypeError("Promise cycle"))}function ContinuationTask(continuation,handler){this.continuation=continuation,this.handler=handler}function ProgressTask(value,handler){this.handler=handler,this.value=value}function AssimilateTask(then,thenable,resolver){this._then=then,this.thenable=thenable,this.resolver=resolver}function tryAssimilate(then,thenable,resolve,reject,notify){try{then.call(thenable,resolve,reject,notify)}catch(e){reject(e)}}function Fold(f,z,c,to){this.f=f,this.z=z,this.c=c,this.to=to,this.resolver=failIfRejected,this.receiver=this}function isPromise(x){return x instanceof Promise}function maybeThenable(x){return("object"==typeof x||"function"==typeof x)&&null!==x}function runContinuation1(f,h,receiver,next){return"function"!=typeof f?next.become(h):(Promise.enterContext(h),tryCatchReject(f,h.value,receiver,next),void Promise.exitContext())}function runContinuation3(f,x,h,receiver,next){return"function"!=typeof f?next.become(h):(Promise.enterContext(h),tryCatchReject3(f,x,h.value,receiver,next),void Promise.exitContext())}function runNotify(f,x,h,receiver,next){return"function"!=typeof f?next.notify(x):(Promise.enterContext(h),tryCatchReturn(f,x,receiver,next),void Promise.exitContext())}function tryCatch2(f,a,b){try{return f(a,b)}catch(e){return reject(e)}}function tryCatchReject(f,x,thisArg,next){try{next.become(getHandler(f.call(thisArg,x)))}catch(e){next.become(new Rejected(e))}}function tryCatchReject3(f,x,y,thisArg,next){try{f.call(thisArg,x,y,next)}catch(e){next.become(new Rejected(e))}}function tryCatchReturn(f,x,thisArg,next){try{next.notify(f.call(thisArg,x))}catch(e){next.notify(e)}}function inherit(Parent,Child){Child.prototype=objectCreate(Parent.prototype),Child.prototype.constructor=Child}function snd(x,y){return y}function noop(){}function initEmitRejection(){return"undefined"!=typeof process&&null!==process&&"function"==typeof process.emit?function(type,rejection){return"unhandledRejection"===type?process.emit(type,rejection.value,rejection):process.emit(type,rejection)}:"undefined"!=typeof self&&"function"==typeof CustomEvent?function(noop,self,CustomEvent){var hasCustomEvent=!1;try{var ev=new CustomEvent("unhandledRejection");hasCustomEvent=ev instanceof CustomEvent}catch(e){}return hasCustomEvent?function(type,rejection){var ev=new CustomEvent(type,{detail:{reason:rejection.value,key:rejection},bubbles:!1,cancelable:!0});return!self.dispatchEvent(ev)}:noop}(noop,self,CustomEvent):noop}var tasks=environment.scheduler,emitRejection=initEmitRejection(),objectCreate=Object.create||function(proto){function Child(){}return Child.prototype=proto,new Child};Promise.resolve=resolve,Promise.reject=reject,Promise.never=never,Promise._defer=defer,Promise._handler=getHandler,Promise.prototype.then=function(onFulfilled,onRejected,onProgress){var parent=this._handler,state=parent.join().state();if("function"!=typeof onFulfilled&&state>0||"function"!=typeof onRejected&&state<0)return new this.constructor(Handler,parent);var p=this._beget(),child=p._handler;return parent.chain(child,parent.receiver,onFulfilled,onRejected,onProgress),p},Promise.prototype.catch=function(onRejected){return this.then(void 0,onRejected)},Promise.prototype._beget=function(){return begetFrom(this._handler,this.constructor)},Promise.all=all,Promise.race=race,Promise._traverse=traverse,Promise._visitRemaining=visitRemaining,Handler.prototype.when=Handler.prototype.become=Handler.prototype.notify=Handler.prototype.fail=Handler.prototype._unreport=Handler.prototype._report=noop,Handler.prototype._state=0,Handler.prototype.state=function(){return this._state},Handler.prototype.join=function(){for(var h=this;void 0!==h.handler;)h=h.handler;return h},Handler.prototype.chain=function(to,receiver,fulfilled,rejected,progress){this.when({resolver:to,receiver:receiver,fulfilled:fulfilled,rejected:rejected,progress:progress})},Handler.prototype.visit=function(receiver,fulfilled,rejected,progress){this.chain(failIfRejected,receiver,fulfilled,rejected,progress)},Handler.prototype.fold=function(f,z,c,to){this.when(new Fold(f,z,c,to))},inherit(Handler,FailIfRejected),FailIfRejected.prototype.become=function(h){h.fail()};var failIfRejected=new FailIfRejected;inherit(Handler,Pending),Pending.prototype._state=0,Pending.prototype.resolve=function(x){this.become(getHandler(x))},Pending.prototype.reject=function(x){this.resolved||this.become(new Rejected(x))},Pending.prototype.join=function(){if(!this.resolved)return this;for(var h=this;void 0!==h.handler;)if(h=h.handler,h===this)return this.handler=cycle();return h},Pending.prototype.run=function(){var q=this.consumers,handler=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var i=0;i<q.length;++i)handler.when(q[i])},Pending.prototype.become=function(handler){this.resolved||(this.resolved=!0,this.handler=handler,void 0!==this.consumers&&tasks.enqueue(this),void 0!==this.context&&handler._report(this.context))},Pending.prototype.when=function(continuation){this.resolved?tasks.enqueue(new ContinuationTask(continuation,this.handler)):void 0===this.consumers?this.consumers=[continuation]:this.consumers.push(continuation)},Pending.prototype.notify=function(x){this.resolved||tasks.enqueue(new ProgressTask(x,this))},Pending.prototype.fail=function(context){var c="undefined"==typeof context?this.context:context;this.resolved&&this.handler.join().fail(c)},Pending.prototype._report=function(context){this.resolved&&this.handler.join()._report(context)},Pending.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},inherit(Handler,Async),Async.prototype.when=function(continuation){tasks.enqueue(new ContinuationTask(continuation,this))},Async.prototype._report=function(context){this.join()._report(context)},Async.prototype._unreport=function(){this.join()._unreport()},inherit(Pending,Thenable),inherit(Handler,Fulfilled),Fulfilled.prototype._state=1,Fulfilled.prototype.fold=function(f,z,c,to){runContinuation3(f,z,this,c,to)},Fulfilled.prototype.when=function(cont){runContinuation1(cont.fulfilled,this,cont.receiver,cont.resolver)};var errorId=0;inherit(Handler,Rejected),Rejected.prototype._state=-1,Rejected.prototype.fold=function(f,z,c,to){to.become(this)},Rejected.prototype.when=function(cont){"function"==typeof cont.rejected&&this._unreport(),runContinuation1(cont.rejected,this,cont.receiver,cont.resolver)},Rejected.prototype._report=function(context){tasks.afterQueue(new ReportTask(this,context))},Rejected.prototype._unreport=function(){this.handled||(this.handled=!0,tasks.afterQueue(new UnreportTask(this)))},Rejected.prototype.fail=function(context){this.reported=!0,emitRejection("unhandledRejection",this),Promise.onFatalRejection(this,void 0===context?this.context:context)},ReportTask.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,emitRejection("unhandledRejection",this.rejection)||Promise.onPotentiallyUnhandledRejection(this.rejection,this.context))},UnreportTask.prototype.run=function(){this.rejection.reported&&(emitRejection("rejectionHandled",this.rejection)||Promise.onPotentiallyUnhandledRejectionHandled(this.rejection))},Promise.createContext=Promise.enterContext=Promise.exitContext=Promise.onPotentiallyUnhandledRejection=Promise.onPotentiallyUnhandledRejectionHandled=Promise.onFatalRejection=noop;var foreverPendingHandler=new Handler,foreverPendingPromise=new Promise(Handler,foreverPendingHandler);return ContinuationTask.prototype.run=function(){this.handler.join().when(this.continuation)},ProgressTask.prototype.run=function(){var q=this.handler.consumers;if(void 0!==q)for(var c,i=0;i<q.length;++i)c=q[i],runNotify(c.progress,this.value,this.handler,c.receiver,c.resolver)},AssimilateTask.prototype.run=function(){function _resolve(x){h.resolve(x)}function _reject(x){h.reject(x)}function _notify(x){h.notify(x)}var h=this.resolver;tryAssimilate(this._then,this.thenable,_resolve,_reject,_notify)},Fold.prototype.fulfilled=function(x){this.f.call(this.c,this.z,x,this.to)},Fold.prototype.rejected=function(x){this.to.reject(x)},Fold.prototype.progress=function(x){this.to.notify(x)},Promise}}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))}).call(exports,__webpack_require__(4))},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(define){"use strict";__WEBPACK_AMD_DEFINE_RESULT__=function(){function Scheduler(async){this._async=async,this._running=!1,this._queue=this,this._queueLen=0,this._afterQueue={},this._afterQueueLen=0;var self=this;this.drain=function(){self._drain()}}return Scheduler.prototype.enqueue=function(task){this._queue[this._queueLen++]=task,this.run()},Scheduler.prototype.afterQueue=function(task){this._afterQueue[this._afterQueueLen++]=task,this.run()},Scheduler.prototype.run=function(){this._running||(this._running=!0,this._async(this.drain))},Scheduler.prototype._drain=function(){for(var i=0;i<this._queueLen;++i)this._queue[i].run(),this._queue[i]=void 0;for(this._queueLen=0,this._running=!1,i=0;i<this._afterQueueLen;++i)this._afterQueue[i].run(),this._afterQueue[i]=void 0;this._afterQueueLen=0},Scheduler}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}(__webpack_require__(9))},function(module,exports,__webpack_require__){"use strict";function Result(object){return object&&(this.object=function(){return object}),this}var Utils=__webpack_require__(3);Result.prototype.toJSON=function(){return this.object()?Utils.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null},Result.prototype.get=function(key){if(this.object()&&key){var fields=key.split("."),value=fields.reduce(function(prev,field){return prev[field]},this.object());return value}},module.exports=function(object){return new Result(object)}},function(module,exports){},function(module,exports,__webpack_require__){"use strict";var cacheStorage,Utils=__webpack_require__(3);cacheStorage=Utils.isBrowser()&&localStorage?localStorage:__webpack_require__(28),exports.get=function(key){var data=cacheStorage.getItem(key);try{data=JSON.parse(data)}catch(e){return data}return data||null},exports.set=function(key,data){"object"==typeof data?cacheStorage.setItem(key,JSON.stringify(data)):cacheStorage.setItem(key,data)},exports.getStorage=function(){return cacheStorage||null},exports.getKeys=function(){return cacheStorage?Object.keys(cacheStorage):[]}},function(module,exports){},function(module,exports){module.exports=exports={protocol:"https",host:"stagcontentstack.global.ssl.fastly.net",port:443,version:"v3",urls:{content_types:"/content_types/",entries:"/entries/",environments:"/environments/"}}},function(module,exports,__webpack_require__){function Entry(){return this._query={},this}var Utils=(__webpack_require__(2),__webpack_require__(3)),_extend=(__webpack_require__(31),function(type){return function(){switch(this._query[type]=this._query[type]||{},arguments.length){case 1:if(Array.isArray(arguments[0])||"string"==typeof arguments[0]){var query=this._query[type].BASE||[];return query=query.concat(arguments[0]),this._query[type].BASE=query,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var query=this._query[type][arguments[0]]||[];return query=query.concat(arguments[1]),this._query[type][arguments[0]]=query,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}});Entry.prototype.only=_extend("only"),Entry.prototype.except=_extend("except"),Entry.prototype.includeReference=function(val){if(Array.isArray(val)||"string"==typeof val){if(arguments.length)for(var i=0;i<arguments.length;i++)this._query.include=this._query.include||[],this._query.include=this._query.include.concat(arguments[i]);return this}console.error("Argument should be a String or an Array.")},Entry.prototype.language=function(language_code){return language_code&&"string"==typeof language_code?(this._query.locale=language_code,this):void console.error("Argument should be a String.")},Entry.prototype.addQuery=function(key,value){return key&&value&&"string"==typeof key?(this._query[key]=value,this):void console.error("First argument should be a String.")},Entry.prototype.includeSchema=function(){return this._query.include_schema=!0,this},Entry.prototype.includeOwner=function(){return this._query.include_owner=!0,this},Entry.prototype.toJSON=function(){return this.tojson=!0,this},Entry.prototype.fetch=function(){return this.entry_uid?(this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries+this.entry_uid,body:{_method:"GET",query:this._query}},Utils.sendRequest(this)):void console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')")},module.exports=Entry},function(module,exports,__webpack_require__){"use strict";var CacheProvider={};module.exports=exports=CacheProvider,CacheProvider.providers=function(provider){return provider?__webpack_require__(32):void console.error("Kindly provide valid provider.")},CacheProvider.policies={IGNORE_CACHE:-1,ONLY_NETWORK:0,CACHE_ELSE_NETWORK:1,NETWORK_ELSE_CACHE:2,CACHE_THEN_NETWORK:3}},function(module,exports,__webpack_require__){"use strict";function clearValuesForKey(keyArray,append){!append&&keyArray&&keyArray.length&&keyArray.push("");var _key,keys=cache.getKeys(),storage=cache.getStorage();if(keyArray&&keyArray.length){_key=keyArray.join(".");for(var i=0,_i=keys.length;i<_i;i++)keys[i]&&0===keys[i].indexOf(_key)&&delete storage[keys[i]]}else for(var i=0,_i=keys.length;i<_i;i++)delete storage[keys[i]]}var cache=__webpack_require__(27),localStorage={};module.exports=exports=localStorage,localStorage.get=function(key,callback){try{callback(null,cache.get(key))}catch(e){callback(e)}},localStorage.set=function(key,value,callback){try{key&&value&&cache.set(key,value),callback()}catch(e){callback(e)}},localStorage.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var args=Array.prototype.slice.call(arguments),callback=args.splice(-1,1).pop(),valueArray=[];valueArray.push.apply(valueArray,args),clearValuesForKey(valueArray),callback()}}catch(e){callback(e)}},localStorage.clearByQuery=function(query,callback){try{for(var keys=cache.getKeys(),storage=cache.getStorage(),i=0,_i=keys.length;i<_i;i++)keys[i]&&~keys[i].indexOf(query)&&delete storage[keys[i]];callback()}catch(e){callback(e)}},localStorage.clearAll=function(callback){try{clearValuesForKey(),callback()}catch(e){callback(e)}}},function(module,exports,__webpack_require__){"use strict";function Query(){Entry.call(this),this._query=this._query||{},this._query.query=this._query.query||{}}var Utils=(__webpack_require__(2),__webpack_require__(3)),Entry=__webpack_require__(30),_extend={compare:function(type){return function(key,value){return key&&value&&"string"==typeof key&&"undefined"!=typeof value?(this._query.query[key]=this._query.query[key]||{},this._query.query[key][type]=value,this):void console.error("Kindly provide valid parameters.")}},contained:function(bool){var type=bool?"$in":"$nin";return function(key,value){return key&&value&&"string"==typeof key&&Array.isArray(value)?(this._query.query[key]=this._query.query[key]||{},this._query.query[key][type]=this._query.query[key][type]||[],this._query.query[key][type]=this._query.query[key][type].concat(value),this):void console.error("Kindly provide valid parameters.")}},exists:function(bool){return function(key){return key&&"string"==typeof key?(this._query.query[key]=this._query.query[key]||{},this._query.query[key].$exists=bool,this):void console.error("Kindly provide valid parameters.")}},logical:function(type){return function(){for(var _query=[],i=0,_i=arguments.length;i<_i;i++)arguments[i]instanceof Query&&arguments[i]._query.query?_query.push(arguments[i]._query.query):"object"==typeof arguments[i]&&_query.push(arguments[i]);return this._query.query[type]?this._query.query[type]=this._query.query[type].concat(_query):this._query.query[type]=_query,this}},sort:function(type){return function(key){return key&&"string"==typeof key?(this._query[type]=key,this):void console.error("Argument should be a string.")}},pagination:function(type){return function(value){return"number"==typeof value?(this._query[type]=value,this):void console.error("Argument should be a number.")}}};Query.prototype=Object.create(Entry.prototype),Query.prototype.lessThan=_extend.compare("$lt"),Query.prototype.lessThanOrEqualTo=_extend.compare("$lte"),Query.prototype.greaterThan=_extend.compare("$gt"),Query.prototype.greaterThanOrEqualTo=_extend.compare("$gte"),Query.prototype.equalTo=Query.prototype.where=function(key,value){return key&&value&&"string"==typeof key&&"string"==typeof value?(this._query.query[key]=value,this):void console.error("Kindly provide valid parameters.")},Query.prototype.notEqualTo=_extend.compare("$ne"),Query.prototype.containedIn=_extend.contained(!0),Query.prototype.notContainedIn=_extend.contained(!1),Query.prototype.exists=_extend.exists(!0),Query.prototype.notExists=_extend.exists(!1),Query.prototype.ascending=_extend.sort("asc"),Query.prototype.descending=_extend.sort("desc"),Query.prototype.beforeUid=_extend.sort("before_uid"),Query.prototype.afterUid=_extend.sort("after_uid"),Query.prototype.skip=_extend.pagination("skip"),Query.prototype.limit=_extend.pagination("limit"),Query.prototype.count=function(){return this._query.count=!0,this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries,body:{_method:"GET",query:this._query}},this},Query.prototype.or=_extend.logical("$or"),Query.prototype.and=_extend.logical("$and"),Query.prototype.query=function(query){return"object"==typeof query?(this._query.query=Utils.mergeDeep(this._query.query,query),this):void console.error("Kindly provide valid parameters")},Query.prototype.tags=function(values){return Array.isArray(values)?(this._query.tags=values,this):void console.error("Kindly provide valid parameters")},Query.prototype.includeCount=function(){return this._query.include_count=!0,this},Query.prototype.getQuery=function(){return this._query.query||{}},Query.prototype.regex=function(key,value,options){return key&&value&&"string"==typeof key&&"string"==typeof value?(this._query.query[key]={$regex:value},options&&(this._query.query[key].$options=options),this):void console.error("Kindly provide valid parameters.")},Query.prototype.search=function(value){return value&&"string"==typeof value?(this._query.typeahead=value,this):void console.error("Kindly provide valid parameters.")},Query.prototype.find=function(){return this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries,body:{_method:"GET",query:this._query}},Utils.sendRequest(this)},Query.prototype.findOne=function(){return this.singleEntry=!0,this._query.limit=1,this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries,body:{_method:"GET",query:this._query}},Utils.sendRequest(this)},module.exports=Query}]);

@@ -18,11 +18,30 @@ 'use strict';

function Request(options) {
var serialize = function(obj, prefix) {
var str = [], p;
for(p in obj) {
if (obj.hasOwnProperty(p)) {
var k = prefix ? prefix + "[" + p + "]" : p,
v = obj[p];
str.push((v !== null && typeof v === "object" && p !== 'query') ?
serialize(v, k) :
encodeURIComponent(k) + "=" + (p !== 'query' ? encodeURIComponent(v) : JSON.stringify(v)));
}
}
return str.join("&");
}
var deferred = when.defer();
var xhr = new HTTPRequest(),
method = options.method || "GET",
method = "GET",
url = options.url,
headers = options.headers;
// make a request
xhr.open(method, url, true);
if(options.body && typeof options.body === 'object'){
delete options.body._method;
var queryParams = serialize(options.body);
}
//make all calls as GET instead of POST
xhr.open(method, url+'?'+queryParams, true);
// set headers

@@ -29,0 +48,0 @@ xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');

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

}
_query.environment = queryObject.environment;
return {

@@ -169,3 +170,2 @@ content_type_uid: queryObject.content_type_uid,

var Request = require('./request');
var env_uid = queryObject.environment_uid;

@@ -177,3 +177,2 @@ if (env_uid) {

}
var deferred = when.defer();

@@ -187,2 +186,13 @@ var self = queryObject;

var spreadResult;
/**
for new api v3
*/
if(queryObject && queryObject.requestParams && queryObject.requestParams.body && queryObject.requestParams.body.query){
var cloneQueryObj = JSON.parse(JSON.stringify(queryObject.requestParams.body.query));
if(typeof cloneQueryObj !== 'object') {
cloneQueryObj = JSON.parse(cloneQueryObj);
}
delete queryObject.requestParams.body.query;
queryObject.requestParams.body = this.merge(queryObject.requestParams.body,cloneQueryObj);
}

@@ -189,0 +199,0 @@ var getCacheCallback = function () {

{
"name": "contentstack",
"version": "1.0.3",
"version": "3.0.0",
"description": "The Built.io Contentstack Javascript SDK",

@@ -5,0 +5,0 @@ "homepage": "https://www.built.io/products/contentstack/overview",

@@ -75,6 +75,6 @@ // 'use strict';

* <caption> .only with reference_field_uid and field uid </caption>
* blogEntry.only('category','title')
* blogEntry.includeReference('category').only('category','title')
* @example
* <caption> .only with reference_field_uid and field uids(array) </caption>
* blogEntry.only('category', ['title', 'description'])
* blogEntry.includeReference('category').only('category', ['title', 'description'])
* @returns {Entry}

@@ -100,6 +100,6 @@ */

* <caption> .except with reference_field_uid and field uid </caption>
* blogEntry.except('category','title')
* blogEntry.includeReference('category').except('category','title')
* @example
* <caption> .except with reference_field_uid and field uids(array) </caption>
* blogEntry.except('category', ['title', 'description'])
* blogEntry.includeReference('category').except('category', ['title', 'description'])
* @returns {Entry} */

@@ -121,4 +121,8 @@ Entry.prototype.except = _extend('except');

if (Array.isArray(val) || typeof val === "string") {
this._query['include'] = this._query['include'] || [];
this._query['include'] = this._query['include'].concat(val);
if(arguments.length){
for (var i = 0; i < arguments.length; i++) {
this._query['include'] = this._query['include'] || [];
this._query['include'] = this._query['include'].concat(arguments[i]);
}
}
return this;

@@ -125,0 +129,0 @@ } else {

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

* @returns {Query}
* @ignore
*/

@@ -253,2 +254,3 @@ Query.prototype.beforeUid = _extend.sort('before_uid');

* @returns {Query}
* @ignore
*/

@@ -255,0 +257,0 @@ Query.prototype.afterUid = _extend.sort('after_uid');

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

if(typeof port === "number") this.config.port = port;
this._environment(this.environment, this.headers.api_key, true);
return this;

@@ -45,3 +44,2 @@ }

if(typeof protocol === "string" && ~["https", "http"].indexOf(protocol)) this.config.protocol = protocol;
this._environment(this.environment, this.headers.api_key, true);
return this;

@@ -58,3 +56,2 @@ }

if(typeof host === "string" && host) this.config.host = host;
this._environment(this.environment, this.headers.api_key, true);
return this;

@@ -81,3 +78,2 @@ }

self.environment = arguments[0].environment;
self._environment(self.environment, self.headers.api_key);
return self;

@@ -94,3 +90,2 @@ } else {

self.environment = arguments[2];
self._environment(self.environment, self.headers.api_key);
return self;

@@ -114,28 +109,3 @@ } else {

*/
Stack.prototype._environment = function (env, api_key, force) {
var self = this,
key = api_key + '.environment.' + env;
var environmentUid = self.environment_uid || cache.get(key);
if (environmentUid && !force) {
self.environment_uid = environmentUid;
} else {
Request({
url: self.config.protocol + "://" + self.config.host + ':' + self.config.port + '/' + self.config.version + self.config.urls.environments + env,
headers: self.headers
}).then(function (data) {
try {
if (data && data.environment && data.environment.uid) {
cache.set(key, data.environment.uid);
self.environment_uid = data.environment.uid;
}
} catch (e) {
console.error('Could not retrieve the environment due to %s error: ', e.message);
}
}).catch(function (err) {
console.error('Could not retrieve the environment due to %s error: ', err.message);
});
}
};
/**

@@ -283,2 +253,3 @@ * @method setCachePolicy

* @returns {Stack}
* @ignore
*/

@@ -292,12 +263,6 @@ Stack.prototype.getLastActivities = function () {

_method: 'GET',
query: {
only_last_activity: true
}
only_last_activity: true,
environment:this.environment
}
};
if(this.environment_uid) {
query.body.query.environment_uid = this.environment_uid;
} else {
query.body.query.environment = this.environment;
}
return Request(query);

@@ -304,0 +269,0 @@ };

Sorry, the diff of this file is too big to display

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