microcms-js-sdk 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node-fetch"),t=require("qs");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),o=n(t),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function c(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}a((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var a=function(e){return"string"==typeof e};exports.createClient=function(e){var t=e.serviceDomain,n=e.apiKey;if(!t||!n)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!a(t)||!a(n))throw new Error("parameter is not string");var s="https://".concat(t,".").concat("microcms.io","/api/").concat("v1"),d=function(e){var t=e.endpoint,a=e.contentId,d=e.queries,f=void 0===d?{}:d,l=e.method,p=e.customHeaders,v=e.customBody;return c(void 0,void 0,void 0,(function(){var e,c,d,h,w,y;return u(this,(function(u){switch(u.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return o.default.stringify(e,{arrayFormat:"comma"})}(f),c={headers:i(i({},p),{"X-MICROCMS-API-KEY":n}),body:v,method:l},d="".concat(s,"/").concat(t).concat(a?"/".concat(a):"").concat(e?"?".concat(e):""),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r.default(d,c)];case 2:if(!(h=u.sent()).ok)throw new Error("fetch API response status: ".concat(h.status));return[2,h.json()];case 3:if((w=u.sent()).data)throw w.data;if(null===(y=w.response)||void 0===y?void 0:y.data)throw w.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(w)))];case 4:return[2]}}))}))};return{get:function(e){var t=e.endpoint,n=e.contentId,r=e.queries,o=void 0===r?{}:r;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,contentId:n,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var t=e.endpoint,n=e.queries,r=void 0===n?{}:n;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,queries:r})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var t=e.endpoint,n=e.contentId,r=e.queries,o=void 0===r?{}:r;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,contentId:n,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var t=e.endpoint,n=e.queries,r=void 0===n?{}:n;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,queries:r})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var t=e.endpoint,n=e.contentId,r=e.content,o=e.isDraft,i=void 0!==o&&o;return c(void 0,void 0,void 0,(function(){var e,o,c,a;return u(this,(function(u){return t?(e=i?{status:"draft"}:{},o=n?"PUT":"POST",c={"Content-Type":"application/json"},a=JSON.stringify(r),[2,d({endpoint:t,contentId:n,queries:e,method:o,customHeaders:c,customBody:a})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var t=e.endpoint,n=e.contentId,r=e.content;return c(void 0,void 0,void 0,(function(){var e,o;return u(this,(function(i){return t?("PATCH",e={"Content-Type":"application/json"},o=JSON.stringify(r),[2,d({endpoint:t,contentId:n,method:"PATCH",customHeaders:e,customBody:o})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var t=e.endpoint,n=e.contentId;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?n?("DELETE",[4,d({endpoint:t,contentId:n,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node-fetch"),t=require("qs");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),o=n(t),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function c(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}a((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var a=function(e){return"string"==typeof e};exports.createClient=function(e){var t=e.serviceDomain,n=e.apiKey;if(!t||!n)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!a(t)||!a(n))throw new Error("parameter is not string");var s="https://".concat(t,".").concat("microcms.io","/api/").concat("v1"),d=function(e){var t=e.endpoint,a=e.contentId,d=e.queries,f=void 0===d?{}:d,l=e.method,p=e.customHeaders,v=e.customBody;return c(void 0,void 0,void 0,(function(){var e,c,d,h,w,y;return u(this,(function(u){switch(u.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return o.default.stringify(e,{arrayFormat:"comma"})}(f),c={headers:i(i({},p),{"X-MICROCMS-API-KEY":n}),body:v,method:l},d="".concat(s,"/").concat(t).concat(a?"/".concat(a):"").concat(e?"?".concat(e):""),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r.default(d,c)];case 2:if(!(h=u.sent()).ok)throw new Error("fetch API response status: ".concat(h.status));return"DELETE"===l?[2]:[2,h.json()];case 3:if((w=u.sent()).data)throw w.data;if(null===(y=w.response)||void 0===y?void 0:y.data)throw w.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(w)))];case 4:return[2]}}))}))};return{get:function(e){var t=e.endpoint,n=e.contentId,r=e.queries,o=void 0===r?{}:r;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,contentId:n,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var t=e.endpoint,n=e.queries,r=void 0===n?{}:n;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,queries:r})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var t=e.endpoint,n=e.contentId,r=e.queries,o=void 0===r?{}:r;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,contentId:n,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var t=e.endpoint,n=e.queries,r=void 0===n?{}:n;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,queries:r})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var t=e.endpoint,n=e.contentId,r=e.content,o=e.isDraft,i=void 0!==o&&o;return c(void 0,void 0,void 0,(function(){var e,o,c,a;return u(this,(function(u){return t?(e=i?{status:"draft"}:{},o=n?"PUT":"POST",c={"Content-Type":"application/json"},a=JSON.stringify(r),[2,d({endpoint:t,contentId:n,queries:e,method:o,customHeaders:c,customBody:a})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var t=e.endpoint,n=e.contentId,r=e.content;return c(void 0,void 0,void 0,(function(){var e,o;return u(this,(function(i){return t?("PATCH",e={"Content-Type":"application/json"},o=JSON.stringify(r),[2,d({endpoint:t,contentId:n,method:"PATCH",customHeaders:e,customBody:o})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var t=e.endpoint,n=e.contentId;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?n?("DELETE",[4,d({endpoint:t,contentId:n,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}};
|
|
2
2
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWljcm9jbXMtanMtc2RrLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -12,5 +12,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,u)}a((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;c;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=n.call(e,c)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var i=function(e){return"string"==typeof e},c=function(c){var u=c.serviceDomain,a=c.apiKey;if(!u||!a)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!i(u)||!i(a))throw new Error("parameter is not string");var s="https://".concat(u,".").concat("microcms.io","/api/").concat("v1"),d=function(i){var c=i.endpoint,u=i.contentId,d=i.queries,f=void 0===d?{}:d,p=i.method,l=i.customHeaders,v=i.customBody;return r(void 0,void 0,void 0,(function(){var r,i,d,h,m,w;return o(this,(function(o){switch(o.label){case 0:r=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return n.stringify(e,{arrayFormat:"comma"})}(f),i={headers:t(t({},l),{"X-MICROCMS-API-KEY":a}),body:v,method:p},d="".concat(s,"/").concat(c).concat(u?"/".concat(u):"").concat(r?"?".concat(r):""),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e(d,i)];case 2:if(!(h=o.sent()).ok)throw new Error("fetch API response status: ".concat(h.status));return[2,h.json()];case 3:if((m=o.sent()).data)throw m.data;if(null===(w=m.response)||void 0===w?void 0:w.data)throw m.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(m)))];case 4:return[2]}}))}))};return{get:function(e){var n=e.endpoint,t=e.contentId,i=e.queries,c=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,contentId:t,queries:c})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var n=e.endpoint,t=e.queries,i=void 0===t?{}:t;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var n=e.endpoint,t=e.contentId,i=e.queries,c=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,contentId:t,queries:c})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var n=e.endpoint,t=e.queries,i=void 0===t?{}:t;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var n=e.endpoint,t=e.contentId,i=e.content,c=e.isDraft,u=void 0!==c&&c;return r(void 0,void 0,void 0,(function(){var e,r,c,a;return o(this,(function(o){return n?(e=u?{status:"draft"}:{},r=t?"PUT":"POST",c={"Content-Type":"application/json"},a=JSON.stringify(i),[2,d({endpoint:n,contentId:t,queries:e,method:r,customHeaders:c,customBody:a})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var n=e.endpoint,t=e.contentId,i=e.content;return r(void 0,void 0,void 0,(function(){var e,r;return o(this,(function(o){return n?("PATCH",e={"Content-Type":"application/json"},r=JSON.stringify(i),[2,d({endpoint:n,contentId:t,method:"PATCH",customHeaders:e,customBody:r})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var n=e.endpoint,t=e.contentId;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?t?("DELETE",[4,d({endpoint:n,contentId:t,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}};export{c as createClient};
|
|
15
|
+
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,u)}a((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;c;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=n.call(e,c)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var i=function(e){return"string"==typeof e},c=function(c){var u=c.serviceDomain,a=c.apiKey;if(!u||!a)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!i(u)||!i(a))throw new Error("parameter is not string");var s="https://".concat(u,".").concat("microcms.io","/api/").concat("v1"),d=function(i){var c=i.endpoint,u=i.contentId,d=i.queries,f=void 0===d?{}:d,p=i.method,l=i.customHeaders,v=i.customBody;return r(void 0,void 0,void 0,(function(){var r,i,d,h,m,w;return o(this,(function(o){switch(o.label){case 0:r=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return n.stringify(e,{arrayFormat:"comma"})}(f),i={headers:t(t({},l),{"X-MICROCMS-API-KEY":a}),body:v,method:p},d="".concat(s,"/").concat(c).concat(u?"/".concat(u):"").concat(r?"?".concat(r):""),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e(d,i)];case 2:if(!(h=o.sent()).ok)throw new Error("fetch API response status: ".concat(h.status));return"DELETE"===p?[2]:[2,h.json()];case 3:if((m=o.sent()).data)throw m.data;if(null===(w=m.response)||void 0===w?void 0:w.data)throw m.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(m)))];case 4:return[2]}}))}))};return{get:function(e){var n=e.endpoint,t=e.contentId,i=e.queries,c=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,contentId:t,queries:c})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var n=e.endpoint,t=e.queries,i=void 0===t?{}:t;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var n=e.endpoint,t=e.contentId,i=e.queries,c=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,contentId:t,queries:c})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var n=e.endpoint,t=e.queries,i=void 0===t?{}:t;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var n=e.endpoint,t=e.contentId,i=e.content,c=e.isDraft,u=void 0!==c&&c;return r(void 0,void 0,void 0,(function(){var e,r,c,a;return o(this,(function(o){return n?(e=u?{status:"draft"}:{},r=t?"PUT":"POST",c={"Content-Type":"application/json"},a=JSON.stringify(i),[2,d({endpoint:n,contentId:t,queries:e,method:r,customHeaders:c,customBody:a})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var n=e.endpoint,t=e.contentId,i=e.content;return r(void 0,void 0,void 0,(function(){var e,r;return o(this,(function(o){return n?("PATCH",e={"Content-Type":"application/json"},r=JSON.stringify(i),[2,d({endpoint:n,contentId:t,method:"PATCH",customHeaders:e,customBody:r})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var n=e.endpoint,t=e.contentId;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?t?("DELETE",[4,d({endpoint:n,contentId:t,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}};export{c as createClient};
|
|
16
16
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWljcm9jbXMtanMtc2RrLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7In0=
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{p(n.next(e))}catch(e){i(e)}}function c(e){try{p(n.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}p((n=n.apply(e,t||[])).next())}))}function n(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var i={exports:{}};!function(e,t){var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}(i,i.exports);var a,c=i.exports,p="undefined"!=typeof Symbol&&Symbol,u=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0},f="Function.prototype.bind called on incompatible ",l=Array.prototype.slice,y=Object.prototype.toString,s="[object Function]",d=function(e){var t=this;if("function"!=typeof t||y.call(t)!==s)throw new TypeError(f+t);for(var r,n=l.call(arguments,1),o=function(){if(this instanceof r){var o=t.apply(this,n.concat(l.call(arguments)));return Object(o)===o?o:this}return t.apply(e,n.concat(l.call(arguments)))},i=Math.max(0,t.length-n.length),a=[],c=0;c<i;c++)a.push("$"+c);if(r=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r},b=Function.prototype.bind||d,h=b.call(Function.call,Object.prototype.hasOwnProperty),m=SyntaxError,g=Function,v=TypeError,j=function(e){try{return g('"use strict"; return ('+e+").constructor;")()}catch(e){}},S=Object.getOwnPropertyDescriptor;if(S)try{S({},"")}catch(e){S=null}var w=function(){throw new v},O=S?function(){try{return w}catch(e){try{return S(arguments,"callee").get}catch(e){return w}}}():w,P="function"==typeof p&&"function"==typeof Symbol&&"symbol"==typeof p("foo")&&"symbol"==typeof Symbol("bar")&&u(),A=Object.getPrototypeOf||function(e){return e.__proto__},E={},x="undefined"==typeof Uint8Array?a:A(Uint8Array),I={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":P?A([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":E,"%AsyncGenerator%":E,"%AsyncGeneratorFunction%":E,"%AsyncIteratorPrototype%":E,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":E,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":P?A(A([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&P?A((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&P?A((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P?A(""[Symbol.iterator]()):a,"%Symbol%":P?Symbol:a,"%SyntaxError%":m,"%ThrowTypeError%":O,"%TypedArray%":x,"%TypeError%":v,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},k=function e(t){var r;if("%AsyncFunction%"===t)r=j("async function () {}");else if("%GeneratorFunction%"===t)r=j("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=j("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=A(o.prototype))}return I[t]=r,r},F={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},R=b,N=h,D=R.call(Function.call,Array.prototype.concat),M=R.call(Function.apply,Array.prototype.splice),U=R.call(Function.call,String.prototype.replace),T=R.call(Function.call,String.prototype.slice),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,q=/\\(\\)?/g,_=function(e){var t=T(e,0,1),r=T(e,-1);if("%"===t&&"%"!==r)throw new m("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new m("invalid intrinsic syntax, expected opening `%`");var n=[];return U(e,C,(function(e,t,r,o){n[n.length]=r?U(o,q,"$1"):t||e})),n},B=function(e,t){var r,n=e;if(N(F,n)&&(n="%"+(r=F[n])[0]+"%"),N(I,n)){var o=I[n];if(o===E&&(o=k(n)),void 0===o&&!t)throw new v("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new m("intrinsic "+e+" does not exist!")},W=function(e,t){if("string"!=typeof e||0===e.length)throw new v("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new v('"allowMissing" argument must be a boolean');var r=_(e),n=r.length>0?r[0]:"",o=B("%"+n+"%",t),i=o.name,a=o.value,c=!1,p=o.alias;p&&(n=p[0],M(r,D([0,1],p)));for(var u=1,f=!0;u<r.length;u+=1){var l=r[u],y=T(l,0,1),s=T(l,-1);if(('"'===y||"'"===y||"`"===y||'"'===s||"'"===s||"`"===s)&&y!==s)throw new m("property names with quotes must have matching quotes");if("constructor"!==l&&f||(c=!0),N(I,i="%"+(n+="."+l)+"%"))a=I[i];else if(null!=a){if(!(l in a)){if(!t)throw new v("base intrinsic for "+e+" exists, but the property is not available.");return}if(S&&u+1>=r.length){var d=S(a,l);a=(f=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[l]}else f=N(a,l),a=a[l];f&&!c&&(I[i]=a)}}return a},L={exports:{}};!function(e){var t=b,r=W,n=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||t.call(o,n),a=r("%Object.getOwnPropertyDescriptor%",!0),c=r("%Object.defineProperty%",!0),p=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var r=i(t,o,arguments);if(a&&c){var n=a(r,"length");n.configurable&&c(r,"length",{value:1+p(0,e.length-(arguments.length-1))})}return r};var u=function(){return i(t,n,arguments)};c?c(e.exports,"apply",{value:u}):e.exports.apply=u}(L);var H=W,G=L.exports,z=G(H("String.prototype.indexOf")),V=o(Object.freeze({__proto__:null,default:{}})),Q="function"==typeof Map&&Map.prototype,J=Object.getOwnPropertyDescriptor&&Q?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$=Q&&J&&"function"==typeof J.get?J.get:null,K=Q&&Map.prototype.forEach,X="function"==typeof Set&&Set.prototype,Y=Object.getOwnPropertyDescriptor&&X?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Z=X&&Y&&"function"==typeof Y.get?Y.get:null,ee=X&&Set.prototype.forEach,te="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,re="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,ne="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,oe=Boolean.prototype.valueOf,ie=Object.prototype.toString,ae=Function.prototype.toString,ce=String.prototype.match,pe="function"==typeof BigInt?BigInt.prototype.valueOf:null,ue=Object.getOwnPropertySymbols,fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,le=Object.prototype.propertyIsEnumerable,ye=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),se=V.custom,de=se&&ve(se)?se:null,be="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag?Symbol.toStringTag:null;function he(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function me(e){return String(e).replace(/"/g,""")}function ge(e){return!("[object Array]"!==we(e)||be&&"object"==typeof e&&be in e)}function ve(e){if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!fe)return!1;try{return fe.call(e),!0}catch(e){}return!1}var je=Object.prototype.hasOwnProperty||function(e){return e in this};function Se(e,t){return je.call(e,t)}function we(e){return ie.call(e)}function Oe(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function Pe(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Pe(e.slice(0,t.maxStringLength),t)+n}return he(e.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,Ae),"single",t)}function Ae(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+t.toString(16).toUpperCase()}function Ee(e){return"Object("+e+")"}function xe(e){return e+" { ? }"}function Ie(e,t,r,n){return e+" ("+t+") {"+(n?ke(r,n):r.join(", "))+"}"}function ke(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+e.join(","+r)+"\n"+t.prev}function Fe(e,t){var r=ge(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=Se(e,o)?t(e[o],e):""}for(var i in e)Se(e,i)&&(r&&String(Number(i))===i&&i<e.length||(/[^\w$]/.test(i)?n.push(t(i,e)+": "+t(e[i],e)):n.push(i+": "+t(e[i],e))));if("function"==typeof ue)for(var a=ue(e),c=0;c<a.length;c++)le.call(e,a[c])&&n.push("["+t(a[c])+"]: "+t(e[a[c]],e));return n}var Re=W,Ne=function(e,t){var r=H(e,!!t);return"function"==typeof r&&z(e,".prototype.")>-1?G(r):r},De=function e(t,r,n,o){var i=r||{};if(Se(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Se(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&i.maxStringLength!==1/0:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!Se(i,"customInspect")||i.customInspect;if("boolean"!=typeof a)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(Se(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return Pe(t,i);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var c=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=c&&c>0&&"object"==typeof t)return ge(t)?"[Array]":"[Object]";var p=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=Array(e.indent+1).join(" ")}return{base:r,prev:Array(t+1).join(r)}}(i,n);if(void 0===o)o=[];else if(Oe(o,t)>=0)return"[Circular]";function u(t,r,a){if(r&&(o=o.slice()).push(r),a){var c={depth:i.depth};return Se(i,"quoteStyle")&&(c.quoteStyle=i.quoteStyle),e(t,c,n+1,o)}return e(t,i,n+1,o)}if("function"==typeof t){var f=function(e){if(e.name)return e.name;var t=ce.call(ae.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),l=Fe(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(ve(t)){var y=fe.call(t);return"object"==typeof t?Ee(y):y}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var s="<"+String(t.nodeName).toLowerCase(),d=t.attributes||[],b=0;b<d.length;b++)s+=" "+d[b].name+"="+he(me(d[b].value),"double",i);return s+=">",t.childNodes&&t.childNodes.length&&(s+="..."),s+="</"+String(t.nodeName).toLowerCase()+">"}if(ge(t)){if(0===t.length)return"[]";var h=Fe(t,u);return p&&!function(e){for(var t=0;t<e.length;t++)if(Oe(e[t],"\n")>=0)return!1;return!0}(h)?"["+ke(h,p)+"]":"[ "+h.join(", ")+" ]"}if(function(e){return!("[object Error]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)){var m=Fe(t,u);return 0===m.length?"["+String(t)+"]":"{ ["+String(t)+"] "+m.join(", ")+" }"}if("object"==typeof t&&a){if(de&&"function"==typeof t[de])return t[de]();if("function"==typeof t.inspect)return t.inspect()}if(function(e){if(!$||!e||"object"!=typeof e)return!1;try{$.call(e);try{Z.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var g=[];return K.call(t,(function(e,r){g.push(u(r,t,!0)+" => "+u(e,t))})),Ie("Map",$.call(t),g,p)}if(function(e){if(!Z||!e||"object"!=typeof e)return!1;try{Z.call(e);try{$.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var v=[];return ee.call(t,(function(e){v.push(u(e,t))})),Ie("Set",Z.call(t),v,p)}if(function(e){if(!te||!e||"object"!=typeof e)return!1;try{te.call(e,te);try{re.call(e,re)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return xe("WeakMap");if(function(e){if(!re||!e||"object"!=typeof e)return!1;try{re.call(e,re);try{te.call(e,te)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return xe("WeakSet");if(function(e){if(!ne||!e||"object"!=typeof e)return!1;try{return ne.call(e),!0}catch(e){}return!1}(t))return xe("WeakRef");if(function(e){return!("[object Number]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(u(Number(t)));if(function(e){if(!e||"object"!=typeof e||!pe)return!1;try{return pe.call(e),!0}catch(e){}return!1}(t))return Ee(u(pe.call(t)));if(function(e){return!("[object Boolean]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(oe.call(t));if(function(e){return!("[object String]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(u(String(t)));if(!function(e){return!("[object Date]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)&&!function(e){return!("[object RegExp]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)){var j=Fe(t,u),S=ye?ye(t)===Object.prototype:t instanceof Object||t.constructor===Object,w=t instanceof Object?"":"null prototype",O=!S&&be&&Object(t)===t&&be in t?we(t).slice(8,-1):w?"Object":"",P=(S||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(O||w?"["+[].concat(O||[],w||[]).join(": ")+"] ":"");return 0===j.length?P+"{}":p?P+"{"+ke(j,p)+"}":P+"{ "+j.join(", ")+" }"}return String(t)},Me=Re("%TypeError%"),Ue=Re("%WeakMap%",!0),Te=Re("%Map%",!0),Ce=Ne("WeakMap.prototype.get",!0),qe=Ne("WeakMap.prototype.set",!0),_e=Ne("WeakMap.prototype.has",!0),Be=Ne("Map.prototype.get",!0),We=Ne("Map.prototype.set",!0),Le=Ne("Map.prototype.has",!0),He=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r},Ge=String.prototype.replace,ze=/%20/g,Ve="RFC3986",Qe={default:Ve,formatters:{RFC1738:function(e){return Ge.call(e,ze,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:Ve},Je=Qe,$e=Object.prototype.hasOwnProperty,Ke=Array.isArray,Xe=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),Ye=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},Ze={arrayToObject:Ye,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],i=o.obj[o.prop],a=Object.keys(i),c=0;c<a.length;++c){var p=a[c],u=i[p];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:i,prop:p}),r.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Ke(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,n,o){if(0===e.length)return e;var i=e;if("symbol"==typeof e?i=Symbol.prototype.toString.call(e):"string"!=typeof e&&(i=String(e)),"iso-8859-1"===r)return escape(i).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var a="",c=0;c<i.length;++c){var p=i.charCodeAt(c);45===p||46===p||95===p||126===p||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===Je.RFC1738&&(40===p||41===p)?a+=i.charAt(c):p<128?a+=Xe[p]:p<2048?a+=Xe[192|p>>6]+Xe[128|63&p]:p<55296||p>=57344?a+=Xe[224|p>>12]+Xe[128|p>>6&63]+Xe[128|63&p]:(c+=1,p=65536+((1023&p)<<10|1023&i.charCodeAt(c)),a+=Xe[240|p>>18]+Xe[128|p>>12&63]+Xe[128|p>>6&63]+Xe[128|63&p])}return a},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(Ke(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(Ke(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!$e.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return Ke(t)&&!Ke(r)&&(o=Ye(t,n)),Ke(t)&&Ke(r)?(r.forEach((function(r,o){if($e.call(t,o)){var i=t[o];i&&"object"==typeof i&&r&&"object"==typeof r?t[o]=e(i,r,n):t.push(r)}else t[o]=r})),t):Object.keys(r).reduce((function(t,o){var i=r[o];return $e.call(t,o)?t[o]=e(t[o],i,n):t[o]=i,t}),o)}},et=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new Me("Side channel does not contain "+De(e))},get:function(n){if(Ue&&n&&("object"==typeof n||"function"==typeof n)){if(e)return Ce(e,n)}else if(Te){if(t)return Be(t,n)}else if(r)return function(e,t){var r=He(e,t);return r&&r.value}(r,n)},has:function(n){if(Ue&&n&&("object"==typeof n||"function"==typeof n)){if(e)return _e(e,n)}else if(Te){if(t)return Le(t,n)}else if(r)return function(e,t){return!!He(e,t)}(r,n);return!1},set:function(n,o){Ue&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new Ue),qe(e,n,o)):Te?(t||(t=new Te),We(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=He(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n},tt=Ze,rt=Qe,nt=Object.prototype.hasOwnProperty,ot={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},it=Array.isArray,at=Array.prototype.push,ct=function(e,t){at.apply(e,it(t)?t:[t])},pt=Date.prototype.toISOString,ut=rt.default,ft={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:tt.encode,encodeValuesOnly:!1,format:ut,formatter:rt.formatters[ut],indices:!1,serializeDate:function(e){return pt.call(e)},skipNulls:!1,strictNullHandling:!1},lt=function e(t,r,n,o,i,a,c,p,u,f,l,y,s,d,b){var h,m=t;if(b.has(t))throw new RangeError("Cyclic object value");if("function"==typeof c?m=c(r,m):m instanceof Date?m=f(m):"comma"===n&&it(m)&&(m=tt.maybeMap(m,(function(e){return e instanceof Date?f(e):e}))),null===m){if(o)return a&&!s?a(r,ft.encoder,d,"key",l):r;m=""}if("string"==typeof(h=m)||"number"==typeof h||"boolean"==typeof h||"symbol"==typeof h||"bigint"==typeof h||tt.isBuffer(m))return a?[y(s?r:a(r,ft.encoder,d,"key",l))+"="+y(a(m,ft.encoder,d,"value",l))]:[y(r)+"="+y(String(m))];var g,v=[];if(void 0===m)return v;if("comma"===n&&it(m))g=[{value:m.length>0?m.join(",")||null:void 0}];else if(it(c))g=c;else{var j=Object.keys(m);g=p?j.sort(p):j}for(var S=0;S<g.length;++S){var w=g[S],O="object"==typeof w&&void 0!==w.value?w.value:m[w];if(!i||null!==O){var P=it(m)?"function"==typeof n?n(r,w):r:r+(u?"."+w:"["+w+"]");b.set(t,!0);var A=et();ct(v,e(O,P,n,o,i,a,c,p,u,f,l,y,s,d,A))}}return v},yt=Ze,st=Object.prototype.hasOwnProperty,dt=Array.isArray,bt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:yt.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},ht=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},mt=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},gt=function(e,t,r,n){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(o),c=a?o.slice(0,a.index):o,p=[];if(c){if(!r.plainObjects&&st.call(Object.prototype,c)&&!r.allowPrototypes)return;p.push(c)}for(var u=0;r.depth>0&&null!==(a=i.exec(o))&&u<r.depth;){if(u+=1,!r.plainObjects&&st.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(a[1])}return a&&p.push("["+o.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:mt(t,r),i=e.length-1;i>=0;--i){var a,c=e[i];if("[]"===c&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var p="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,u=parseInt(p,10);r.parseArrays||""!==p?!isNaN(u)&&c!==p&&String(u)===p&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(a=[])[u]=o:a[p]=o:a={0:o}}o=a}return o}(p,t,r,n)}},vt={formats:Qe,parse:function(e,t){var r=function(e){if(!e)return bt;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?bt.charset:e.charset;return{allowDots:void 0===e.allowDots?bt.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:bt.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:bt.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:bt.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:bt.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:bt.comma,decoder:"function"==typeof e.decoder?e.decoder:bt.decoder,delimiter:"string"==typeof e.delimiter||yt.isRegExp(e.delimiter)?e.delimiter:bt.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:bt.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:bt.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:bt.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:bt.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:bt.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var n="string"==typeof e?function(e,t){var r,n={},o=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=o.split(t.delimiter,i),c=-1,p=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?p="utf-8":"utf8=%26%2310003%3B"===a[r]&&(p="iso-8859-1"),c=r,r=a.length);for(r=0;r<a.length;++r)if(r!==c){var u,f,l=a[r],y=l.indexOf("]="),s=-1===y?l.indexOf("="):y+1;-1===s?(u=t.decoder(l,bt.decoder,p,"key"),f=t.strictNullHandling?null:""):(u=t.decoder(l.slice(0,s),bt.decoder,p,"key"),f=yt.maybeMap(mt(l.slice(s+1),t),(function(e){return t.decoder(e,bt.decoder,p,"value")}))),f&&t.interpretNumericEntities&&"iso-8859-1"===p&&(f=ht(f)),l.indexOf("[]=")>-1&&(f=dt(f)?[f]:f),st.call(n,u)?n[u]=yt.combine(n[u],f):n[u]=f}return n}(e,r):e,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var c=i[a],p=gt(c,n[c],r,"string"==typeof e);o=yt.merge(o,p,r)}return!0===r.allowSparse?o:yt.compact(o)},stringify:function(e,t){var r,n=e,o=function(e){if(!e)return ft;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||ft.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=rt.default;if(void 0!==e.format){if(!nt.call(rt.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=rt.formatters[r],o=ft.filter;return("function"==typeof e.filter||it(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:ft.addQueryPrefix,allowDots:void 0===e.allowDots?ft.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:ft.charsetSentinel,delimiter:void 0===e.delimiter?ft.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:ft.encode,encoder:"function"==typeof e.encoder?e.encoder:ft.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:ft.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:ft.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:ft.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:ft.strictNullHandling}}(t);"function"==typeof o.filter?n=(0,o.filter)("",n):it(o.filter)&&(r=o.filter);var i,a=[];if("object"!=typeof n||null===n)return"";i=t&&t.arrayFormat in ot?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var c=ot[i];r||(r=Object.keys(n)),o.sort&&r.sort(o.sort);for(var p=et(),u=0;u<r.length;++u){var f=r[u];o.skipNulls&&null===n[f]||ct(a,lt(n[f],f,c,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset,p))}var l=a.join(o.delimiter),y=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),l.length>0?y+l:""}},jt=function(e){return"string"==typeof e};e.createClient=function(e){var o=e.serviceDomain,i=e.apiKey;if(!o||!i)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!jt(o)||!jt(i))throw new Error("parameter is not string");var a="https://".concat(o,".").concat("microcms.io","/api/").concat("v1"),p=function(e){var o=e.endpoint,p=e.contentId,u=e.queries,f=void 0===u?{}:u,l=e.method,y=e.customHeaders,s=e.customBody;return r(void 0,void 0,void 0,(function(){var e,r,u,d,b,h;return n(this,(function(n){switch(n.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return vt.stringify(e,{arrayFormat:"comma"})}(f),r={headers:t(t({},y),{"X-MICROCMS-API-KEY":i}),body:s,method:l},u="".concat(a,"/").concat(o).concat(p?"/".concat(p):"").concat(e?"?".concat(e):""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,c(u,r)];case 2:if(!(d=n.sent()).ok)throw new Error("fetch API response status: ".concat(d.status));return[2,d.json()];case 3:if((b=n.sent()).data)throw b.data;if(null===(h=b.response)||void 0===h?void 0:h.data)throw b.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(b)))];case 4:return[2]}}))}))};return{get:function(e){var t=e.endpoint,o=e.contentId,i=e.queries,a=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,contentId:o,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var t=e.endpoint,o=e.queries,i=void 0===o?{}:o;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var t=e.endpoint,o=e.contentId,i=e.queries,a=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,contentId:o,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var t=e.endpoint,o=e.queries,i=void 0===o?{}:o;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var t=e.endpoint,o=e.contentId,i=e.content,a=e.isDraft,c=void 0!==a&&a;return r(void 0,void 0,void 0,(function(){var e,r,a,u;return n(this,(function(n){return t?(e=c?{status:"draft"}:{},r=o?"PUT":"POST",a={"Content-Type":"application/json"},u=JSON.stringify(i),[2,p({endpoint:t,contentId:o,queries:e,method:r,customHeaders:a,customBody:u})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var t=e.endpoint,o=e.contentId,i=e.content;return r(void 0,void 0,void 0,(function(){var e,r;return n(this,(function(n){return t?("PATCH",e={"Content-Type":"application/json"},r=JSON.stringify(i),[2,p({endpoint:t,contentId:o,method:"PATCH",customHeaders:e,customBody:r})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var t=e.endpoint,o=e.contentId;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?o?("DELETE",[4,p({endpoint:t,contentId:o,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{p(n.next(e))}catch(e){i(e)}}function c(e){try{p(n.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}p((n=n.apply(e,t||[])).next())}))}function n(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var i={exports:{}};!function(e,t){var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}(i,i.exports);var a,c=i.exports,p="undefined"!=typeof Symbol&&Symbol,u=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0},f="Function.prototype.bind called on incompatible ",l=Array.prototype.slice,y=Object.prototype.toString,s="[object Function]",d=function(e){var t=this;if("function"!=typeof t||y.call(t)!==s)throw new TypeError(f+t);for(var r,n=l.call(arguments,1),o=function(){if(this instanceof r){var o=t.apply(this,n.concat(l.call(arguments)));return Object(o)===o?o:this}return t.apply(e,n.concat(l.call(arguments)))},i=Math.max(0,t.length-n.length),a=[],c=0;c<i;c++)a.push("$"+c);if(r=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r},b=Function.prototype.bind||d,h=b.call(Function.call,Object.prototype.hasOwnProperty),m=SyntaxError,g=Function,v=TypeError,j=function(e){try{return g('"use strict"; return ('+e+").constructor;")()}catch(e){}},S=Object.getOwnPropertyDescriptor;if(S)try{S({},"")}catch(e){S=null}var w=function(){throw new v},O=S?function(){try{return w}catch(e){try{return S(arguments,"callee").get}catch(e){return w}}}():w,P="function"==typeof p&&"function"==typeof Symbol&&"symbol"==typeof p("foo")&&"symbol"==typeof Symbol("bar")&&u(),A=Object.getPrototypeOf||function(e){return e.__proto__},E={},x="undefined"==typeof Uint8Array?a:A(Uint8Array),I={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":P?A([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":E,"%AsyncGenerator%":E,"%AsyncGeneratorFunction%":E,"%AsyncIteratorPrototype%":E,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":E,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":P?A(A([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&P?A((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&P?A((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P?A(""[Symbol.iterator]()):a,"%Symbol%":P?Symbol:a,"%SyntaxError%":m,"%ThrowTypeError%":O,"%TypedArray%":x,"%TypeError%":v,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},k=function e(t){var r;if("%AsyncFunction%"===t)r=j("async function () {}");else if("%GeneratorFunction%"===t)r=j("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=j("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=A(o.prototype))}return I[t]=r,r},F={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},R=b,N=h,D=R.call(Function.call,Array.prototype.concat),M=R.call(Function.apply,Array.prototype.splice),T=R.call(Function.call,String.prototype.replace),U=R.call(Function.call,String.prototype.slice),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,q=/\\(\\)?/g,_=function(e){var t=U(e,0,1),r=U(e,-1);if("%"===t&&"%"!==r)throw new m("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new m("invalid intrinsic syntax, expected opening `%`");var n=[];return T(e,C,(function(e,t,r,o){n[n.length]=r?T(o,q,"$1"):t||e})),n},B=function(e,t){var r,n=e;if(N(F,n)&&(n="%"+(r=F[n])[0]+"%"),N(I,n)){var o=I[n];if(o===E&&(o=k(n)),void 0===o&&!t)throw new v("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new m("intrinsic "+e+" does not exist!")},L=function(e,t){if("string"!=typeof e||0===e.length)throw new v("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new v('"allowMissing" argument must be a boolean');var r=_(e),n=r.length>0?r[0]:"",o=B("%"+n+"%",t),i=o.name,a=o.value,c=!1,p=o.alias;p&&(n=p[0],M(r,D([0,1],p)));for(var u=1,f=!0;u<r.length;u+=1){var l=r[u],y=U(l,0,1),s=U(l,-1);if(('"'===y||"'"===y||"`"===y||'"'===s||"'"===s||"`"===s)&&y!==s)throw new m("property names with quotes must have matching quotes");if("constructor"!==l&&f||(c=!0),N(I,i="%"+(n+="."+l)+"%"))a=I[i];else if(null!=a){if(!(l in a)){if(!t)throw new v("base intrinsic for "+e+" exists, but the property is not available.");return}if(S&&u+1>=r.length){var d=S(a,l);a=(f=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[l]}else f=N(a,l),a=a[l];f&&!c&&(I[i]=a)}}return a},W={exports:{}};!function(e){var t=b,r=L,n=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||t.call(o,n),a=r("%Object.getOwnPropertyDescriptor%",!0),c=r("%Object.defineProperty%",!0),p=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var r=i(t,o,arguments);if(a&&c){var n=a(r,"length");n.configurable&&c(r,"length",{value:1+p(0,e.length-(arguments.length-1))})}return r};var u=function(){return i(t,n,arguments)};c?c(e.exports,"apply",{value:u}):e.exports.apply=u}(W);var H=L,G=W.exports,z=G(H("String.prototype.indexOf")),V=o(Object.freeze({__proto__:null,default:{}})),Q="function"==typeof Map&&Map.prototype,J=Object.getOwnPropertyDescriptor&&Q?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$=Q&&J&&"function"==typeof J.get?J.get:null,K=Q&&Map.prototype.forEach,X="function"==typeof Set&&Set.prototype,Y=Object.getOwnPropertyDescriptor&&X?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Z=X&&Y&&"function"==typeof Y.get?Y.get:null,ee=X&&Set.prototype.forEach,te="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,re="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,ne="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,oe=Boolean.prototype.valueOf,ie=Object.prototype.toString,ae=Function.prototype.toString,ce=String.prototype.match,pe="function"==typeof BigInt?BigInt.prototype.valueOf:null,ue=Object.getOwnPropertySymbols,fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,le=Object.prototype.propertyIsEnumerable,ye=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),se=V.custom,de=se&&ve(se)?se:null,be="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag?Symbol.toStringTag:null;function he(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function me(e){return String(e).replace(/"/g,""")}function ge(e){return!("[object Array]"!==we(e)||be&&"object"==typeof e&&be in e)}function ve(e){if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!fe)return!1;try{return fe.call(e),!0}catch(e){}return!1}var je=Object.prototype.hasOwnProperty||function(e){return e in this};function Se(e,t){return je.call(e,t)}function we(e){return ie.call(e)}function Oe(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function Pe(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Pe(e.slice(0,t.maxStringLength),t)+n}return he(e.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,Ae),"single",t)}function Ae(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+t.toString(16).toUpperCase()}function Ee(e){return"Object("+e+")"}function xe(e){return e+" { ? }"}function Ie(e,t,r,n){return e+" ("+t+") {"+(n?ke(r,n):r.join(", "))+"}"}function ke(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+e.join(","+r)+"\n"+t.prev}function Fe(e,t){var r=ge(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=Se(e,o)?t(e[o],e):""}for(var i in e)Se(e,i)&&(r&&String(Number(i))===i&&i<e.length||(/[^\w$]/.test(i)?n.push(t(i,e)+": "+t(e[i],e)):n.push(i+": "+t(e[i],e))));if("function"==typeof ue)for(var a=ue(e),c=0;c<a.length;c++)le.call(e,a[c])&&n.push("["+t(a[c])+"]: "+t(e[a[c]],e));return n}var Re=L,Ne=function(e,t){var r=H(e,!!t);return"function"==typeof r&&z(e,".prototype.")>-1?G(r):r},De=function e(t,r,n,o){var i=r||{};if(Se(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Se(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&i.maxStringLength!==1/0:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!Se(i,"customInspect")||i.customInspect;if("boolean"!=typeof a)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(Se(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return Pe(t,i);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var c=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=c&&c>0&&"object"==typeof t)return ge(t)?"[Array]":"[Object]";var p=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=Array(e.indent+1).join(" ")}return{base:r,prev:Array(t+1).join(r)}}(i,n);if(void 0===o)o=[];else if(Oe(o,t)>=0)return"[Circular]";function u(t,r,a){if(r&&(o=o.slice()).push(r),a){var c={depth:i.depth};return Se(i,"quoteStyle")&&(c.quoteStyle=i.quoteStyle),e(t,c,n+1,o)}return e(t,i,n+1,o)}if("function"==typeof t){var f=function(e){if(e.name)return e.name;var t=ce.call(ae.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),l=Fe(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(ve(t)){var y=fe.call(t);return"object"==typeof t?Ee(y):y}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var s="<"+String(t.nodeName).toLowerCase(),d=t.attributes||[],b=0;b<d.length;b++)s+=" "+d[b].name+"="+he(me(d[b].value),"double",i);return s+=">",t.childNodes&&t.childNodes.length&&(s+="..."),s+="</"+String(t.nodeName).toLowerCase()+">"}if(ge(t)){if(0===t.length)return"[]";var h=Fe(t,u);return p&&!function(e){for(var t=0;t<e.length;t++)if(Oe(e[t],"\n")>=0)return!1;return!0}(h)?"["+ke(h,p)+"]":"[ "+h.join(", ")+" ]"}if(function(e){return!("[object Error]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)){var m=Fe(t,u);return 0===m.length?"["+String(t)+"]":"{ ["+String(t)+"] "+m.join(", ")+" }"}if("object"==typeof t&&a){if(de&&"function"==typeof t[de])return t[de]();if("function"==typeof t.inspect)return t.inspect()}if(function(e){if(!$||!e||"object"!=typeof e)return!1;try{$.call(e);try{Z.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var g=[];return K.call(t,(function(e,r){g.push(u(r,t,!0)+" => "+u(e,t))})),Ie("Map",$.call(t),g,p)}if(function(e){if(!Z||!e||"object"!=typeof e)return!1;try{Z.call(e);try{$.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var v=[];return ee.call(t,(function(e){v.push(u(e,t))})),Ie("Set",Z.call(t),v,p)}if(function(e){if(!te||!e||"object"!=typeof e)return!1;try{te.call(e,te);try{re.call(e,re)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return xe("WeakMap");if(function(e){if(!re||!e||"object"!=typeof e)return!1;try{re.call(e,re);try{te.call(e,te)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return xe("WeakSet");if(function(e){if(!ne||!e||"object"!=typeof e)return!1;try{return ne.call(e),!0}catch(e){}return!1}(t))return xe("WeakRef");if(function(e){return!("[object Number]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(u(Number(t)));if(function(e){if(!e||"object"!=typeof e||!pe)return!1;try{return pe.call(e),!0}catch(e){}return!1}(t))return Ee(u(pe.call(t)));if(function(e){return!("[object Boolean]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(oe.call(t));if(function(e){return!("[object String]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(u(String(t)));if(!function(e){return!("[object Date]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)&&!function(e){return!("[object RegExp]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)){var j=Fe(t,u),S=ye?ye(t)===Object.prototype:t instanceof Object||t.constructor===Object,w=t instanceof Object?"":"null prototype",O=!S&&be&&Object(t)===t&&be in t?we(t).slice(8,-1):w?"Object":"",P=(S||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(O||w?"["+[].concat(O||[],w||[]).join(": ")+"] ":"");return 0===j.length?P+"{}":p?P+"{"+ke(j,p)+"}":P+"{ "+j.join(", ")+" }"}return String(t)},Me=Re("%TypeError%"),Te=Re("%WeakMap%",!0),Ue=Re("%Map%",!0),Ce=Ne("WeakMap.prototype.get",!0),qe=Ne("WeakMap.prototype.set",!0),_e=Ne("WeakMap.prototype.has",!0),Be=Ne("Map.prototype.get",!0),Le=Ne("Map.prototype.set",!0),We=Ne("Map.prototype.has",!0),He=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r},Ge=String.prototype.replace,ze=/%20/g,Ve="RFC3986",Qe={default:Ve,formatters:{RFC1738:function(e){return Ge.call(e,ze,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:Ve},Je=Qe,$e=Object.prototype.hasOwnProperty,Ke=Array.isArray,Xe=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),Ye=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},Ze={arrayToObject:Ye,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],i=o.obj[o.prop],a=Object.keys(i),c=0;c<a.length;++c){var p=a[c],u=i[p];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:i,prop:p}),r.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Ke(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,n,o){if(0===e.length)return e;var i=e;if("symbol"==typeof e?i=Symbol.prototype.toString.call(e):"string"!=typeof e&&(i=String(e)),"iso-8859-1"===r)return escape(i).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var a="",c=0;c<i.length;++c){var p=i.charCodeAt(c);45===p||46===p||95===p||126===p||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===Je.RFC1738&&(40===p||41===p)?a+=i.charAt(c):p<128?a+=Xe[p]:p<2048?a+=Xe[192|p>>6]+Xe[128|63&p]:p<55296||p>=57344?a+=Xe[224|p>>12]+Xe[128|p>>6&63]+Xe[128|63&p]:(c+=1,p=65536+((1023&p)<<10|1023&i.charCodeAt(c)),a+=Xe[240|p>>18]+Xe[128|p>>12&63]+Xe[128|p>>6&63]+Xe[128|63&p])}return a},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(Ke(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(Ke(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!$e.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return Ke(t)&&!Ke(r)&&(o=Ye(t,n)),Ke(t)&&Ke(r)?(r.forEach((function(r,o){if($e.call(t,o)){var i=t[o];i&&"object"==typeof i&&r&&"object"==typeof r?t[o]=e(i,r,n):t.push(r)}else t[o]=r})),t):Object.keys(r).reduce((function(t,o){var i=r[o];return $e.call(t,o)?t[o]=e(t[o],i,n):t[o]=i,t}),o)}},et=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new Me("Side channel does not contain "+De(e))},get:function(n){if(Te&&n&&("object"==typeof n||"function"==typeof n)){if(e)return Ce(e,n)}else if(Ue){if(t)return Be(t,n)}else if(r)return function(e,t){var r=He(e,t);return r&&r.value}(r,n)},has:function(n){if(Te&&n&&("object"==typeof n||"function"==typeof n)){if(e)return _e(e,n)}else if(Ue){if(t)return We(t,n)}else if(r)return function(e,t){return!!He(e,t)}(r,n);return!1},set:function(n,o){Te&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new Te),qe(e,n,o)):Ue?(t||(t=new Ue),Le(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=He(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n},tt=Ze,rt=Qe,nt=Object.prototype.hasOwnProperty,ot={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},it=Array.isArray,at=Array.prototype.push,ct=function(e,t){at.apply(e,it(t)?t:[t])},pt=Date.prototype.toISOString,ut=rt.default,ft={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:tt.encode,encodeValuesOnly:!1,format:ut,formatter:rt.formatters[ut],indices:!1,serializeDate:function(e){return pt.call(e)},skipNulls:!1,strictNullHandling:!1},lt=function e(t,r,n,o,i,a,c,p,u,f,l,y,s,d,b){var h,m=t;if(b.has(t))throw new RangeError("Cyclic object value");if("function"==typeof c?m=c(r,m):m instanceof Date?m=f(m):"comma"===n&&it(m)&&(m=tt.maybeMap(m,(function(e){return e instanceof Date?f(e):e}))),null===m){if(o)return a&&!s?a(r,ft.encoder,d,"key",l):r;m=""}if("string"==typeof(h=m)||"number"==typeof h||"boolean"==typeof h||"symbol"==typeof h||"bigint"==typeof h||tt.isBuffer(m))return a?[y(s?r:a(r,ft.encoder,d,"key",l))+"="+y(a(m,ft.encoder,d,"value",l))]:[y(r)+"="+y(String(m))];var g,v=[];if(void 0===m)return v;if("comma"===n&&it(m))g=[{value:m.length>0?m.join(",")||null:void 0}];else if(it(c))g=c;else{var j=Object.keys(m);g=p?j.sort(p):j}for(var S=0;S<g.length;++S){var w=g[S],O="object"==typeof w&&void 0!==w.value?w.value:m[w];if(!i||null!==O){var P=it(m)?"function"==typeof n?n(r,w):r:r+(u?"."+w:"["+w+"]");b.set(t,!0);var A=et();ct(v,e(O,P,n,o,i,a,c,p,u,f,l,y,s,d,A))}}return v},yt=Ze,st=Object.prototype.hasOwnProperty,dt=Array.isArray,bt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:yt.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},ht=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},mt=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},gt=function(e,t,r,n){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(o),c=a?o.slice(0,a.index):o,p=[];if(c){if(!r.plainObjects&&st.call(Object.prototype,c)&&!r.allowPrototypes)return;p.push(c)}for(var u=0;r.depth>0&&null!==(a=i.exec(o))&&u<r.depth;){if(u+=1,!r.plainObjects&&st.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(a[1])}return a&&p.push("["+o.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:mt(t,r),i=e.length-1;i>=0;--i){var a,c=e[i];if("[]"===c&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var p="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,u=parseInt(p,10);r.parseArrays||""!==p?!isNaN(u)&&c!==p&&String(u)===p&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(a=[])[u]=o:a[p]=o:a={0:o}}o=a}return o}(p,t,r,n)}},vt={formats:Qe,parse:function(e,t){var r=function(e){if(!e)return bt;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?bt.charset:e.charset;return{allowDots:void 0===e.allowDots?bt.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:bt.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:bt.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:bt.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:bt.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:bt.comma,decoder:"function"==typeof e.decoder?e.decoder:bt.decoder,delimiter:"string"==typeof e.delimiter||yt.isRegExp(e.delimiter)?e.delimiter:bt.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:bt.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:bt.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:bt.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:bt.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:bt.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var n="string"==typeof e?function(e,t){var r,n={},o=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=o.split(t.delimiter,i),c=-1,p=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?p="utf-8":"utf8=%26%2310003%3B"===a[r]&&(p="iso-8859-1"),c=r,r=a.length);for(r=0;r<a.length;++r)if(r!==c){var u,f,l=a[r],y=l.indexOf("]="),s=-1===y?l.indexOf("="):y+1;-1===s?(u=t.decoder(l,bt.decoder,p,"key"),f=t.strictNullHandling?null:""):(u=t.decoder(l.slice(0,s),bt.decoder,p,"key"),f=yt.maybeMap(mt(l.slice(s+1),t),(function(e){return t.decoder(e,bt.decoder,p,"value")}))),f&&t.interpretNumericEntities&&"iso-8859-1"===p&&(f=ht(f)),l.indexOf("[]=")>-1&&(f=dt(f)?[f]:f),st.call(n,u)?n[u]=yt.combine(n[u],f):n[u]=f}return n}(e,r):e,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var c=i[a],p=gt(c,n[c],r,"string"==typeof e);o=yt.merge(o,p,r)}return!0===r.allowSparse?o:yt.compact(o)},stringify:function(e,t){var r,n=e,o=function(e){if(!e)return ft;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||ft.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=rt.default;if(void 0!==e.format){if(!nt.call(rt.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=rt.formatters[r],o=ft.filter;return("function"==typeof e.filter||it(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:ft.addQueryPrefix,allowDots:void 0===e.allowDots?ft.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:ft.charsetSentinel,delimiter:void 0===e.delimiter?ft.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:ft.encode,encoder:"function"==typeof e.encoder?e.encoder:ft.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:ft.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:ft.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:ft.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:ft.strictNullHandling}}(t);"function"==typeof o.filter?n=(0,o.filter)("",n):it(o.filter)&&(r=o.filter);var i,a=[];if("object"!=typeof n||null===n)return"";i=t&&t.arrayFormat in ot?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var c=ot[i];r||(r=Object.keys(n)),o.sort&&r.sort(o.sort);for(var p=et(),u=0;u<r.length;++u){var f=r[u];o.skipNulls&&null===n[f]||ct(a,lt(n[f],f,c,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset,p))}var l=a.join(o.delimiter),y=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),l.length>0?y+l:""}},jt=function(e){return"string"==typeof e};e.createClient=function(e){var o=e.serviceDomain,i=e.apiKey;if(!o||!i)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!jt(o)||!jt(i))throw new Error("parameter is not string");var a="https://".concat(o,".").concat("microcms.io","/api/").concat("v1"),p=function(e){var o=e.endpoint,p=e.contentId,u=e.queries,f=void 0===u?{}:u,l=e.method,y=e.customHeaders,s=e.customBody;return r(void 0,void 0,void 0,(function(){var e,r,u,d,b,h;return n(this,(function(n){switch(n.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return vt.stringify(e,{arrayFormat:"comma"})}(f),r={headers:t(t({},y),{"X-MICROCMS-API-KEY":i}),body:s,method:l},u="".concat(a,"/").concat(o).concat(p?"/".concat(p):"").concat(e?"?".concat(e):""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,c(u,r)];case 2:if(!(d=n.sent()).ok)throw new Error("fetch API response status: ".concat(d.status));return"DELETE"===l?[2]:[2,d.json()];case 3:if((b=n.sent()).data)throw b.data;if(null===(h=b.response)||void 0===h?void 0:h.data)throw b.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(b)))];case 4:return[2]}}))}))};return{get:function(e){var t=e.endpoint,o=e.contentId,i=e.queries,a=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,contentId:o,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var t=e.endpoint,o=e.queries,i=void 0===o?{}:o;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var t=e.endpoint,o=e.contentId,i=e.queries,a=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,contentId:o,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var t=e.endpoint,o=e.queries,i=void 0===o?{}:o;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var t=e.endpoint,o=e.contentId,i=e.content,a=e.isDraft,c=void 0!==a&&a;return r(void 0,void 0,void 0,(function(){var e,r,a,u;return n(this,(function(n){return t?(e=c?{status:"draft"}:{},r=o?"PUT":"POST",a={"Content-Type":"application/json"},u=JSON.stringify(i),[2,p({endpoint:t,contentId:o,queries:e,method:r,customHeaders:a,customBody:u})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var t=e.endpoint,o=e.contentId,i=e.content;return r(void 0,void 0,void 0,(function(){var e,r;return n(this,(function(n){return t?("PATCH",e={"Content-Type":"application/json"},r=JSON.stringify(i),[2,p({endpoint:t,contentId:o,method:"PATCH",customHeaders:e,customBody:r})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var t=e.endpoint,o=e.contentId;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?o?("DELETE",[4,p({endpoint:t,contentId:o,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|