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

contentstack

Package Overview
Dependencies
Maintainers
4
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 3.12.0 to 3.12.1

8

CHANGELOG.md

@@ -0,3 +1,9 @@

### Version: 3.12.1
#### Date: Jan-22-2021
##### Bug fix:
- Fixed Unhandled promise rejection on HTML response body.
### Version: 3.12.0
#### Date: Desc-05-2020
#### Date: Dec-05-2020

@@ -4,0 +10,0 @@ ##### New Features:

4

dist/web/contentstack.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Contentstack=t():e.Contentstack=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.transform=function(e){return function(){switch(this._query[e]=this._query[e]||{},arguments.length){case 1:if(Array.isArray(arguments[0])||"string"==typeof arguments[0]){var t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":n(e);switch(t){case"object":t,Array.isArray(e)&&(t="array");break;default:t}return t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var o in n)"object"==r._type(n[o])&&r._type(t[o])==r._type(n[o])?e(t[o],n[o]):"array"==r._type(n[o])&&r._type(t[o])==r._type(n[o])?t[o]=t[o].concat(n[o]):t[o]=n[o]}(e,t),e},t.merge=u,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===(void 0===e?"undefined":n(e))&&"browser"===e.title},t.parseQueryFromParams=c,t.getHash=a,t.generateHash=f,t.resultWrapper=l,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var i=e,s=void 0!==i.queryCachePolicy?i.queryCachePolicy:i.cachePolicy,f=void 0!==i.tojson&&i.tojson,h=!!(i.entry_uid||i.singleEntry||i.asset_uid),d=a(c(i,h,f));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var p=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===p?"undefined":n(p))&&(p=JSON.parse(p)),delete e.requestParams.body.query,e.requestParams.body=u(e.requestParams.body,p)}var v=function(){return function(e,t){return new Promise((function(r,n){try{if(e)throw e;f||(t=l(t)),r(y(t))}catch(e){n(e)}}))}},_=function(r,n,u){r&&(0,o.default)(e.requestParams,t).then(function(t){try{i.entry_uid=i.asset_uid=i.tojson=i.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2!==s||null===i.provider?u({error_code:141,error_message:"The requested entry doesn't exist."}):void i.provider.get(d,v());r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==i.provider?(i.provider.set(d,r,(function(e){try{if(e)throw e;return f||(r=l(r)),n(y(r))}catch(e){return u(e)}})),n(y(r))):Object.keys(o).length?n(o):(f||(r=l(r)),n(y(r)))}catch(e){return u({message:e.message})}}.bind(i)).catch((function(e){if(2!==s||null===i.provider)return u(e);i.provider.get(d,v())}))};switch(s){case 1:return new Promise((function(e,t){null!==i.provider?i.provider.get(d,(function(r,n){try{if(!r&&n)return f||(n=l(n)),e(y(n));_(!0,e,t)}catch(e){return t(e)}})):_(!0,e,t)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){_(!0,e,t)}))}if(3===s){return new Promise((function(e,t){null!==i.provider&&i.provider.get(d,(function(r,n){try{r||!n?t(r):(f||(n=l(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){_(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){_(!0,e,t)}))}))}};var o=s(r(2)),i=s(r(14));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=u({},e.requestParams.body&&e.requestParams.body.query||{});return n.environment_uid&&(delete n.environment_uid,n.environment=e.environment),n.environment=e.environment,{content_type_uid:e.content_type_uid,locale:n.locale||"en-us",query:n,entry_uid:e.entry_uid,asset_uid:e.asset_uid,single:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function a(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function l(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,i.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,o=e.assets.length;n<o;n++)e.assets[n]=(0,i.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,i.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,i.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,i.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})}).call(this,r(3))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=h(r(9)),s=y(r(0)),u=h(r(4)),c=h(r(15)),a=h(r(5)),f=h(r(2)),l=(y(r(6)),h(r(7)));function y(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function h(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var p=[408,429],v=function(){function e(){d(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!p.includes(e.status)}},this.config=Object.assign({},i.default);for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=Object.assign(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=l.default.policies.IGNORE_CACHE,this.provider=l.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if("string"==typeof r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return"string"==typeof r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=Object.assign(this.fetchOptions,r[3]))),this;case 5:return"string"==typeof r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=Object.assign(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=Object.assign(this.fetchOptions,r[4])),this;default:console.error("Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return o(e,[{key:"setPort",value:function(e){return"number"==typeof e&&(this.config.port=e),this}},{key:"setProtocol",value:function(e){return"string"==typeof e&&~["https","http"].indexOf(e)&&(this.config.protocol=e),this}},{key:"setHost",value:function(e){return"string"==typeof e&&e&&(this.config.host=e),this}},{key:"setCachePolicy",value:function(e){return"number"==typeof e&&e>=-1&&e<4?this._query?this.queryCachePolicy=e:this.cachePolicy=e:console.error("Kindly provide the valid policy"),this}},{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(e))&&(this.provider=e),this}},{key:"clearByQuery",value:function(){if(this.provider&&"function"==typeof this.provider.clearByQuery)return this.provider.clearByQuery.apply(this.provider,arguments)}},{key:"clearByContentType",value:function(){if(this.provider&&"function"==typeof this.provider.clearByContentType)return this.provider.clearByContentType.apply(this.provider,arguments)}},{key:"clearAll",value:function(){if(this.provider&&"function"==typeof this.provider.clearAll)return this.provider.clearAll.apply(this.provider,arguments)}},{key:"getCacheProvider",value:function(){return this.provider}},{key:"ContentType",value:function(e){return e&&"string"==typeof e&&(this.content_type_uid=e,this.type="contentType"),this}},{key:"Entry",value:function(e){var t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){var t={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,body:{_method:"GET",environment:this.environment}},r=Object.assign({},this.fetchOptions,e);return(0,f.default)(t,r)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new c.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new a.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){var e={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(0,f.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={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",environment:this.environment}};if(e&&void 0!==e)for(var r in e)t.body[r]=e[r];return(0,f.default)(t,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=Object.assign(this._query,e),this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.sync,body:{_method:"GET",query:this._query}};var r=Object.assign({},this.fetchOptions,t);return s.sendRequest(this,r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var o in t)r.push(o+"="+t[o]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e,t){return new Promise((function(r,o){var i=void 0,c=e.url,a=e.headers;return a["Content-Type"]="application/json; charset=UTF-8",a["X-User-Agent"]="contentstack-web/3.12.0",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,i=function e(t,r){var o=[],i=void 0;if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var s=0,u=t.length;s<u;s++)o.push(r+"[]="+t[s]);else for(i in t){var c=r?r+"["+i+"]":i,a=t[i];o.push(null!==a&&"object"===(void 0===a?"undefined":n(a))&&"query"!==i?e(a,c):c+"="+encodeURIComponent("query"!==i?a:JSON.stringify(a)))}return o.join("&")}(e.body)),function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:300,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,i=arguments[4],c=arguments[5],a=arguments[6],f=Object.assign({method:"GET",headers:r,timeout:3e3},i);function l(s){if(0===o)a(s);else{var f=n;o-=1;var l=i.retryLimit-o;i.retryDelayOptions&&(i.retryDelayOptions.base?f=i.retryDelayOptions.base*l:i.retryDelayOptions.customBackoff&&(f=i.retryDelayOptions.customBackoff(l,s))),u(f).then((function(){return e(t,r,n,o,i,c,a)}))}}(0,s.default)(t,f).then((function(e){var t=e.json();e.ok&&200===e.status?c(t):t.then((function(t){i.retryCondition&&i.retryCondition(e)?l(t):a(t)}))})).catch((function(e){a(e)}))}(c+"?"+i,a,t.retryDelay,t.retryLimit,t,r,o)}))};!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);t.default=e}(r(0));var o,i=r(10),s=(o=i)&&o.__esModule?o:{default:o};function u(e){return new Promise((function(t){setTimeout(t,e)}))}},function(e,t,r){"use strict";var n,o,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(e){o=u}}();var a,f=[],l=!1,y=-1;function h(){l&&a&&(l=!1,a.length?f=a.concat(f):y=-1,f.length&&d())}function d(){if(!l){var e=c(h);l=!0;for(var t=f.length;t;){for(a=f,f=[];++y<t;)a&&a[y].run();y=-1,t=f.length}a=null,l=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new p(e,t)),1!==f.length||l||c(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0)),u=r(1);(n=u)&&n.__esModule;var c=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=s.transform("only"),this.except=s.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":o(e))&&(this.provider=e),this}},{key:"setCachePolicy",value:function(e){return"number"==typeof e&&e>=-1&&e<4?this._query?this.queryCachePolicy=e:this.cachePolicy=e:console.error("Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){if(arguments.length)for(var n=0;n<arguments.length;n++)this._query.include=this._query.include||[],this._query.include=this._query.include.concat(arguments[n]);return this}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"includeContentType",value:function(){return this._query.include_content_type=!0,this}},{key:"includeOwner",value:function(){return this._query.include_owner=!0,this}},{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"fetch",value:function(e){if(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}};var t=Object.assign({},this.fetchOptions,e);return s.sendRequest(this,t)}console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')")}}]),e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=(u(r(2)),function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0))),s=u(r(4));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;console.error("Kindly provide valid parameters.")}},a=function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;console.error("Kindly provide valid parameters.")}},f=function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;console.error("Kindly provide valid parameters.")}},l=function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof d&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},y=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},h=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.error("Argument should be a number.")}},d=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=c("$lt"),e.lessThanOrEqualTo=c("$lte"),e.greaterThan=c("$gt"),e.greaterThanOrEqualTo=c("$gte"),e.notEqualTo=c("$ne"),e.containedIn=a(!0),e.notContainedIn=a(!1),e.exists=f(!0),e.notExists=f(!1),e.ascending=y("asc"),e.descending=y("desc"),e.beforeUid=y("before_uid"),e.afterUid=y("after_uid"),e.skip=h("skip"),e.limit=h("limit"),e.or=l("$or"),e.and=l("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=this.type&&"asset"===this.type?e+this.config.urls.assets:e+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;return this._query.count=!0,this.requestParams={method:"POST",headers:this.headers,url:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=i.mergeDeep(this._query.query,e),this;console.error("Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),this._query.query[e]?this._query.query[e]=this._query.query[e].concat(n):this._query.query[e]=n,this}},{key:"referenceNotIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),this._query.query[e]?this._query.query[e]=this._query.query[e].concat(n):this._query.query[e]=n,this}},{key:"tags",value:function(e){if(Array.isArray(e))return this._query.tags=e,this;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,r=this.type&&"asset"===this.type?t+this.config.urls.assets:t+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;this.requestParams={method:"POST",headers:this.headers,url:r,body:{_method:"GET",query:this._query}};var n=Object.assign({},this.fetchOptions,e);return i.sendRequest(this,n)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=this.type&&"asset"===this.type?e+this.config.urls.assets:e+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;this.singleEntry=!0,this._query.limit=1,this.requestParams={method:"POST",headers:this.headers,url:t,body:{_method:"GET",query:this._query}};var r=Object.assign({},this.fetchOptions);return i.sendRequest(this,r)}}]),t}(s.default);t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.get=function(e){var t=s.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?s.default.setItem(e,JSON.stringify(t)):s.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return s.default||null},t.getKeys=function(){return s.default?Object.keys(s.default):[]};!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);t.default=e}(r(0));var o,i=r(16),s=(o=i)&&o.__esModule?o:{default:o}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(17),i=(n=o)&&n.__esModule?n:{default:n};var s={providers:function(e){if(e)return i.default;console.error("Kindly provide valid provider.")},policies:{IGNORE_CACHE:-1,ONLY_NETWORK:0,CACHE_ELSE_NETWORK:1,NETWORK_ELSE_CACHE:2,CACHE_THEN_NETWORK:3}};t.default=s},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=u(r(1)),i=u(r(7)),s=u(r(18));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=i.default.policies,this.Region=s.default}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(o.default,[null].concat(t)))}}]),e}();e.exports=new c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={protocol:"https",host:"cdn.contentstack.io",port:443,version:"v3",urls:{sync:"/stacks/sync",content_types:"/content_types/",entries:"/entries/",assets:"/assets/",environments:"/environments/"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(r(11)),o=i(r(13));function i(e){return e&&e.__esModule?e:{default:e}}n.default.polyfill(),t.default=o.default},function(e,t,r){"use strict";(function(n,o){var i,s,u,c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Contentstack=t():e.Contentstack=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.transform=function(e){return function(){switch(this._query[e]=this._query[e]||{},arguments.length){case 1:if(Array.isArray(arguments[0])||"string"==typeof arguments[0]){var t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":n(e);switch(t){case"object":t,Array.isArray(e)&&(t="array");break;default:t}return t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var o in n)"object"==r._type(n[o])&&r._type(t[o])==r._type(n[o])?e(t[o],n[o]):"array"==r._type(n[o])&&r._type(t[o])==r._type(n[o])?t[o]=t[o].concat(n[o]):t[o]=n[o]}(e,t),e},t.merge=u,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===(void 0===e?"undefined":n(e))&&"browser"===e.title},t.parseQueryFromParams=c,t.getHash=a,t.generateHash=f,t.resultWrapper=l,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var i=e,s=void 0!==i.queryCachePolicy?i.queryCachePolicy:i.cachePolicy,f=void 0!==i.tojson&&i.tojson,h=!!(i.entry_uid||i.singleEntry||i.asset_uid),d=a(c(i,h,f));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var p=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===p?"undefined":n(p))&&(p=JSON.parse(p)),delete e.requestParams.body.query,e.requestParams.body=u(e.requestParams.body,p)}var v=function(){return function(e,t){return new Promise((function(r,n){try{if(e)throw e;f||(t=l(t)),r(y(t))}catch(e){n(e)}}))}},_=function(r,n,u){r&&(0,o.default)(e.requestParams,t).then(function(t){try{i.entry_uid=i.asset_uid=i.tojson=i.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2!==s||null===i.provider?u({error_code:141,error_message:"The requested entry doesn't exist."}):void i.provider.get(d,v());r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==i.provider?(i.provider.set(d,r,(function(e){try{if(e)throw e;return f||(r=l(r)),n(y(r))}catch(e){return u(e)}})),n(y(r))):Object.keys(o).length?n(o):(f||(r=l(r)),n(y(r)))}catch(e){return u({message:e.message})}}.bind(i)).catch((function(e){if(2!==s||null===i.provider)return u(e);i.provider.get(d,v())}))};switch(s){case 1:return new Promise((function(e,t){null!==i.provider?i.provider.get(d,(function(r,n){try{if(!r&&n)return f||(n=l(n)),e(y(n));_(!0,e,t)}catch(e){return t(e)}})):_(!0,e,t)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){_(!0,e,t)}))}if(3===s){return new Promise((function(e,t){null!==i.provider&&i.provider.get(d,(function(r,n){try{r||!n?t(r):(f||(n=l(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){_(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){_(!0,e,t)}))}))}};var o=s(r(2)),i=s(r(14));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=u({},e.requestParams.body&&e.requestParams.body.query||{});return n.environment_uid&&(delete n.environment_uid,n.environment=e.environment),n.environment=e.environment,{content_type_uid:e.content_type_uid,locale:n.locale||"en-us",query:n,entry_uid:e.entry_uid,asset_uid:e.asset_uid,single:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function a(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function l(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,i.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,o=e.assets.length;n<o;n++)e.assets[n]=(0,i.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,i.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,i.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,i.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})}).call(this,r(3))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=h(r(9)),s=y(r(0)),u=h(r(4)),c=h(r(15)),a=h(r(5)),f=h(r(2)),l=(y(r(6)),h(r(7)));function y(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function h(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var p=[408,429],v=function(){function e(){d(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!p.includes(e.status)}},this.config=Object.assign({},i.default);for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=Object.assign(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=l.default.policies.IGNORE_CACHE,this.provider=l.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if("string"==typeof r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return"string"==typeof r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=Object.assign(this.fetchOptions,r[3]))),this;case 5:return"string"==typeof r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=Object.assign(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=Object.assign(this.fetchOptions,r[4])),this;default:console.error("Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return o(e,[{key:"setPort",value:function(e){return"number"==typeof e&&(this.config.port=e),this}},{key:"setProtocol",value:function(e){return"string"==typeof e&&~["https","http"].indexOf(e)&&(this.config.protocol=e),this}},{key:"setHost",value:function(e){return"string"==typeof e&&e&&(this.config.host=e),this}},{key:"setCachePolicy",value:function(e){return"number"==typeof e&&e>=-1&&e<4?this._query?this.queryCachePolicy=e:this.cachePolicy=e:console.error("Kindly provide the valid policy"),this}},{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(e))&&(this.provider=e),this}},{key:"clearByQuery",value:function(){if(this.provider&&"function"==typeof this.provider.clearByQuery)return this.provider.clearByQuery.apply(this.provider,arguments)}},{key:"clearByContentType",value:function(){if(this.provider&&"function"==typeof this.provider.clearByContentType)return this.provider.clearByContentType.apply(this.provider,arguments)}},{key:"clearAll",value:function(){if(this.provider&&"function"==typeof this.provider.clearAll)return this.provider.clearAll.apply(this.provider,arguments)}},{key:"getCacheProvider",value:function(){return this.provider}},{key:"ContentType",value:function(e){return e&&"string"==typeof e&&(this.content_type_uid=e,this.type="contentType"),this}},{key:"Entry",value:function(e){var t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){var t={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,body:{_method:"GET",environment:this.environment}},r=Object.assign({},this.fetchOptions,e);return(0,f.default)(t,r)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new c.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new a.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){var e={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(0,f.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={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",environment:this.environment}};if(e&&void 0!==e)for(var r in e)t.body[r]=e[r];return(0,f.default)(t,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=Object.assign(this._query,e),this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.sync,body:{_method:"GET",query:this._query}};var r=Object.assign({},this.fetchOptions,t);return s.sendRequest(this,r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var o in t)r.push(o+"="+t[o]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e,t){return new Promise((function(r,o){var i=void 0,c=e.url,a=e.headers;return a["Content-Type"]="application/json; charset=UTF-8",a["X-User-Agent"]="contentstack-web/3.12.1",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,i=function e(t,r){var o=[],i=void 0;if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var s=0,u=t.length;s<u;s++)o.push(r+"[]="+t[s]);else for(i in t){var c=r?r+"["+i+"]":i,a=t[i];o.push(null!==a&&"object"===(void 0===a?"undefined":n(a))&&"query"!==i?e(a,c):c+"="+encodeURIComponent("query"!==i?a:JSON.stringify(a)))}return o.join("&")}(e.body)),function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:300,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,i=arguments[4],c=arguments[5],a=arguments[6],f=Object.assign({method:"GET",headers:r,timeout:3e3},i);function l(s){if(0===o)a(s);else{var f=n;o-=1;var l=i.retryLimit-o;i.retryDelayOptions&&(i.retryDelayOptions.base?f=i.retryDelayOptions.base*l:i.retryDelayOptions.customBackoff&&(f=i.retryDelayOptions.customBackoff(l,s))),u(f).then((function(){return e(t,r,n,o,i,c,a)}))}}(0,s.default)(t,f).then((function(e){var t=e.json();e.ok&&200===e.status?c(t):t.then((function(t){i.retryCondition&&i.retryCondition(e)?l(t):a(t)})).catch((function(){a({status:e.status,statusText:e.statusText})}))})).catch((function(e){a(e)}))}(c+"?"+i,a,t.retryDelay,t.retryLimit,t,r,o)}))};!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);t.default=e}(r(0));var o,i=r(10),s=(o=i)&&o.__esModule?o:{default:o};function u(e){return new Promise((function(t){setTimeout(t,e)}))}},function(e,t,r){"use strict";var n,o,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(e){o=u}}();var a,f=[],l=!1,y=-1;function h(){l&&a&&(l=!1,a.length?f=a.concat(f):y=-1,f.length&&d())}function d(){if(!l){var e=c(h);l=!0;for(var t=f.length;t;){for(a=f,f=[];++y<t;)a&&a[y].run();y=-1,t=f.length}a=null,l=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new p(e,t)),1!==f.length||l||c(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0)),u=r(1);(n=u)&&n.__esModule;var c=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=s.transform("only"),this.except=s.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":o(e))&&(this.provider=e),this}},{key:"setCachePolicy",value:function(e){return"number"==typeof e&&e>=-1&&e<4?this._query?this.queryCachePolicy=e:this.cachePolicy=e:console.error("Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){if(arguments.length)for(var n=0;n<arguments.length;n++)this._query.include=this._query.include||[],this._query.include=this._query.include.concat(arguments[n]);return this}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"includeContentType",value:function(){return this._query.include_content_type=!0,this}},{key:"includeOwner",value:function(){return this._query.include_owner=!0,this}},{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"fetch",value:function(e){if(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}};var t=Object.assign({},this.fetchOptions,e);return s.sendRequest(this,t)}console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')")}}]),e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=(u(r(2)),function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0))),s=u(r(4));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;console.error("Kindly provide valid parameters.")}},a=function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;console.error("Kindly provide valid parameters.")}},f=function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;console.error("Kindly provide valid parameters.")}},l=function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof d&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},y=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},h=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.error("Argument should be a number.")}},d=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=c("$lt"),e.lessThanOrEqualTo=c("$lte"),e.greaterThan=c("$gt"),e.greaterThanOrEqualTo=c("$gte"),e.notEqualTo=c("$ne"),e.containedIn=a(!0),e.notContainedIn=a(!1),e.exists=f(!0),e.notExists=f(!1),e.ascending=y("asc"),e.descending=y("desc"),e.beforeUid=y("before_uid"),e.afterUid=y("after_uid"),e.skip=h("skip"),e.limit=h("limit"),e.or=l("$or"),e.and=l("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=this.type&&"asset"===this.type?e+this.config.urls.assets:e+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;return this._query.count=!0,this.requestParams={method:"POST",headers:this.headers,url:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=i.mergeDeep(this._query.query,e),this;console.error("Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),this._query.query[e]?this._query.query[e]=this._query.query[e].concat(n):this._query.query[e]=n,this}},{key:"referenceNotIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),this._query.query[e]?this._query.query[e]=this._query.query[e].concat(n):this._query.query[e]=n,this}},{key:"tags",value:function(e){if(Array.isArray(e))return this._query.tags=e,this;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,r=this.type&&"asset"===this.type?t+this.config.urls.assets:t+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;this.requestParams={method:"POST",headers:this.headers,url:r,body:{_method:"GET",query:this._query}};var n=Object.assign({},this.fetchOptions,e);return i.sendRequest(this,n)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=this.type&&"asset"===this.type?e+this.config.urls.assets:e+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;this.singleEntry=!0,this._query.limit=1,this.requestParams={method:"POST",headers:this.headers,url:t,body:{_method:"GET",query:this._query}};var r=Object.assign({},this.fetchOptions);return i.sendRequest(this,r)}}]),t}(s.default);t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.get=function(e){var t=s.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?s.default.setItem(e,JSON.stringify(t)):s.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return s.default||null},t.getKeys=function(){return s.default?Object.keys(s.default):[]};!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);t.default=e}(r(0));var o,i=r(16),s=(o=i)&&o.__esModule?o:{default:o}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(17),i=(n=o)&&n.__esModule?n:{default:n};var s={providers:function(e){if(e)return i.default;console.error("Kindly provide valid provider.")},policies:{IGNORE_CACHE:-1,ONLY_NETWORK:0,CACHE_ELSE_NETWORK:1,NETWORK_ELSE_CACHE:2,CACHE_THEN_NETWORK:3}};t.default=s},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=u(r(1)),i=u(r(7)),s=u(r(18));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=i.default.policies,this.Region=s.default}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(o.default,[null].concat(t)))}}]),e}();e.exports=new c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={protocol:"https",host:"cdn.contentstack.io",port:443,version:"v3",urls:{sync:"/stacks/sync",content_types:"/content_types/",entries:"/entries/",assets:"/assets/",environments:"/environments/"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(r(11)),o=i(r(13));function i(e){return e&&e.__esModule?e:{default:e}}n.default.polyfill(),t.default=o.default},function(e,t,r){"use strict";(function(n,o){var i,s,u,c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};
/*!

@@ -9,2 +9,2 @@ * @overview es6-promise - a tiny implementation of Promises/A+.

*/
u=function(){function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,s=void 0,u=void 0,a=function(e,t){v[i]=e,v[i+1]=t,2===(i+=2)&&(u?u(_):O())},f="undefined"!=typeof window?window:void 0,l=f||{},y=l.MutationObserver||l.WebKitMutationObserver,h="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(_,1)}}var v=new Array(1e3);function _(){for(var e=0;e<i;e+=2)(0,v[e])(v[e+1]),v[e]=void 0,v[e+1]=void 0;i=0}var m,g,b,q,O=void 0;function w(e,t){var r=arguments,n=this,o=new this.constructor(P);void 0===o[k]&&L(o);var i=n._state;return i?function(){var e=r[i-1];a((function(){return $(i,o,e,n._result)}))}():x(n,o,e,t),o}function j(e){if(e&&"object"===(void 0===e?"undefined":c(e))&&e.constructor===this)return e;var t=new this(P);return A(t,e),t}h?O=function(){return n.nextTick(_)}:y?(g=0,b=new y(_),q=document.createTextNode(""),b.observe(q,{characterData:!0}),O=function(){q.data=g=++g%2}):d?((m=new MessageChannel).port1.onmessage=_,O=function(){return m.port2.postMessage(0)}):O=void 0===f?function(){try{var e=r(!function(){var e=new Error("Cannot find module 'vertx'");throw e.code="MODULE_NOT_FOUND",e}());return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(_)}:p()}catch(e){return p()}}():p();var k=Math.random().toString(36).substring(16);function P(){}var S=new R;function T(e){try{return e.then}catch(e){return S.error=e,S}}function E(t,r,n){r.constructor===t.constructor&&n===w&&r.constructor.resolve===j?function(e,t){1===t._state?M(e,t._result):2===t._state?K(e,t._result):x(t,void 0,(function(t){return A(e,t)}),(function(t){return K(e,t)}))}(t,r):n===S?(K(t,S.error),S.error=null):void 0===n?M(t,r):e(n)?function(e,t,r){a((function(e){var n=!1,o=function(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}(r,t,(function(r){n||(n=!0,t!==r?A(e,r):M(e,r))}),(function(t){n||(n=!0,K(e,t))}),e._label);!n&&o&&(n=!0,K(e,o))}),e)}(t,r,n):M(t,r)}function A(e,t){var r,n;e===t?K(e,new TypeError("You cannot resolve a promise with itself")):(n=void 0===(r=t)?"undefined":c(r),null===r||"object"!==n&&"function"!==n?M(e,t):E(e,t,T(t)))}function C(e){e._onerror&&e._onerror(e._result),N(e)}function M(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(N,e))}function K(e,t){void 0===e._state&&(e._state=2,e._result=t,a(C,e))}function x(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+1]=r,o[i+2]=n,0===i&&e._state&&a(N,e)}function N(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,s=0;s<t.length;s+=3)n=t[s],o=t[s+r],n?$(r,n,o,i):o(i);e._subscribers.length=0}}function R(){this.error=null}var D=new R;function $(t,r,n,o){var i=e(n),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if((s=function(e,t){try{return e(t)}catch(e){return D.error=e,D}}(n,o))===D?(a=!0,u=s.error,s.error=null):c=!0,r===s)return void K(r,new TypeError("A promises callback cannot return that same promise."))}else s=o,c=!0;void 0!==r._state||(i&&c?A(r,s):a?K(r,u):1===t?M(r,s):2===t&&K(r,s))}var J=0;function L(e){e[k]=J++,e._state=void 0,e._result=void 0,e._subscribers=[]}function B(e,r){this._instanceConstructor=e,this.promise=new e(P),this.promise[k]||L(this.promise),t(r)?(this.length=r.length,this._remaining=r.length,this._result=new Array(this.length),0===this.length?M(this.promise,this._result):(this.length=this.length||0,this._enumerate(r),0===this._remaining&&M(this.promise,this._result))):K(this.promise,new Error("Array Methods must be provided an Array"))}function I(e){this[k]=J++,this._result=this._state=void 0,this._subscribers=[],P!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof I?function(e,t){try{t((function(t){A(e,t)}),(function(t){K(e,t)}))}catch(t){K(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return B.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},B.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===j){var o=T(e);if(o===w&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===I){var i=new r(P);E(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},B.prototype._settledAt=function(e,t,r){var n=this.promise;void 0===n._state&&(this._remaining--,2===e?K(n,r):this._result[t]=r),0===this._remaining&&M(n,this._result)},B.prototype._willSettleAt=function(e,t){var r=this;x(e,void 0,(function(e){return r._settledAt(1,t,e)}),(function(e){return r._settledAt(2,t,e)}))},I.all=function(e){return new B(this,e).promise},I.race=function(e){var r=this;return t(e)?new r((function(t,n){for(var o=e.length,i=0;i<o;i++)r.resolve(e[i]).then(t,n)})):new r((function(e,t){return t(new TypeError("You must pass an array to race."))}))},I.resolve=j,I.reject=function(e){var t=new this(P);return K(t,e),t},I._setScheduler=function(e){u=e},I._setAsap=function(e){a=e},I._asap=a,I.prototype={constructor:I,then:w,catch:function(e){return this.then(null,e)}},I.polyfill=function(){var e=void 0;if(void 0!==o)e=o;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=I},I.Promise=I,I},"object"===c(t)&&void 0!==e?e.exports=u():void 0===(s="function"==typeof(i=u)?i.call(t,r,t,e):i)||(e.exports=s)}).call(this,r(3),r(12))},function(e,t,r){"use strict";var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(n=window)}e.exports=n},function(e,t,r){"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,n.fetch&&(t.default=n.fetch.bind(n)),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));var i=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?o.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new i(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));i(r(1)),i(r(5));function i(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;console.error("Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=Object.assign({},this.fetchOptions,e);return o.sendRequest(this,t)}console.error("Kindly provide an asset uid. e.g. .Assets('bltsomething123')")}}]),e}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(){try{return window.localStorage}catch(e){return null}}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(6));var o={};function i(e,t){!t&&e&&e.length&&e.push("");var r=void 0,o=n.getKeys(),i=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=o.length;s<u;s++)o[s]&&0===o[s].indexOf(r)&&delete i[o[s]]}else for(var c=0,a=o.length;c<a;c++)delete i[o[c]]}o.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},o.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},o.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),i(r),t()}}catch(e){callback(e)}},o.clearByQuery=function(e,t){try{for(var r=n.getKeys(),o=n.getStorage(),i=0,s=r.length;i<s;i++)r[i]&&~r[i].indexOf(e)&&delete o[r[i]];t()}catch(e){t(e)}},o.clearAll=function(e){try{i(),e()}catch(t){e(t)}},t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={EU:"eu",US:"us"}}])}));
u=function(){function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,s=void 0,u=void 0,a=function(e,t){v[i]=e,v[i+1]=t,2===(i+=2)&&(u?u(_):O())},f="undefined"!=typeof window?window:void 0,l=f||{},y=l.MutationObserver||l.WebKitMutationObserver,h="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(_,1)}}var v=new Array(1e3);function _(){for(var e=0;e<i;e+=2)(0,v[e])(v[e+1]),v[e]=void 0,v[e+1]=void 0;i=0}var m,g,b,q,O=void 0;function w(e,t){var r=arguments,n=this,o=new this.constructor(P);void 0===o[k]&&L(o);var i=n._state;return i?function(){var e=r[i-1];a((function(){return $(i,o,e,n._result)}))}():K(n,o,e,t),o}function j(e){if(e&&"object"===(void 0===e?"undefined":c(e))&&e.constructor===this)return e;var t=new this(P);return A(t,e),t}h?O=function(){return n.nextTick(_)}:y?(g=0,b=new y(_),q=document.createTextNode(""),b.observe(q,{characterData:!0}),O=function(){q.data=g=++g%2}):d?((m=new MessageChannel).port1.onmessage=_,O=function(){return m.port2.postMessage(0)}):O=void 0===f?function(){try{var e=r(!function(){var e=new Error("Cannot find module 'vertx'");throw e.code="MODULE_NOT_FOUND",e}());return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(_)}:p()}catch(e){return p()}}():p();var k=Math.random().toString(36).substring(16);function P(){}var S=new R;function T(e){try{return e.then}catch(e){return S.error=e,S}}function E(t,r,n){r.constructor===t.constructor&&n===w&&r.constructor.resolve===j?function(e,t){1===t._state?M(e,t._result):2===t._state?x(e,t._result):K(t,void 0,(function(t){return A(e,t)}),(function(t){return x(e,t)}))}(t,r):n===S?(x(t,S.error),S.error=null):void 0===n?M(t,r):e(n)?function(e,t,r){a((function(e){var n=!1,o=function(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}(r,t,(function(r){n||(n=!0,t!==r?A(e,r):M(e,r))}),(function(t){n||(n=!0,x(e,t))}),e._label);!n&&o&&(n=!0,x(e,o))}),e)}(t,r,n):M(t,r)}function A(e,t){var r,n;e===t?x(e,new TypeError("You cannot resolve a promise with itself")):(n=void 0===(r=t)?"undefined":c(r),null===r||"object"!==n&&"function"!==n?M(e,t):E(e,t,T(t)))}function C(e){e._onerror&&e._onerror(e._result),N(e)}function M(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(N,e))}function x(e,t){void 0===e._state&&(e._state=2,e._result=t,a(C,e))}function K(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+1]=r,o[i+2]=n,0===i&&e._state&&a(N,e)}function N(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,s=0;s<t.length;s+=3)n=t[s],o=t[s+r],n?$(r,n,o,i):o(i);e._subscribers.length=0}}function R(){this.error=null}var D=new R;function $(t,r,n,o){var i=e(n),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if((s=function(e,t){try{return e(t)}catch(e){return D.error=e,D}}(n,o))===D?(a=!0,u=s.error,s.error=null):c=!0,r===s)return void x(r,new TypeError("A promises callback cannot return that same promise."))}else s=o,c=!0;void 0!==r._state||(i&&c?A(r,s):a?x(r,u):1===t?M(r,s):2===t&&x(r,s))}var J=0;function L(e){e[k]=J++,e._state=void 0,e._result=void 0,e._subscribers=[]}function B(e,r){this._instanceConstructor=e,this.promise=new e(P),this.promise[k]||L(this.promise),t(r)?(this.length=r.length,this._remaining=r.length,this._result=new Array(this.length),0===this.length?M(this.promise,this._result):(this.length=this.length||0,this._enumerate(r),0===this._remaining&&M(this.promise,this._result))):x(this.promise,new Error("Array Methods must be provided an Array"))}function I(e){this[k]=J++,this._result=this._state=void 0,this._subscribers=[],P!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof I?function(e,t){try{t((function(t){A(e,t)}),(function(t){x(e,t)}))}catch(t){x(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return B.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},B.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===j){var o=T(e);if(o===w&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===I){var i=new r(P);E(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},B.prototype._settledAt=function(e,t,r){var n=this.promise;void 0===n._state&&(this._remaining--,2===e?x(n,r):this._result[t]=r),0===this._remaining&&M(n,this._result)},B.prototype._willSettleAt=function(e,t){var r=this;K(e,void 0,(function(e){return r._settledAt(1,t,e)}),(function(e){return r._settledAt(2,t,e)}))},I.all=function(e){return new B(this,e).promise},I.race=function(e){var r=this;return t(e)?new r((function(t,n){for(var o=e.length,i=0;i<o;i++)r.resolve(e[i]).then(t,n)})):new r((function(e,t){return t(new TypeError("You must pass an array to race."))}))},I.resolve=j,I.reject=function(e){var t=new this(P);return x(t,e),t},I._setScheduler=function(e){u=e},I._setAsap=function(e){a=e},I._asap=a,I.prototype={constructor:I,then:w,catch:function(e){return this.then(null,e)}},I.polyfill=function(){var e=void 0;if(void 0!==o)e=o;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=I},I.Promise=I,I},"object"===c(t)&&void 0!==e?e.exports=u():void 0===(s="function"==typeof(i=u)?i.call(t,r,t,e):i)||(e.exports=s)}).call(this,r(3),r(12))},function(e,t,r){"use strict";var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(n=window)}e.exports=n},function(e,t,r){"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,n.fetch&&(t.default=n.fetch.bind(n)),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));var i=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?o.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new i(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));i(r(1)),i(r(5));function i(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;console.error("Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=Object.assign({},this.fetchOptions,e);return o.sendRequest(this,t)}console.error("Kindly provide an asset uid. e.g. .Assets('bltsomething123')")}}]),e}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(){try{return window.localStorage}catch(e){return null}}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(6));var o={};function i(e,t){!t&&e&&e.length&&e.push("");var r=void 0,o=n.getKeys(),i=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=o.length;s<u;s++)o[s]&&0===o[s].indexOf(r)&&delete i[o[s]]}else for(var c=0,a=o.length;c<a;c++)delete i[o[c]]}o.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},o.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},o.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),i(r),t()}}catch(e){callback(e)}},o.clearByQuery=function(e,t){try{for(var r=n.getKeys(),o=n.getStorage(),i=0,s=r.length;i<s;i++)r[i]&&~r[i].indexOf(e)&&delete o[r[i]];t()}catch(e){t(e)}},o.clearAll=function(e){try{i(),e()}catch(t){e(t)}},t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={EU:"eu",US:"us"}}])}));
{
"name": "contentstack",
"version": "3.12.0",
"version": "3.12.1",
"description": "Contentstack Javascript SDK",

@@ -5,0 +5,0 @@ "homepage": "https://www.contentstack.com/",

@@ -60,3 +60,5 @@ import * as Utils from "./utils.js";

}
async function safeParseJSON(response) {
const body = await response.text();
}
function fetchRetry(url, headers, retryDelay = 300, retryLimit = 5, fetchOptions, resolve, reject) {

@@ -91,3 +93,3 @@ var option = Object.assign({

fetch(url, option)
.then(function(response) {
.then(function(response) {
let data = response.json();

@@ -103,2 +105,4 @@ if (response.ok && response.status === 200) {

}
}).catch(() => {
reject({status: response.status, statusText: response.statusText})
});

@@ -105,0 +109,0 @@ }

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

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

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

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