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

contentstack

Package Overview
Dependencies
Maintainers
3
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.9.2 to 3.10.0

2

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()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)}([function(e,t,r){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function o(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")}}}function i(e){var t=void 0===e?"undefined":p(e);switch(t){case"object":t,Array.isArray(e)&&(t="array");break;default:t}return t}function s(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}function u(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function a(){return"undefined"!=typeof window&&"object"===(void 0===e?"undefined":p(e))&&"browser"===e.title}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 f(e){try{var t=l(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 l(e){var t=0,r=void 0,n=void 0,o=void 0;if(0===e.length)return t;for(r=0,o=e.length;r<o;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t<-1?-1*t:t}function y(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,b.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,b.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,b.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,b.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,b.default)(e.items).toJSON());return e}function h(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)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}function d(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:e._query?e._query.environment=e.environment:(e._query={},e._query.environment=e.environment);var n=e,o=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,i=void 0!==n.tojson&&n.tojson,s=!!(n.entry_uid||n.singleEntry||n.asset_uid),a=f(c(n,s,i));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var l=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===l?"undefined":p(l))&&(l=JSON.parse(l)),delete e.requestParams.body.query,e.requestParams.body=u(e.requestParams.body,l)}var d=function(){return function(e,t){return new Promise(function(r,n){try{if(e)throw e;i||(t=y(t)),r(h(t))}catch(e){n(e)}})}},v=function(r,s,u){r&&(0,_.default)(e.requestParams,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},c={};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!==o||null===n.provider?u({error_code:141,error_message:"The requested entry doesn't exist."}):void n.provider.get(a,d());r.assets=t.assets[0]}else t.items?c={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==o&&null!==n.provider?(n.provider.set(a,r,function(e){try{if(e)throw e;return i||(r=y(r)),s(h(r))}catch(e){return u(e)}}),s(h(r))):Object.keys(c).length?s(c):(i||(r=y(r)),s(h(r)))}catch(e){return u({message:e.message})}}.bind(n)).catch(function(e){if(2!==o||null===n.provider)return u(e);n.provider.get(a,d())})};switch(o){case 1:return new Promise(function(e,t){null!==n.provider?n.provider.get(a,function(r,n){try{if(!r&&n)return i||(n=y(n)),e(h(n));v(!0,e,t)}catch(e){return t(e)}}):v(!0,e,t)});case 2:case 0:case void 0:case-1:return new Promise(function(e,t){v(!0,e,t)})}if(3===o){return new Promise(function(e,t){null!==n.provider&&n.provider.get(a,function(r,n){try{r||!n?t(r):(i||(n=y(n)),e(h(n)))}catch(e){t(e)}})}).then(function(){return new Promise(function(e,t){v(!0,e,t)})}).catch(function(e){return new Promise(function(e,t){v(!0,e,t)})})}}Object.defineProperty(t,"__esModule",{value:!0});var p="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=o,t._type=i,t.mergeDeep=s,t.merge=u,t.isBrowser=a,t.parseQueryFromParams=c,t.getHash=f,t.generateHash=l,t.resultWrapper=y,t.spreadResult=h,t.sendRequest=d;var v=r(2),_=n(v),m=r(17),b=n(m);!function(){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(t,r(4))},function(e,t,r){"use strict";function n(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 o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s="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},u=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}}(),a=r(9),c=o(a),f=r(0),l=n(f),y=r(6),h=o(y),d=r(16),p=o(d),v=r(7),_=o(v),m=r(2),b=o(m),g=r(5),q=(n(g),r(3)),w=o(q),O=function(){function e(){i(this,e);for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];switch(r[0].region&&void 0!=r[0].region&&"us"!=r[0].region&&(c.default.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!=r[0].fetchOptions&&(this.fetchOptions=r[0].fetchOptions),this.config=c.default,this.cachePolicy=w.default.policies.IGNORE_CACHE,this.provider=w.default.providers("localstorage"),r.length){case 1:if("object"===s(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]&&"us"!==r[3].region&&"eu"===r[3].region?c.default.host=r[3]+"-cdn.contentstack.com":"object"===s(r[3])&&(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]&&"us"!==r[3].region?c.default.host=r[3]+"-cdn.contentstack.com":"object"===s(r[3])&&(this.fetchOptions=r[3])),r[4]&&"object"===s(r[4])&&(this.fetchOptions=r[4]),this;default:console.error("Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return u(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":s(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 h.default;return e&&"string"==typeof e&&(t.entry_uid=e),l.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,b.default)(t,r)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new p.default;return t.asset_uid=e,l.merge(t,this)}return this}},{key:"Query",value:function(){var e=new _.default;return l.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,b.default)(e,this.fetchOptions)}},{key:"getContentTypes",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,body:{_method:"GET",environment:this.environment}};if(e&&void 0!==e)for(var r in e)t.body[r]=e[r];return(0,b.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 l.sendRequest(this,r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":s(t))&&void 0===t.length){var r=[];for(var n in t)r.push(n+"="+t[n]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=O},function(e,t,r){"use strict";function n(e,t){return new Promise(function(r,n){var i=void 0,s=e.url,c=e.headers;c["Content-Type"]="application/json; charset=UTF-8",c["X-User-Agent"]="contentstack-web/"+a,e.body&&"object"===o(e.body)&&(delete e.body._method,"object"===o(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,i=function e(t,r){var n=[],i=void 0;if("object"===(void 0===t?"undefined":o(t))&&void 0!==t.length)for(var s=0,u=t.length;s<u;s++)n.push(r+"[]="+t[s]);else for(i in t){var a=r?r+"["+i+"]":i,c=t[i];n.push(null!==c&&"object"===(void 0===c?"undefined":o(c))&&"query"!==i?e(c,a):a+"="+encodeURIComponent("query"!==i?c:JSON.stringify(c)))}return n.join("&")}(e.body));var f=Object.assign({method:"GET",headers:c,timeout:3e3},t);(0,u.default)(s+"?"+i,f).then(function(e){if(e.ok&&200===e.status){var t=e.json();r(t)}else n(e.statusText)}).catch(function(e){console.log("Error: ",e),n(e)})})}Object.defineProperty(t,"__esModule",{value:!0});var 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};t.default=n;var i=r(0),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]);t.default=e}(i),r(18)),u=function(e){return e&&e.__esModule?e:{default:e}}(s),a="3.9.1"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=function(e){return e&&e.__esModule?e:{default:e}}(n),i={};i.providers=function(e){if(e)return o.default;console.error("Kindly provide valid provider.")},i.policies={IGNORE_CACHE:-1,ONLY_NETWORK:0,CACHE_ELSE_NETWORK:1,NETWORK_ELSE_CACHE:2,CACHE_THEN_NETWORK:3},t.default=i},function(e,t,r){"use strict";function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(y===clearTimeout)return clearTimeout(e);if((y===o||!y)&&clearTimeout)return y=clearTimeout,clearTimeout(e);try{return y(e)}catch(t){try{return y.call(null,e)}catch(t){return y.call(this,e)}}}function u(){v&&d&&(v=!1,d.length?p=d.concat(p):_=-1,p.length&&a())}function a(){if(!v){var e=i(u);v=!0;for(var t=p.length;t;){for(d=p,p=[];++_<t;)d&&d[_].run();_=-1,t=p.length}d=null,v=!1,s(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,y,h=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{y="function"==typeof clearTimeout?clearTimeout:o}catch(e){y=o}}();var d,p=[],v=!1,_=-1;h.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];p.push(new c(e,t)),1!==p.length||v||i(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.prependListener=f,h.prependOnceListener=f,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(e,t,r){"use strict";function n(e){var t=f.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null}function o(e,t){try{"object"===(void 0===t?"undefined":u(t))?f.default.setItem(e,JSON.stringify(t)):f.default.setItem(e,t)}catch(e){}}function i(){return f.default||null}function s(){return f.default?Object.keys(f.default):[]}Object.defineProperty(t,"__esModule",{value:!0});var u="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=n,t.set=o,t.getStorage=i,t.getKeys=s;var a=r(0),c=(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}(a),r(19)),f=function(e){return e&&e.__esModule?e:{default:e}}(c)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var 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=r(0),u=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}(s),a=r(1),c=(function(e){e&&e.__esModule}(a),function(){function e(){return n(this,e),this._query={},this.only=u.transform("only"),this.except=u.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:"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 u.sendRequest(this,t)}console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')")}}]),e}());t.default=c},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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}function s(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)}Object.defineProperty(t,"__esModule",{value:!0});var u=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}}(),a="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},c=r(2),f=(n(c),r(0)),l=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}(f),y=r(6),h=n(y),d={compare: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.")}},contained: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.")}},exists: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.")}},logical:function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof p&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===a(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}},sort:function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},pagination:function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.error("Argument should be a number.")}}},p=function(e){function t(){o(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=d.compare("$lt"),e.lessThanOrEqualTo=d.compare("$lte"),e.greaterThan=d.compare("$gt"),e.greaterThanOrEqualTo=d.compare("$gte"),e.notEqualTo=d.compare("$ne"),e.containedIn=d.contained(!0),e.notContainedIn=d.contained(!1),e.exists=d.exists(!0),e.notExists=d.exists(!1),e.ascending=d.sort("asc"),e.descending=d.sort("desc"),e.beforeUid=d.sort("before_uid"),e.afterUid=d.sort("after_uid"),e.skip=d.pagination("skip"),e.limit=d.pagination("limit"),e.or=d.logical("$or"),e.and=d.logical("$and"),e}return s(t,e),u(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":a(e)))return this._query.query=l.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":a(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":a(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 l.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 l.sendRequest(this,r)}}]),t}(h.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={EU:"eu",US:"us"};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={protocol:"https",host:"cdn.contentstack.io",port:443,version:"v3",urls:{sync:"/stacks/sync",content_types:"/content_types/",entries:"/entries/",assets:"/assets/",environments:"/environments/"}};t.default=n},function(e,t,r){"use strict";(function(n,o){var i,s,u="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()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)}([function(e,t,r){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function o(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")}}}function i(e){var t=void 0===e?"undefined":p(e);switch(t){case"object":t,Array.isArray(e)&&(t="array");break;default:t}return t}function s(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}function u(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function a(){return"undefined"!=typeof window&&"object"===(void 0===e?"undefined":p(e))&&"browser"===e.title}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 f(e){try{var t=l(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 l(e){var t=0,r=void 0,n=void 0,o=void 0;if(0===e.length)return t;for(r=0,o=e.length;r<o;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t<-1?-1*t:t}function y(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,b.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,b.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,b.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,b.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,b.default)(e.items).toJSON());return e}function h(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)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}function d(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:e._query?e._query.environment=e.environment:(e._query={},e._query.environment=e.environment);var n=e,o=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,i=void 0!==n.tojson&&n.tojson,s=!!(n.entry_uid||n.singleEntry||n.asset_uid),a=f(c(n,s,i));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var l=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===l?"undefined":p(l))&&(l=JSON.parse(l)),delete e.requestParams.body.query,e.requestParams.body=u(e.requestParams.body,l)}var d=function(){return function(e,t){return new Promise(function(r,n){try{if(e)throw e;i||(t=y(t)),r(h(t))}catch(e){n(e)}})}},v=function(r,s,u){r&&(0,_.default)(e.requestParams,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},c={};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!==o||null===n.provider?u({error_code:141,error_message:"The requested entry doesn't exist."}):void n.provider.get(a,d());r.assets=t.assets[0]}else t.items?c={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==o&&null!==n.provider?(n.provider.set(a,r,function(e){try{if(e)throw e;return i||(r=y(r)),s(h(r))}catch(e){return u(e)}}),s(h(r))):Object.keys(c).length?s(c):(i||(r=y(r)),s(h(r)))}catch(e){return u({message:e.message})}}.bind(n)).catch(function(e){if(2!==o||null===n.provider)return u(e);n.provider.get(a,d())})};switch(o){case 1:return new Promise(function(e,t){null!==n.provider?n.provider.get(a,function(r,n){try{if(!r&&n)return i||(n=y(n)),e(h(n));v(!0,e,t)}catch(e){return t(e)}}):v(!0,e,t)});case 2:case 0:case void 0:case-1:return new Promise(function(e,t){v(!0,e,t)})}if(3===o){return new Promise(function(e,t){null!==n.provider&&n.provider.get(a,function(r,n){try{r||!n?t(r):(i||(n=y(n)),e(h(n)))}catch(e){t(e)}})}).then(function(){return new Promise(function(e,t){v(!0,e,t)})}).catch(function(e){return new Promise(function(e,t){v(!0,e,t)})})}}Object.defineProperty(t,"__esModule",{value:!0});var p="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=o,t._type=i,t.mergeDeep=s,t.merge=u,t.isBrowser=a,t.parseQueryFromParams=c,t.getHash=f,t.generateHash=l,t.resultWrapper=y,t.spreadResult=h,t.sendRequest=d;var v=r(2),_=n(v),m=r(17),b=n(m);!function(){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(t,r(4))},function(e,t,r){"use strict";function n(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 o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s="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},u=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}}(),a=r(9),c=o(a),f=r(0),l=n(f),y=r(6),h=o(y),d=r(16),p=o(d),v=r(7),_=o(v),m=r(2),b=o(m),g=r(5),q=(n(g),r(3)),w=o(q),O=function(){function e(){i(this,e);for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(c.default.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=r[0].fetchOptions),this.config=c.default,this.cachePolicy=w.default.policies.IGNORE_CACHE,this.provider=w.default.providers("localstorage"),r.length){case 1:if("object"===s(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]&&"us"!==r[3]?c.default.host=r[3]+"-cdn.contentstack.com":"object"===s(r[3])&&(this.fetchOptions=r[3])),this.config=c.default,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]&&"us"!==r[3]?c.default.host=r[3]+"-cdn.contentstack.com":"object"===s(r[3])&&(this.fetchOptions=r[3])),r[4]&&"object"===s(r[4])&&(this.fetchOptions=r[4]),this.config=c.default,this;default:console.error("Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return u(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":s(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 h.default;return e&&"string"==typeof e&&(t.entry_uid=e),l.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,b.default)(t,r)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new p.default;return t.asset_uid=e,l.merge(t,this)}return this}},{key:"Query",value:function(){var e=new _.default;return l.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,b.default)(e,this.fetchOptions)}},{key:"getContentTypes",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,body:{_method:"GET",environment:this.environment}};if(e&&void 0!==e)for(var r in e)t.body[r]=e[r];return(0,b.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 l.sendRequest(this,r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":s(t))&&void 0===t.length){var r=[];for(var n in t)r.push(n+"="+t[n]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=O},function(e,t,r){"use strict";function n(e,t){return new Promise(function(r,n){var i=void 0,s=e.url,c=e.headers;c["Content-Type"]="application/json; charset=UTF-8",c["X-User-Agent"]="contentstack-web/"+a,e.body&&"object"===o(e.body)&&(delete e.body._method,"object"===o(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,i=function e(t,r){var n=[],i=void 0;if("object"===(void 0===t?"undefined":o(t))&&void 0!==t.length)for(var s=0,u=t.length;s<u;s++)n.push(r+"[]="+t[s]);else for(i in t){var a=r?r+"["+i+"]":i,c=t[i];n.push(null!==c&&"object"===(void 0===c?"undefined":o(c))&&"query"!==i?e(c,a):a+"="+encodeURIComponent("query"!==i?c:JSON.stringify(c)))}return n.join("&")}(e.body));var f=Object.assign({method:"GET",headers:c},t);(0,u.default)(s+"?"+i,f).then(function(e){if(e.ok&&200===e.status){var t=e.json();r(t)}else n(e.statusText)}).catch(function(e){console.log("Error: ",e),n(e)})})}Object.defineProperty(t,"__esModule",{value:!0});var 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};t.default=n;var i=r(0),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]);t.default=e}(i),r(18)),u=function(e){return e&&e.__esModule?e:{default:e}}(s),a="3.10.0"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=function(e){return e&&e.__esModule?e:{default:e}}(n),i={};i.providers=function(e){if(e)return o.default;console.error("Kindly provide valid provider.")},i.policies={IGNORE_CACHE:-1,ONLY_NETWORK:0,CACHE_ELSE_NETWORK:1,NETWORK_ELSE_CACHE:2,CACHE_THEN_NETWORK:3},t.default=i},function(e,t,r){"use strict";function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(y===clearTimeout)return clearTimeout(e);if((y===o||!y)&&clearTimeout)return y=clearTimeout,clearTimeout(e);try{return y(e)}catch(t){try{return y.call(null,e)}catch(t){return y.call(this,e)}}}function u(){v&&d&&(v=!1,d.length?p=d.concat(p):_=-1,p.length&&a())}function a(){if(!v){var e=i(u);v=!0;for(var t=p.length;t;){for(d=p,p=[];++_<t;)d&&d[_].run();_=-1,t=p.length}d=null,v=!1,s(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,y,h=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{y="function"==typeof clearTimeout?clearTimeout:o}catch(e){y=o}}();var d,p=[],v=!1,_=-1;h.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];p.push(new c(e,t)),1!==p.length||v||i(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.prependListener=f,h.prependOnceListener=f,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(e,t,r){"use strict";function n(e){var t=f.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null}function o(e,t){try{"object"===(void 0===t?"undefined":u(t))?f.default.setItem(e,JSON.stringify(t)):f.default.setItem(e,t)}catch(e){}}function i(){return f.default||null}function s(){return f.default?Object.keys(f.default):[]}Object.defineProperty(t,"__esModule",{value:!0});var u="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=n,t.set=o,t.getStorage=i,t.getKeys=s;var a=r(0),c=(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}(a),r(19)),f=function(e){return e&&e.__esModule?e:{default:e}}(c)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var 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=r(0),u=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}(s),a=r(1),c=(function(e){e&&e.__esModule}(a),function(){function e(){return n(this,e),this._query={},this.only=u.transform("only"),this.except=u.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:"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 u.sendRequest(this,t)}console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')")}}]),e}());t.default=c},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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}function s(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)}Object.defineProperty(t,"__esModule",{value:!0});var u=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}}(),a="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},c=r(2),f=(n(c),r(0)),l=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}(f),y=r(6),h=n(y),d={compare: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.")}},contained: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.")}},exists: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.")}},logical:function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof p&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===a(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}},sort:function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},pagination:function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.error("Argument should be a number.")}}},p=function(e){function t(){o(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=d.compare("$lt"),e.lessThanOrEqualTo=d.compare("$lte"),e.greaterThan=d.compare("$gt"),e.greaterThanOrEqualTo=d.compare("$gte"),e.notEqualTo=d.compare("$ne"),e.containedIn=d.contained(!0),e.notContainedIn=d.contained(!1),e.exists=d.exists(!0),e.notExists=d.exists(!1),e.ascending=d.sort("asc"),e.descending=d.sort("desc"),e.beforeUid=d.sort("before_uid"),e.afterUid=d.sort("after_uid"),e.skip=d.pagination("skip"),e.limit=d.pagination("limit"),e.or=d.logical("$or"),e.and=d.logical("$and"),e}return s(t,e),u(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":a(e)))return this._query.query=l.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":a(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":a(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 l.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 l.sendRequest(this,r)}}]),t}(h.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={EU:"eu",US:"us"};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={protocol:"https",host:"cdn.contentstack.io",port:443,version:"v3",urls:{sync:"/stacks/sync",content_types:"/content_types/",entries:"/entries/",assets:"/assets/",environments:"/environments/"}};t.default=n},function(e,t,r){"use strict";(function(n,o){var i,s,u="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};/*!
* @overview es6-promise - a tiny implementation of Promises/A+.

@@ -3,0 +3,0 @@ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)

{
"name": "contentstack",
"version": "3.9.2",
"version": "3.10.0",
"description": "Contentstack Javascript SDK",

@@ -12,3 +12,3 @@ "homepage": "https://www.contentstack.com/",

"browser": "dist/web/contentstack.js",
"_id": "contentstack@3.9.2",
"_id": "contentstack@3.10.0",
"scripts": {

@@ -48,10 +48,10 @@ "test": "tape test/index.js | tap-html --out ./tap-html.html",

"shasum": "a328ed07240476a26b31a23261355dc929e1da63",
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.9.2.tgz"
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.10.0.tgz"
},
"license": "MIT",
"directories": {},
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.9.2.tgz",
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.10.0.tgz",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/contentstack-3.9.2.tgz_1477830884275_0.9869455888401717"
"tmp": "tmp/contentstack-3.10.0.tgz_1477830884275_0.9869455888401717"
},

@@ -58,0 +58,0 @@ "devDependencies": {

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

headers: headers,
timeout: 3000,
},

@@ -51,0 +50,0 @@ fetchOptions);

@@ -19,4 +19,5 @@ import config from '../../config';

* @param environment - Stack Environment name.
* @param fetchOption - Custom setting for the request.
* @param fetchOption.timeout - Set timeout for the request.
* @param region - DB region for Stack.
* @param fetchOptions - Custom setting for the request.
* @param fetchOptions.timeout - Set timeout for the request.
*

@@ -29,3 +30,3 @@ * @example

* 'region': 'us',
* 'fetchOption': {
* 'fetchOptions': {
*

@@ -44,7 +45,7 @@ * }

constructor(...stack_arguments) {
if(stack_arguments[0].region && stack_arguments[0].region != undefined && stack_arguments[0].region != "us") {
if(stack_arguments[0].region && stack_arguments[0].region !== undefined && stack_arguments[0].region !== "us") {
config['host'] = stack_arguments[0].region+"-"+"cdn.contentstack.com";
}
if (stack_arguments[0].fetchOptions && stack_arguments[0].fetchOptions != undefined) {
if (stack_arguments[0].fetchOptions && stack_arguments[0].fetchOptions !== undefined) {
this.fetchOptions = stack_arguments[0].fetchOptions;

@@ -91,3 +92,3 @@ }

if (stack_arguments[3]) {
if(typeof stack_arguments[3] === "string" && stack_arguments[3].region !== "us" && stack_arguments[3].region === "eu") {
if(typeof stack_arguments[3] === "string" && stack_arguments[3] !== "us") {
config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";

@@ -98,2 +99,3 @@ } else if (typeof stack_arguments[3] === 'object') {

}
this.config = config;
return this;

@@ -112,3 +114,3 @@ case 5:

if (stack_arguments[3]) {
if(typeof stack_arguments[3] === "string" && stack_arguments[3].region !== "us") {
if(typeof stack_arguments[3] === "string" && stack_arguments[3] !== "us") {
config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";

@@ -122,2 +124,3 @@ } else if (typeof stack_arguments[3] === 'object') {

}
this.config = config;
return this;

@@ -124,0 +127,0 @@ default:

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