microcms-js-sdk 1.2.0 → 2.1.0

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.
package/README.md CHANGED
@@ -34,7 +34,6 @@ import { createClient } from 'microcms-js-sdk'; //ES6
34
34
  const client = createClient({
35
35
  serviceDomain: "YOUR_DOMAIN", // YOUR_DOMAIN is the XXXX part of XXXX.microcms.io
36
36
  apiKey: "YOUR_API_KEY",
37
- globalDraftKey: "YOUR_GLOBAL_DRAFT_KEY", // If need
38
37
  });
39
38
  ```
40
39
 
@@ -48,19 +47,17 @@ const { createClient } = microcms;
48
47
  const client = createClient({
49
48
  serviceDomain: "YOUR_DOMAIN", // YOUR_DOMAIN is the XXXX part of XXXX.microcms.io
50
49
  apiKey: "YOUR_API_KEY",
51
- globalDraftKey: "YOUR_GLOBAL_DRAFT_KEY", // If need
52
50
  });
53
51
  </script>
54
52
  ```
55
53
 
56
- After, How to use it below.
54
+ After, How to use `get` it below.
57
55
 
58
56
  ```javascript
59
57
  client
60
58
  .get({
61
59
  endpoint: 'endpoint',
62
60
  queries: { limit: 20, filters: 'createdAt[greater_than]2021' },
63
- useGlobalDraftKey: false, // This is an option if your have set the globalDraftKey. Default value true.
64
61
  })
65
62
  .then((res) => console.log(res))
66
63
  .catch((err) => console.log(err));
@@ -75,10 +72,80 @@ client
75
72
  .catch((err) => console.log(err));
76
73
  ```
77
74
 
78
- If you are using TypeScript, specify the response type.
75
+ And, Api corresponding to each content are also available. example.
76
+
77
+ ```javascript
78
+ // Get list API data
79
+ client
80
+ .getList({
81
+ endpoint: 'endpoint',
82
+ })
83
+ .then((res) => console.log(res))
84
+ .catch((err) => console.log(err));
85
+
86
+ // Get list API detail data
87
+ client
88
+ .getListDetail({
89
+ endpoint: 'endpoint',
90
+ contentId: 'contentId',
91
+ })
92
+ .then((res) => console.log(res))
93
+ .catch((err) => console.log(err));
94
+
95
+ // Get object API data
96
+ client
97
+ .getObject({
98
+ endpoint: 'endpoint',
99
+ })
100
+ .then((res) => console.log(res))
101
+ .catch((err) => console.log(err));
102
+ ```
103
+
104
+ ### TypeScript
105
+
106
+ If you are using TypeScript, use `getList`, `getListDetail`, `getObject`. This internally contains a common type of content.
79
107
 
80
108
  ```typescript
81
- client.get<ResponseType>({endpoint: 'endpoint'})
109
+ // Type definition
110
+ type Content = {
111
+ text: string,
112
+ }
113
+
114
+ /**
115
+ * // getList response type
116
+ * {
117
+ * contents: Content; // This is Content type
118
+ * totalCount: number;
119
+ * limit: number;
120
+ * offset: number;
121
+ * }
122
+ */
123
+ client.getList<Content>({ //other })
124
+
125
+ /**
126
+ * // getListDetail response type
127
+ * {
128
+ * id: string;
129
+ * createdAt: string;
130
+ * updatedAt: string;
131
+ * publishedAt?: string;
132
+ * revisedAt?: string;
133
+ * text: string; // This is Content type.
134
+ * }
135
+ */
136
+ client.getListDetail<Content>({ //other })
137
+
138
+ /**
139
+ * // getObject response type
140
+ * {
141
+ * createdAt: string;
142
+ * updatedAt: string;
143
+ * publishedAt?: string;
144
+ * revisedAt?: string;
145
+ * text: string; // This is Content type.
146
+ * }
147
+ */
148
+ client.getObject<Content>({ //other })
82
149
  ```
83
150
 
84
151
  # LICENSE
@@ -1,8 +1,10 @@
1
- import { ClientParams, GetRequest } from './types';
1
+ import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent } from './types';
2
2
  /**
3
3
  * Initialize SDK Client
4
4
  */
5
- declare const createClient: ({ serviceDomain, apiKey, globalDraftKey }: ClientParams) => {
6
- get: <T>({ endpoint, contentId, queries, useGlobalDraftKey }: GetRequest) => Promise<T>;
5
+ export declare const createClient: ({ serviceDomain, apiKey }: MicroCMSClient) => {
6
+ get: <T = any>({ endpoint, contentId, queries, }: GetRequest) => Promise<T>;
7
+ getList: <T_1 = any>({ endpoint, queries, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
8
+ getListDetail: <T_2 = any>({ endpoint, contentId, queries, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
9
+ getObject: <T_3 = any>({ endpoint, queries, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
7
10
  };
8
- export default createClient;
@@ -1,2 +1,2 @@
1
- import createClient from './createClient';
2
- export { createClient };
1
+ export { createClient } from './createClient';
2
+ export * from './types';
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node-fetch"),r=require("qs");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),o=t(r);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node-fetch"),r=require("qs");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),i=t(r);
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -13,5 +13,5 @@ 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
15
  ***************************************************************************** */
16
- function i(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,u)}s((n=n.apply(e,r||[])).next())}))}function a(e,r){var t,n,o,i,a={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(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=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 u=function(e){return null!==e&&"string"==typeof e};exports.createClient=function(e){var r=e.serviceDomain,t=e.apiKey,s=e.globalDraftKey;if(!r||!t)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!u(r)||!u(t))throw new Error("parameter is not string");var c="https://"+r+".microcms.io/api/v1",l=function(e){var r=e.endpoint,u=e.contentId,l=e.queries,f=void 0===l?{}:l,d=e.useGlobalDraftKey,p=void 0===d||d;return i(void 0,void 0,void 0,(function(){var e,i,l,d,v,h;return a(this,(function(a){switch(a.label){case 0:e=function(e){if(null===(r=e)||"object"!=typeof r)throw new Error("queries is not object");var r;return o.default.stringify(e)}(f),i={headers:{"X-API-KEY":t}},s&&p&&Object.assign(i.headers,{"X-GLOBAL-DRAFT-KEY":s}),l=c+"/"+r+(u?"/"+u:"")+(e?"?"+e:""),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.default(l,i)];case 2:if(!(d=a.sent()).ok)throw new Error("fetch API response status: "+d.status);return[2,d.json()];case 3:if((v=a.sent()).data)throw v.data;if(null===(h=v.response)||void 0===h?void 0:h.data)throw v.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: "+v))];case 4:return[2]}}))}))};return{get:function(e){var r=e.endpoint,t=e.contentId,n=e.queries,o=void 0===n?{}:n,u=e.useGlobalDraftKey;return i(void 0,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return r?[4,l({endpoint:r,contentId:t,queries:o,useGlobalDraftKey:u})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))}}};
16
+ function o(e,r,t,n){return new(t||(t=Promise))((function(i,o){function u(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var r;e.done?i(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(u,a)}s((n=n.apply(e,r||[])).next())}))}function u(e,r){var t,n,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;u;)try{if(t=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,n=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=r.call(e,u)}catch(e){o=[6,e],n=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var a=function(e){return null!==e&&"string"==typeof e};exports.createClient=function(e){var r=e.serviceDomain,t=e.apiKey;if(!r||!t)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!a(r)||!a(t))throw new Error("parameter is not string");var s="https://"+r+".microcms.io/api/v1",c=function(e){var r=e.endpoint,a=e.contentId,c=e.queries,d=void 0===c?{}:c;return o(void 0,void 0,void 0,(function(){var e,o,c,l,f,p;return u(this,(function(u){switch(u.label){case 0:e=function(e){if(null===(r=e)||"object"!=typeof r)throw new Error("queries is not object");var r;return i.default.stringify(e,{arrayFormat:"comma"})}(d),o={headers:{"X-MICROCMS-API-KEY":t}},c=s+"/"+r+(a?"/"+a:"")+(e?"?"+e:""),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,n.default(c,o)];case 2:if(!(l=u.sent()).ok)throw new Error("fetch API response status: "+l.status);return[2,l.json()];case 3:if((f=u.sent()).data)throw f.data;if(null===(p=f.response)||void 0===p?void 0:p.data)throw f.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: "+f))];case 4:return[2]}}))}))};return{get:function(e){var r=e.endpoint,t=e.contentId,n=e.queries,i=void 0===n?{}:n;return o(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,contentId:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var r=e.endpoint,t=e.queries,n=void 0===t?{}:t;return o(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,queries:n})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var r=e.endpoint,t=e.contentId,n=e.queries,i=void 0===n?{}:n;return o(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,contentId:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var r=e.endpoint,t=e.queries,n=void 0===t?{}:t;return o(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,queries:n})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))}}};
17
17
  //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWljcm9jbXMtanMtc2RrLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OyJ9
@@ -1,30 +1,89 @@
1
- export interface ClientParams {
1
+ /**
2
+ * microCMS createClient params
3
+ */
4
+ export interface MicroCMSClient {
2
5
  serviceDomain: string;
3
6
  apiKey: string;
4
- globalDraftKey?: string;
5
- }
6
- export interface MakeRequest {
7
- endpoint: string;
8
- contentId?: string;
9
- queries?: QueriesType;
10
- useGlobalDraftKey?: boolean;
11
- }
12
- export interface GetRequest {
13
- endpoint: string;
14
- contentId?: string;
15
- queries?: QueriesType;
16
- useGlobalDraftKey?: boolean;
17
7
  }
18
8
  declare type depthNumber = 1 | 2 | 3;
19
- export interface QueriesType {
9
+ /**
10
+ * microCMS queries
11
+ * https://document.microcms.io/content-api/get-list-contents#h9ce528688c
12
+ * https://document.microcms.io/content-api/get-content#h9ce528688c
13
+ */
14
+ export interface MicroCMSQueries {
20
15
  draftKey?: string;
21
16
  limit?: number;
22
17
  offset?: number;
23
18
  orders?: string;
24
- fields?: string;
19
+ fields?: string | string[];
25
20
  q?: string;
26
21
  depth?: depthNumber;
27
- ids?: string;
22
+ ids?: string | string[];
28
23
  filters?: string;
29
24
  }
25
+ /**
26
+ * microCMS contentId
27
+ * https://document.microcms.io/manual/content-id-setting
28
+ */
29
+ export interface MicroCMSContentId {
30
+ id: string;
31
+ }
32
+ /**
33
+ * microCMS content common date
34
+ */
35
+ export interface MicroCMSDate {
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ publishedAt?: string;
39
+ revisedAt?: string;
40
+ }
41
+ /**
42
+ * microCMS image
43
+ */
44
+ export interface MicroCMSImage {
45
+ url: string;
46
+ width?: number;
47
+ height?: number;
48
+ }
49
+ /**
50
+ * microCMS list api Response
51
+ */
52
+ export interface MicroCMSListResponse<T> {
53
+ contents: (T & MicroCMSListContent)[];
54
+ totalCount: number;
55
+ limit: number;
56
+ offset: number;
57
+ }
58
+ /**
59
+ * microCMS list content common types
60
+ */
61
+ export declare type MicroCMSListContent = MicroCMSContentId & MicroCMSDate;
62
+ /**
63
+ * microCMS object content common types
64
+ */
65
+ export declare type MicroCMSObjectContent = MicroCMSDate;
66
+ export interface MakeRequest {
67
+ endpoint: string;
68
+ contentId?: string;
69
+ queries?: MicroCMSQueries;
70
+ }
71
+ export interface GetRequest {
72
+ endpoint: string;
73
+ contentId?: string;
74
+ queries?: MicroCMSQueries;
75
+ }
76
+ export interface GetListDetailRequest {
77
+ endpoint: string;
78
+ contentId: string;
79
+ queries?: MicroCMSQueries;
80
+ }
81
+ export interface GetListRequest {
82
+ endpoint: string;
83
+ queries?: MicroCMSQueries;
84
+ }
85
+ export interface GetObjectRequest {
86
+ endpoint: string;
87
+ queries?: MicroCMSQueries;
88
+ }
30
89
  export {};
@@ -1,2 +1,2 @@
1
- import { QueriesType } from '../types';
2
- export declare const parseQuery: (queries: QueriesType) => string;
1
+ import { MicroCMSQueries } from '../types';
2
+ export declare const parseQuery: (queries: MicroCMSQueries) => string;
@@ -1,8 +1,10 @@
1
- import { ClientParams, GetRequest } from './types';
1
+ import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent } from './types';
2
2
  /**
3
3
  * Initialize SDK Client
4
4
  */
5
- declare const createClient: ({ serviceDomain, apiKey, globalDraftKey }: ClientParams) => {
6
- get: <T>({ endpoint, contentId, queries, useGlobalDraftKey }: GetRequest) => Promise<T>;
5
+ export declare const createClient: ({ serviceDomain, apiKey }: MicroCMSClient) => {
6
+ get: <T = any>({ endpoint, contentId, queries, }: GetRequest) => Promise<T>;
7
+ getList: <T_1 = any>({ endpoint, queries, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
8
+ getListDetail: <T_2 = any>({ endpoint, contentId, queries, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
9
+ getObject: <T_3 = any>({ endpoint, queries, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
7
10
  };
8
- export default createClient;
@@ -1,2 +1,2 @@
1
- import createClient from './createClient';
2
- export { createClient };
1
+ export { createClient } from './createClient';
2
+ export * from './types';
@@ -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
- ***************************************************************************** */function t(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,s)}u((n=n.apply(e,r||[])).next())}))}function n(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var o=function(e){return null!==e&&"string"==typeof e},i=function(i){var a=i.serviceDomain,s=i.apiKey,u=i.globalDraftKey;if(!a||!s)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!o(a)||!o(s))throw new Error("parameter is not string");var c="https://"+a+".microcms.io/api/v1",l=function(o){var i=o.endpoint,a=o.contentId,l=o.queries,f=void 0===l?{}:l,p=o.useGlobalDraftKey,d=void 0===p||p;return t(void 0,void 0,void 0,(function(){var t,o,l,p,h,v;return n(this,(function(n){switch(n.label){case 0:t=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return r.stringify(e)}(f),o={headers:{"X-API-KEY":s}},u&&d&&Object.assign(o.headers,{"X-GLOBAL-DRAFT-KEY":u}),l=c+"/"+i+(a?"/"+a:"")+(t?"?"+t:""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e(l,o)];case 2:if(!(p=n.sent()).ok)throw new Error("fetch API response status: "+p.status);return[2,p.json()];case 3:if((h=n.sent()).data)throw h.data;if(null===(v=h.response)||void 0===v?void 0:v.data)throw h.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: "+h))];case 4:return[2]}}))}))};return{get:function(e){var r=e.endpoint,o=e.contentId,i=e.queries,a=void 0===i?{}:i,s=e.useGlobalDraftKey;return t(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return r?[4,l({endpoint:r,contentId:o,queries:a,useGlobalDraftKey:s})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))}}};export{i as createClient};
15
+ ***************************************************************************** */function n(e,r,n,t){return new(n||(n=Promise))((function(i,o){function u(e){try{a(t.next(e))}catch(e){o(e)}}function s(e){try{a(t.throw(e))}catch(e){o(e)}}function a(e){var r;e.done?i(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(u,s)}a((t=t.apply(e,r||[])).next())}))}function t(e,r){var n,t,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,t&&(i=2&o[0]?t.return:o[0]?t.throw||((i=t.return)&&i.call(t),0):t.next)&&!(i=i.call(t,o[1])).done)return i;switch(t=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,t=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=r.call(e,u)}catch(e){o=[6,e],t=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var i=function(e){return null!==e&&"string"==typeof e},o=function(o){var u=o.serviceDomain,s=o.apiKey;if(!u||!s)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!i(u)||!i(s))throw new Error("parameter is not string");var a="https://"+u+".microcms.io/api/v1",c=function(i){var o=i.endpoint,u=i.contentId,c=i.queries,d=void 0===c?{}:c;return n(void 0,void 0,void 0,(function(){var n,i,c,f,l,p;return t(this,(function(t){switch(t.label){case 0:n=function(e){if(null===(n=e)||"object"!=typeof n)throw new Error("queries is not object");var n;return r.stringify(e,{arrayFormat:"comma"})}(d),i={headers:{"X-MICROCMS-API-KEY":s}},c=a+"/"+o+(u?"/"+u:"")+(n?"?"+n:""),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,e(c,i)];case 2:if(!(f=t.sent()).ok)throw new Error("fetch API response status: "+f.status);return[2,f.json()];case 3:if((l=t.sent()).data)throw l.data;if(null===(p=l.response)||void 0===p?void 0:p.data)throw l.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: "+l))];case 4:return[2]}}))}))};return{get:function(e){var r=e.endpoint,i=e.contentId,o=e.queries,u=void 0===o?{}:o;return n(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,contentId:i,queries:u})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var r=e.endpoint,i=e.queries,o=void 0===i?{}:i;return n(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var r=e.endpoint,i=e.contentId,o=e.queries,u=void 0===o?{}:o;return n(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,contentId:i,queries:u})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var r=e.endpoint,i=e.queries,o=void 0===i?{}:i;return n(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return r?[4,c({endpoint:r,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))}}};export{o as createClient};
16
16
  //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWljcm9jbXMtanMtc2RrLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7In0=
@@ -1,30 +1,89 @@
1
- export interface ClientParams {
1
+ /**
2
+ * microCMS createClient params
3
+ */
4
+ export interface MicroCMSClient {
2
5
  serviceDomain: string;
3
6
  apiKey: string;
4
- globalDraftKey?: string;
5
- }
6
- export interface MakeRequest {
7
- endpoint: string;
8
- contentId?: string;
9
- queries?: QueriesType;
10
- useGlobalDraftKey?: boolean;
11
- }
12
- export interface GetRequest {
13
- endpoint: string;
14
- contentId?: string;
15
- queries?: QueriesType;
16
- useGlobalDraftKey?: boolean;
17
7
  }
18
8
  declare type depthNumber = 1 | 2 | 3;
19
- export interface QueriesType {
9
+ /**
10
+ * microCMS queries
11
+ * https://document.microcms.io/content-api/get-list-contents#h9ce528688c
12
+ * https://document.microcms.io/content-api/get-content#h9ce528688c
13
+ */
14
+ export interface MicroCMSQueries {
20
15
  draftKey?: string;
21
16
  limit?: number;
22
17
  offset?: number;
23
18
  orders?: string;
24
- fields?: string;
19
+ fields?: string | string[];
25
20
  q?: string;
26
21
  depth?: depthNumber;
27
- ids?: string;
22
+ ids?: string | string[];
28
23
  filters?: string;
29
24
  }
25
+ /**
26
+ * microCMS contentId
27
+ * https://document.microcms.io/manual/content-id-setting
28
+ */
29
+ export interface MicroCMSContentId {
30
+ id: string;
31
+ }
32
+ /**
33
+ * microCMS content common date
34
+ */
35
+ export interface MicroCMSDate {
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ publishedAt?: string;
39
+ revisedAt?: string;
40
+ }
41
+ /**
42
+ * microCMS image
43
+ */
44
+ export interface MicroCMSImage {
45
+ url: string;
46
+ width?: number;
47
+ height?: number;
48
+ }
49
+ /**
50
+ * microCMS list api Response
51
+ */
52
+ export interface MicroCMSListResponse<T> {
53
+ contents: (T & MicroCMSListContent)[];
54
+ totalCount: number;
55
+ limit: number;
56
+ offset: number;
57
+ }
58
+ /**
59
+ * microCMS list content common types
60
+ */
61
+ export declare type MicroCMSListContent = MicroCMSContentId & MicroCMSDate;
62
+ /**
63
+ * microCMS object content common types
64
+ */
65
+ export declare type MicroCMSObjectContent = MicroCMSDate;
66
+ export interface MakeRequest {
67
+ endpoint: string;
68
+ contentId?: string;
69
+ queries?: MicroCMSQueries;
70
+ }
71
+ export interface GetRequest {
72
+ endpoint: string;
73
+ contentId?: string;
74
+ queries?: MicroCMSQueries;
75
+ }
76
+ export interface GetListDetailRequest {
77
+ endpoint: string;
78
+ contentId: string;
79
+ queries?: MicroCMSQueries;
80
+ }
81
+ export interface GetListRequest {
82
+ endpoint: string;
83
+ queries?: MicroCMSQueries;
84
+ }
85
+ export interface GetObjectRequest {
86
+ endpoint: string;
87
+ queries?: MicroCMSQueries;
88
+ }
30
89
  export {};
@@ -1,2 +1,2 @@
1
- import { QueriesType } from '../types';
2
- export declare const parseQuery: (queries: QueriesType) => string;
1
+ import { MicroCMSQueries } from '../types';
2
+ export declare const parseQuery: (queries: MicroCMSQueries) => string;
@@ -1,8 +1,10 @@
1
- import { ClientParams, GetRequest } from './types';
1
+ import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent } from './types';
2
2
  /**
3
3
  * Initialize SDK Client
4
4
  */
5
- declare const createClient: ({ serviceDomain, apiKey, globalDraftKey }: ClientParams) => {
6
- get: <T>({ endpoint, contentId, queries, useGlobalDraftKey }: GetRequest) => Promise<T>;
5
+ export declare const createClient: ({ serviceDomain, apiKey }: MicroCMSClient) => {
6
+ get: <T = any>({ endpoint, contentId, queries, }: GetRequest) => Promise<T>;
7
+ getList: <T_1 = any>({ endpoint, queries, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
8
+ getListDetail: <T_2 = any>({ endpoint, contentId, queries, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
9
+ getObject: <T_3 = any>({ endpoint, queries, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
7
10
  };
8
- export default createClient;
@@ -1,2 +1,2 @@
1
- import createClient from './createClient';
2
- export { createClient };
1
+ export { createClient } from './createClient';
2
+ export * from './types';
@@ -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
- ***************************************************************************** */function t(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{p(o.next(e))}catch(e){i(e)}}function c(e){try{p(o.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}p((o=o.apply(e,t||[])).next())}))}function r(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{r=n=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 o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})})),t}var n={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}(n,n.exports);var i,a=n.exports,c="undefined"!=typeof Symbol&&Symbol,p=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 o=Object.getOwnPropertySymbols(e);if(1!==o.length||o[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0},u="Function.prototype.bind called on incompatible ",f=Array.prototype.slice,l=Object.prototype.toString,y="[object Function]",s=function(e){var t=this;if("function"!=typeof t||l.call(t)!==y)throw new TypeError(u+t);for(var r,o=f.call(arguments,1),n=function(){if(this instanceof r){var n=t.apply(this,o.concat(f.call(arguments)));return Object(n)===n?n:this}return t.apply(e,o.concat(f.call(arguments)))},i=Math.max(0,t.length-o.length),a=[],c=0;c<i;c++)a.push("$"+c);if(r=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r},d=Function.prototype.bind||s,b=d.call(Function.call,Object.prototype.hasOwnProperty),h=SyntaxError,g=Function,m=TypeError,v=function(e){try{return g('"use strict"; return ('+e+").constructor;")()}catch(e){}},j=Object.getOwnPropertyDescriptor;if(j)try{j({},"")}catch(e){j=null}var S=function(){throw new m},w=j?function(){try{return S}catch(e){try{return j(arguments,"callee").get}catch(e){return S}}}():S,O="function"==typeof c&&"function"==typeof Symbol&&"symbol"==typeof c("foo")&&"symbol"==typeof Symbol("bar")&&p(),A=Object.getPrototypeOf||function(e){return e.__proto__},P={},x="undefined"==typeof Uint8Array?i:A(Uint8Array),E={"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":O?A([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":P,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":O?A(A([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&O?A((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&O?A((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":O?A(""[Symbol.iterator]()):i,"%Symbol%":O?Symbol:i,"%SyntaxError%":h,"%ThrowTypeError%":w,"%TypedArray%":x,"%TypeError%":m,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet},k=function e(t){var r;if("%AsyncFunction%"===t)r=v("async function () {}");else if("%GeneratorFunction%"===t)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=v("async function* () {}");else if("%AsyncGenerator%"===t){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&(r=A(n.prototype))}return E[t]=r,r},I={"%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"]},F=d,R=b,N=F.call(Function.call,Array.prototype.concat),D=F.call(Function.apply,Array.prototype.splice),M=F.call(Function.call,String.prototype.replace),U=F.call(Function.call,String.prototype.slice),_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,C=/\\(\\)?/g,T=function(e){var t=U(e,0,1),r=U(e,-1);if("%"===t&&"%"!==r)throw new h("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new h("invalid intrinsic syntax, expected opening `%`");var o=[];return M(e,_,(function(e,t,r,n){o[o.length]=r?M(n,C,"$1"):t||e})),o},W=function(e,t){var r,o=e;if(R(I,o)&&(o="%"+(r=I[o])[0]+"%"),R(E,o)){var n=E[o];if(n===P&&(n=k(o)),void 0===n&&!t)throw new m("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:o,value:n}}throw new h("intrinsic "+e+" does not exist!")},B=function(e,t){if("string"!=typeof e||0===e.length)throw new m("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new m('"allowMissing" argument must be a boolean');var r=T(e),o=r.length>0?r[0]:"",n=W("%"+o+"%",t),i=n.name,a=n.value,c=!1,p=n.alias;p&&(o=p[0],D(r,N([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 h("property names with quotes must have matching quotes");if("constructor"!==l&&f||(c=!0),R(E,i="%"+(o+="."+l)+"%"))a=E[i];else if(null!=a){if(!(l in a)){if(!t)throw new m("base intrinsic for "+e+" exists, but the property is not available.");return}if(j&&u+1>=r.length){var d=j(a,l);a=(f=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[l]}else f=R(a,l),a=a[l];f&&!c&&(E[i]=a)}}return a},L={exports:{}};!function(e){var t=d,r=B,o=r("%Function.prototype.apply%"),n=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||t.call(n,o),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,n,arguments);if(a&&c){var o=a(r,"length");o.configurable&&c(r,"length",{value:1+p(0,e.length-(arguments.length-1))})}return r};var u=function(){return i(t,o,arguments)};c?c(e.exports,"apply",{value:u}):e.exports.apply=u}(L);var G=B,q=L.exports,H=q(G("String.prototype.indexOf")),z=o(Object.freeze({__proto__:null,default:{}})),V="function"==typeof Map&&Map.prototype,Q=Object.getOwnPropertyDescriptor&&V?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,K=V&&Q&&"function"==typeof Q.get?Q.get:null,J=V&&Map.prototype.forEach,$="function"==typeof Set&&Set.prototype,X=Object.getOwnPropertyDescriptor&&$?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Y=$&&X&&"function"==typeof X.get?X.get:null,Z=$&&Set.prototype.forEach,ee="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,te="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,re="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,oe=Boolean.prototype.valueOf,ne=Object.prototype.toString,ie=Function.prototype.toString,ae=String.prototype.match,ce="function"==typeof BigInt?BigInt.prototype.valueOf:null,pe=Object.getOwnPropertySymbols,ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,fe=Object.prototype.propertyIsEnumerable,le=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),ye=z.custom,se=ye&&me(ye)?ye:null,de="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag?Symbol.toStringTag:null;function be(e,t,r){var o="double"===(r.quoteStyle||t)?'"':"'";return o+e+o}function he(e){return String(e).replace(/"/g,"&quot;")}function ge(e){return!("[object Array]"!==Se(e)||de&&"object"==typeof e&&de in e)}function me(e){if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!ue)return!1;try{return ue.call(e),!0}catch(e){}return!1}var ve=Object.prototype.hasOwnProperty||function(e){return e in this};function je(e,t){return ve.call(e,t)}function Se(e){return ne.call(e)}function we(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}function Oe(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,o="... "+r+" more character"+(r>1?"s":"");return Oe(e.slice(0,t.maxStringLength),t)+o}return be(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 Pe(e){return"Object("+e+")"}function xe(e){return e+" { ? }"}function Ee(e,t,r,o){return e+" ("+t+") {"+(o?ke(r,o):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 Ie(e,t){var r=ge(e),o=[];if(r){o.length=e.length;for(var n=0;n<e.length;n++)o[n]=je(e,n)?t(e[n],e):""}for(var i in e)je(e,i)&&(r&&String(Number(i))===i&&i<e.length||(/[^\w$]/.test(i)?o.push(t(i,e)+": "+t(e[i],e)):o.push(i+": "+t(e[i],e))));if("function"==typeof pe)for(var a=pe(e),c=0;c<a.length;c++)fe.call(e,a[c])&&o.push("["+t(a[c])+"]: "+t(e[a[c]],e));return o}var Fe=B,Re=function(e,t){var r=G(e,!!t);return"function"==typeof r&&H(e,".prototype.")>-1?q(r):r},Ne=function e(t,r,o,n){var i=r||{};if(je(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(je(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=!je(i,"customInspect")||i.customInspect;if("boolean"!=typeof a)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(je(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 Oe(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===o&&(o=0),o>=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,o);if(void 0===n)n=[];else if(we(n,t)>=0)return"[Circular]";function u(t,r,a){if(r&&(n=n.slice()).push(r),a){var c={depth:i.depth};return je(i,"quoteStyle")&&(c.quoteStyle=i.quoteStyle),e(t,c,o+1,n)}return e(t,i,o+1,n)}if("function"==typeof t){var f=function(e){if(e.name)return e.name;var t=ae.call(ie.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),l=Ie(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(me(t)){var y=ue.call(t);return"object"==typeof t?Pe(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+"="+be(he(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=Ie(t,u);return p&&!function(e){for(var t=0;t<e.length;t++)if(we(e[t],"\n")>=0)return!1;return!0}(h)?"["+ke(h,p)+"]":"[ "+h.join(", ")+" ]"}if(function(e){return!("[object Error]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t)){var g=Ie(t,u);return 0===g.length?"["+String(t)+"]":"{ ["+String(t)+"] "+g.join(", ")+" }"}if("object"==typeof t&&a){if(se&&"function"==typeof t[se])return t[se]();if("function"==typeof t.inspect)return t.inspect()}if(function(e){if(!K||!e||"object"!=typeof e)return!1;try{K.call(e);try{Y.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var m=[];return J.call(t,(function(e,r){m.push(u(r,t,!0)+" => "+u(e,t))})),Ee("Map",K.call(t),m,p)}if(function(e){if(!Y||!e||"object"!=typeof e)return!1;try{Y.call(e);try{K.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var v=[];return Z.call(t,(function(e){v.push(u(e,t))})),Ee("Set",Y.call(t),v,p)}if(function(e){if(!ee||!e||"object"!=typeof e)return!1;try{ee.call(e,ee);try{te.call(e,te)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return xe("WeakMap");if(function(e){if(!te||!e||"object"!=typeof e)return!1;try{te.call(e,te);try{ee.call(e,ee)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return xe("WeakSet");if(function(e){if(!re||!e||"object"!=typeof e)return!1;try{return re.call(e),!0}catch(e){}return!1}(t))return xe("WeakRef");if(function(e){return!("[object Number]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t))return Pe(u(Number(t)));if(function(e){if(!e||"object"!=typeof e||!ce)return!1;try{return ce.call(e),!0}catch(e){}return!1}(t))return Pe(u(ce.call(t)));if(function(e){return!("[object Boolean]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t))return Pe(oe.call(t));if(function(e){return!("[object String]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t))return Pe(u(String(t)));if(!function(e){return!("[object Date]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t)&&!function(e){return!("[object RegExp]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t)){var j=Ie(t,u),S=le?le(t)===Object.prototype:t instanceof Object||t.constructor===Object,w=t instanceof Object?"":"null prototype",O=!S&&de&&Object(t)===t&&de in t?Se(t).slice(8,-1):w?"Object":"",A=(S||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(O||w?"["+[].concat(O||[],w||[]).join(": ")+"] ":"");return 0===j.length?A+"{}":p?A+"{"+ke(j,p)+"}":A+"{ "+j.join(", ")+" }"}return String(t)},De=Fe("%TypeError%"),Me=Fe("%WeakMap%",!0),Ue=Fe("%Map%",!0),_e=Re("WeakMap.prototype.get",!0),Ce=Re("WeakMap.prototype.set",!0),Te=Re("WeakMap.prototype.has",!0),We=Re("Map.prototype.get",!0),Be=Re("Map.prototype.set",!0),Le=Re("Map.prototype.has",!0),Ge=function(e,t){for(var r,o=e;null!==(r=o.next);o=r)if(r.key===t)return o.next=r.next,r.next=e.next,e.next=r,r},qe=String.prototype.replace,He=/%20/g,ze="RFC3986",Ve={default:ze,formatters:{RFC1738:function(e){return qe.call(e,He,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:ze},Qe=Ve,Ke=Object.prototype.hasOwnProperty,Je=Array.isArray,$e=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),Xe=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r},Ye={arrayToObject:Xe,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=[],o=0;o<t.length;++o)for(var n=t[o],i=n.obj[n.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(Je(r)){for(var o=[],n=0;n<r.length;++n)void 0!==r[n]&&o.push(r[n]);t.obj[t.prop]=o}}}(t),e},decode:function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},encode:function(e,t,r,o,n){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||n===Qe.RFC1738&&(40===p||41===p)?a+=i.charAt(c):p<128?a+=$e[p]:p<2048?a+=$e[192|p>>6]+$e[128|63&p]:p<55296||p>=57344?a+=$e[224|p>>12]+$e[128|p>>6&63]+$e[128|63&p]:(c+=1,p=65536+((1023&p)<<10|1023&i.charCodeAt(c)),a+=$e[240|p>>18]+$e[128|p>>12&63]+$e[128|p>>6&63]+$e[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(Je(e)){for(var r=[],o=0;o<e.length;o+=1)r.push(t(e[o]));return r}return t(e)},merge:function e(t,r,o){if(!r)return t;if("object"!=typeof r){if(Je(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(o&&(o.plainObjects||o.allowPrototypes)||!Ke.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var n=t;return Je(t)&&!Je(r)&&(n=Xe(t,o)),Je(t)&&Je(r)?(r.forEach((function(r,n){if(Ke.call(t,n)){var i=t[n];i&&"object"==typeof i&&r&&"object"==typeof r?t[n]=e(i,r,o):t.push(r)}else t[n]=r})),t):Object.keys(r).reduce((function(t,n){var i=r[n];return Ke.call(t,n)?t[n]=e(t[n],i,o):t[n]=i,t}),n)}},Ze=function(){var e,t,r,o={assert:function(e){if(!o.has(e))throw new De("Side channel does not contain "+Ne(e))},get:function(o){if(Me&&o&&("object"==typeof o||"function"==typeof o)){if(e)return _e(e,o)}else if(Ue){if(t)return We(t,o)}else if(r)return function(e,t){var r=Ge(e,t);return r&&r.value}(r,o)},has:function(o){if(Me&&o&&("object"==typeof o||"function"==typeof o)){if(e)return Te(e,o)}else if(Ue){if(t)return Le(t,o)}else if(r)return function(e,t){return!!Ge(e,t)}(r,o);return!1},set:function(o,n){Me&&o&&("object"==typeof o||"function"==typeof o)?(e||(e=new Me),Ce(e,o,n)):Ue?(t||(t=new Ue),Be(t,o,n)):(r||(r={key:{},next:null}),function(e,t,r){var o=Ge(e,t);o?o.value=r:e.next={key:t,next:e.next,value:r}}(r,o,n))}};return o},et=Ye,tt=Ve,rt=Object.prototype.hasOwnProperty,ot={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},nt=Array.isArray,it=Array.prototype.push,at=function(e,t){it.apply(e,nt(t)?t:[t])},ct=Date.prototype.toISOString,pt=tt.default,ut={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:et.encode,encodeValuesOnly:!1,format:pt,formatter:tt.formatters[pt],indices:!1,serializeDate:function(e){return ct.call(e)},skipNulls:!1,strictNullHandling:!1},ft=function e(t,r,o,n,i,a,c,p,u,f,l,y,s,d,b){var h,g=t;if(b.has(t))throw new RangeError("Cyclic object value");if("function"==typeof c?g=c(r,g):g instanceof Date?g=f(g):"comma"===o&&nt(g)&&(g=et.maybeMap(g,(function(e){return e instanceof Date?f(e):e}))),null===g){if(n)return a&&!s?a(r,ut.encoder,d,"key",l):r;g=""}if("string"==typeof(h=g)||"number"==typeof h||"boolean"==typeof h||"symbol"==typeof h||"bigint"==typeof h||et.isBuffer(g))return a?[y(s?r:a(r,ut.encoder,d,"key",l))+"="+y(a(g,ut.encoder,d,"value",l))]:[y(r)+"="+y(String(g))];var m,v=[];if(void 0===g)return v;if("comma"===o&&nt(g))m=[{value:g.length>0?g.join(",")||null:void 0}];else if(nt(c))m=c;else{var j=Object.keys(g);m=p?j.sort(p):j}for(var S=0;S<m.length;++S){var w=m[S],O="object"==typeof w&&void 0!==w.value?w.value:g[w];if(!i||null!==O){var A=nt(g)?"function"==typeof o?o(r,w):r:r+(u?"."+w:"["+w+"]");b.set(t,!0);var P=Ze();at(v,e(O,A,o,n,i,a,c,p,u,f,l,y,s,d,P))}}return v},lt=Ye,yt=Object.prototype.hasOwnProperty,st=Array.isArray,dt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:lt.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},bt=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},ht=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},gt=function(e,t,r,o){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(n),c=a?n.slice(0,a.index):n,p=[];if(c){if(!r.plainObjects&&yt.call(Object.prototype,c)&&!r.allowPrototypes)return;p.push(c)}for(var u=0;r.depth>0&&null!==(a=i.exec(n))&&u<r.depth;){if(u+=1,!r.plainObjects&&yt.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(a[1])}return a&&p.push("["+n.slice(a.index)+"]"),function(e,t,r,o){for(var n=o?t:ht(t,r),i=e.length-1;i>=0;--i){var a,c=e[i];if("[]"===c&&r.parseArrays)a=[].concat(n);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]=n:a[p]=n:a={0:n}}n=a}return n}(p,t,r,o)}},mt={formats:Ve,parse:function(e,t){var r=function(e){if(!e)return dt;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?dt.charset:e.charset;return{allowDots:void 0===e.allowDots?dt.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:dt.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:dt.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:dt.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:dt.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:dt.comma,decoder:"function"==typeof e.decoder?e.decoder:dt.decoder,delimiter:"string"==typeof e.delimiter||lt.isRegExp(e.delimiter)?e.delimiter:dt.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:dt.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:dt.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:dt.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:dt.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:dt.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){var r,o={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=n.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,dt.decoder,p,"key"),f=t.strictNullHandling?null:""):(u=t.decoder(l.slice(0,s),dt.decoder,p,"key"),f=lt.maybeMap(ht(l.slice(s+1),t),(function(e){return t.decoder(e,dt.decoder,p,"value")}))),f&&t.interpretNumericEntities&&"iso-8859-1"===p&&(f=bt(f)),l.indexOf("[]=")>-1&&(f=st(f)?[f]:f),yt.call(o,u)?o[u]=lt.combine(o[u],f):o[u]=f}return o}(e,r):e,n=r.plainObjects?Object.create(null):{},i=Object.keys(o),a=0;a<i.length;++a){var c=i[a],p=gt(c,o[c],r,"string"==typeof e);n=lt.merge(n,p,r)}return!0===r.allowSparse?n:lt.compact(n)},stringify:function(e,t){var r,o=e,n=function(e){if(!e)return ut;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||ut.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=tt.default;if(void 0!==e.format){if(!rt.call(tt.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=tt.formatters[r],n=ut.filter;return("function"==typeof e.filter||nt(e.filter))&&(n=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:ut.addQueryPrefix,allowDots:void 0===e.allowDots?ut.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:ut.charsetSentinel,delimiter:void 0===e.delimiter?ut.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:ut.encode,encoder:"function"==typeof e.encoder?e.encoder:ut.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:ut.encodeValuesOnly,filter:n,format:r,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:ut.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:ut.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:ut.strictNullHandling}}(t);"function"==typeof n.filter?o=(0,n.filter)("",o):nt(n.filter)&&(r=n.filter);var i,a=[];if("object"!=typeof o||null===o)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(o)),n.sort&&r.sort(n.sort);for(var p=Ze(),u=0;u<r.length;++u){var f=r[u];n.skipNulls&&null===o[f]||at(a,ft(o[f],f,c,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,p))}var l=a.join(n.delimiter),y=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),l.length>0?y+l:""}},vt=function(e){return null!==e&&"string"==typeof e};e.createClient=function(e){var o=e.serviceDomain,n=e.apiKey,i=e.globalDraftKey;if(!o||!n)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!vt(o)||!vt(n))throw new Error("parameter is not string");var c="https://"+o+".microcms.io/api/v1",p=function(e){var o=e.endpoint,p=e.contentId,u=e.queries,f=void 0===u?{}:u,l=e.useGlobalDraftKey,y=void 0===l||l;return t(void 0,void 0,void 0,(function(){var e,t,u,l,s,d;return r(this,(function(r){switch(r.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return mt.stringify(e)}(f),t={headers:{"X-API-KEY":n}},i&&y&&Object.assign(t.headers,{"X-GLOBAL-DRAFT-KEY":i}),u=c+"/"+o+(p?"/"+p:"")+(e?"?"+e:""),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,a(u,t)];case 2:if(!(l=r.sent()).ok)throw new Error("fetch API response status: "+l.status);return[2,l.json()];case 3:if((s=r.sent()).data)throw s.data;if(null===(d=s.response)||void 0===d?void 0:d.data)throw s.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: "+s))];case 4:return[2]}}))}))};return{get:function(e){var o=e.endpoint,n=e.contentId,i=e.queries,a=void 0===i?{}:i,c=e.useGlobalDraftKey;return t(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return o?[4,p({endpoint:o,contentId:n,queries:a,useGlobalDraftKey:c})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))}}},Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */function t(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{p(o.next(e))}catch(e){i(e)}}function c(e){try{p(o.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}p((o=o.apply(e,t||[])).next())}))}function r(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{r=n=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 o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})})),t}var n={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}(n,n.exports);var i,a=n.exports,c="undefined"!=typeof Symbol&&Symbol,p=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 o=Object.getOwnPropertySymbols(e);if(1!==o.length||o[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0},u="Function.prototype.bind called on incompatible ",f=Array.prototype.slice,l=Object.prototype.toString,y="[object Function]",s=function(e){var t=this;if("function"!=typeof t||l.call(t)!==y)throw new TypeError(u+t);for(var r,o=f.call(arguments,1),n=function(){if(this instanceof r){var n=t.apply(this,o.concat(f.call(arguments)));return Object(n)===n?n:this}return t.apply(e,o.concat(f.call(arguments)))},i=Math.max(0,t.length-o.length),a=[],c=0;c<i;c++)a.push("$"+c);if(r=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r},d=Function.prototype.bind||s,b=d.call(Function.call,Object.prototype.hasOwnProperty),h=SyntaxError,g=Function,m=TypeError,v=function(e){try{return g('"use strict"; return ('+e+").constructor;")()}catch(e){}},j=Object.getOwnPropertyDescriptor;if(j)try{j({},"")}catch(e){j=null}var S=function(){throw new m},w=j?function(){try{return S}catch(e){try{return j(arguments,"callee").get}catch(e){return S}}}():S,O="function"==typeof c&&"function"==typeof Symbol&&"symbol"==typeof c("foo")&&"symbol"==typeof Symbol("bar")&&p(),A=Object.getPrototypeOf||function(e){return e.__proto__},P={},E="undefined"==typeof Uint8Array?i:A(Uint8Array),x={"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":O?A([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":P,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":O?A(A([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&O?A((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&O?A((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":O?A(""[Symbol.iterator]()):i,"%Symbol%":O?Symbol:i,"%SyntaxError%":h,"%ThrowTypeError%":w,"%TypedArray%":E,"%TypeError%":m,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet},k=function e(t){var r;if("%AsyncFunction%"===t)r=v("async function () {}");else if("%GeneratorFunction%"===t)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=v("async function* () {}");else if("%AsyncGenerator%"===t){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&(r=A(n.prototype))}return x[t]=r,r},I={"%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"]},F=d,R=b,N=F.call(Function.call,Array.prototype.concat),M=F.call(Function.apply,Array.prototype.splice),D=F.call(Function.call,String.prototype.replace),U=F.call(Function.call,String.prototype.slice),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,_=/\\(\\)?/g,W=function(e){var t=U(e,0,1),r=U(e,-1);if("%"===t&&"%"!==r)throw new h("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new h("invalid intrinsic syntax, expected opening `%`");var o=[];return D(e,C,(function(e,t,r,n){o[o.length]=r?D(n,_,"$1"):t||e})),o},T=function(e,t){var r,o=e;if(R(I,o)&&(o="%"+(r=I[o])[0]+"%"),R(x,o)){var n=x[o];if(n===P&&(n=k(o)),void 0===n&&!t)throw new m("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:o,value:n}}throw new h("intrinsic "+e+" does not exist!")},q=function(e,t){if("string"!=typeof e||0===e.length)throw new m("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new m('"allowMissing" argument must be a boolean');var r=W(e),o=r.length>0?r[0]:"",n=T("%"+o+"%",t),i=n.name,a=n.value,c=!1,p=n.alias;p&&(o=p[0],M(r,N([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 h("property names with quotes must have matching quotes");if("constructor"!==l&&f||(c=!0),R(x,i="%"+(o+="."+l)+"%"))a=x[i];else if(null!=a){if(!(l in a)){if(!t)throw new m("base intrinsic for "+e+" exists, but the property is not available.");return}if(j&&u+1>=r.length){var d=j(a,l);a=(f=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[l]}else f=R(a,l),a=a[l];f&&!c&&(x[i]=a)}}return a},B={exports:{}};!function(e){var t=d,r=q,o=r("%Function.prototype.apply%"),n=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||t.call(n,o),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,n,arguments);if(a&&c){var o=a(r,"length");o.configurable&&c(r,"length",{value:1+p(0,e.length-(arguments.length-1))})}return r};var u=function(){return i(t,o,arguments)};c?c(e.exports,"apply",{value:u}):e.exports.apply=u}(B);var L=q,G=B.exports,H=G(L("String.prototype.indexOf")),z=o(Object.freeze({__proto__:null,default:{}})),V="function"==typeof Map&&Map.prototype,Q=Object.getOwnPropertyDescriptor&&V?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,J=V&&Q&&"function"==typeof Q.get?Q.get:null,$=V&&Map.prototype.forEach,K="function"==typeof Set&&Set.prototype,X=Object.getOwnPropertyDescriptor&&K?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Y=K&&X&&"function"==typeof X.get?X.get:null,Z=K&&Set.prototype.forEach,ee="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,te="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,re="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,oe=Boolean.prototype.valueOf,ne=Object.prototype.toString,ie=Function.prototype.toString,ae=String.prototype.match,ce="function"==typeof BigInt?BigInt.prototype.valueOf:null,pe=Object.getOwnPropertySymbols,ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,fe=Object.prototype.propertyIsEnumerable,le=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),ye=z.custom,se=ye&&me(ye)?ye:null,de="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag?Symbol.toStringTag:null;function be(e,t,r){var o="double"===(r.quoteStyle||t)?'"':"'";return o+e+o}function he(e){return String(e).replace(/"/g,"&quot;")}function ge(e){return!("[object Array]"!==Se(e)||de&&"object"==typeof e&&de in e)}function me(e){if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!ue)return!1;try{return ue.call(e),!0}catch(e){}return!1}var ve=Object.prototype.hasOwnProperty||function(e){return e in this};function je(e,t){return ve.call(e,t)}function Se(e){return ne.call(e)}function we(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}function Oe(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,o="... "+r+" more character"+(r>1?"s":"");return Oe(e.slice(0,t.maxStringLength),t)+o}return be(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 Pe(e){return"Object("+e+")"}function Ee(e){return e+" { ? }"}function xe(e,t,r,o){return e+" ("+t+") {"+(o?ke(r,o):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 Ie(e,t){var r=ge(e),o=[];if(r){o.length=e.length;for(var n=0;n<e.length;n++)o[n]=je(e,n)?t(e[n],e):""}for(var i in e)je(e,i)&&(r&&String(Number(i))===i&&i<e.length||(/[^\w$]/.test(i)?o.push(t(i,e)+": "+t(e[i],e)):o.push(i+": "+t(e[i],e))));if("function"==typeof pe)for(var a=pe(e),c=0;c<a.length;c++)fe.call(e,a[c])&&o.push("["+t(a[c])+"]: "+t(e[a[c]],e));return o}var Fe=q,Re=function(e,t){var r=L(e,!!t);return"function"==typeof r&&H(e,".prototype.")>-1?G(r):r},Ne=function e(t,r,o,n){var i=r||{};if(je(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(je(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=!je(i,"customInspect")||i.customInspect;if("boolean"!=typeof a)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(je(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 Oe(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===o&&(o=0),o>=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,o);if(void 0===n)n=[];else if(we(n,t)>=0)return"[Circular]";function u(t,r,a){if(r&&(n=n.slice()).push(r),a){var c={depth:i.depth};return je(i,"quoteStyle")&&(c.quoteStyle=i.quoteStyle),e(t,c,o+1,n)}return e(t,i,o+1,n)}if("function"==typeof t){var f=function(e){if(e.name)return e.name;var t=ae.call(ie.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),l=Ie(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(me(t)){var y=ue.call(t);return"object"==typeof t?Pe(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+"="+be(he(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=Ie(t,u);return p&&!function(e){for(var t=0;t<e.length;t++)if(we(e[t],"\n")>=0)return!1;return!0}(h)?"["+ke(h,p)+"]":"[ "+h.join(", ")+" ]"}if(function(e){return!("[object Error]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t)){var g=Ie(t,u);return 0===g.length?"["+String(t)+"]":"{ ["+String(t)+"] "+g.join(", ")+" }"}if("object"==typeof t&&a){if(se&&"function"==typeof t[se])return t[se]();if("function"==typeof t.inspect)return t.inspect()}if(function(e){if(!J||!e||"object"!=typeof e)return!1;try{J.call(e);try{Y.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var m=[];return $.call(t,(function(e,r){m.push(u(r,t,!0)+" => "+u(e,t))})),xe("Map",J.call(t),m,p)}if(function(e){if(!Y||!e||"object"!=typeof e)return!1;try{Y.call(e);try{J.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var v=[];return Z.call(t,(function(e){v.push(u(e,t))})),xe("Set",Y.call(t),v,p)}if(function(e){if(!ee||!e||"object"!=typeof e)return!1;try{ee.call(e,ee);try{te.call(e,te)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return Ee("WeakMap");if(function(e){if(!te||!e||"object"!=typeof e)return!1;try{te.call(e,te);try{ee.call(e,ee)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return Ee("WeakSet");if(function(e){if(!re||!e||"object"!=typeof e)return!1;try{return re.call(e),!0}catch(e){}return!1}(t))return Ee("WeakRef");if(function(e){return!("[object Number]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t))return Pe(u(Number(t)));if(function(e){if(!e||"object"!=typeof e||!ce)return!1;try{return ce.call(e),!0}catch(e){}return!1}(t))return Pe(u(ce.call(t)));if(function(e){return!("[object Boolean]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t))return Pe(oe.call(t));if(function(e){return!("[object String]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t))return Pe(u(String(t)));if(!function(e){return!("[object Date]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t)&&!function(e){return!("[object RegExp]"!==Se(e)||de&&"object"==typeof e&&de in e)}(t)){var j=Ie(t,u),S=le?le(t)===Object.prototype:t instanceof Object||t.constructor===Object,w=t instanceof Object?"":"null prototype",O=!S&&de&&Object(t)===t&&de in t?Se(t).slice(8,-1):w?"Object":"",A=(S||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(O||w?"["+[].concat(O||[],w||[]).join(": ")+"] ":"");return 0===j.length?A+"{}":p?A+"{"+ke(j,p)+"}":A+"{ "+j.join(", ")+" }"}return String(t)},Me=Fe("%TypeError%"),De=Fe("%WeakMap%",!0),Ue=Fe("%Map%",!0),Ce=Re("WeakMap.prototype.get",!0),_e=Re("WeakMap.prototype.set",!0),We=Re("WeakMap.prototype.has",!0),Te=Re("Map.prototype.get",!0),qe=Re("Map.prototype.set",!0),Be=Re("Map.prototype.has",!0),Le=function(e,t){for(var r,o=e;null!==(r=o.next);o=r)if(r.key===t)return o.next=r.next,r.next=e.next,e.next=r,r},Ge=String.prototype.replace,He=/%20/g,ze="RFC3986",Ve={default:ze,formatters:{RFC1738:function(e){return Ge.call(e,He,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:ze},Qe=Ve,Je=Object.prototype.hasOwnProperty,$e=Array.isArray,Ke=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),Xe=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r},Ye={arrayToObject:Xe,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=[],o=0;o<t.length;++o)for(var n=t[o],i=n.obj[n.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($e(r)){for(var o=[],n=0;n<r.length;++n)void 0!==r[n]&&o.push(r[n]);t.obj[t.prop]=o}}}(t),e},decode:function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},encode:function(e,t,r,o,n){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||n===Qe.RFC1738&&(40===p||41===p)?a+=i.charAt(c):p<128?a+=Ke[p]:p<2048?a+=Ke[192|p>>6]+Ke[128|63&p]:p<55296||p>=57344?a+=Ke[224|p>>12]+Ke[128|p>>6&63]+Ke[128|63&p]:(c+=1,p=65536+((1023&p)<<10|1023&i.charCodeAt(c)),a+=Ke[240|p>>18]+Ke[128|p>>12&63]+Ke[128|p>>6&63]+Ke[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($e(e)){for(var r=[],o=0;o<e.length;o+=1)r.push(t(e[o]));return r}return t(e)},merge:function e(t,r,o){if(!r)return t;if("object"!=typeof r){if($e(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(o&&(o.plainObjects||o.allowPrototypes)||!Je.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var n=t;return $e(t)&&!$e(r)&&(n=Xe(t,o)),$e(t)&&$e(r)?(r.forEach((function(r,n){if(Je.call(t,n)){var i=t[n];i&&"object"==typeof i&&r&&"object"==typeof r?t[n]=e(i,r,o):t.push(r)}else t[n]=r})),t):Object.keys(r).reduce((function(t,n){var i=r[n];return Je.call(t,n)?t[n]=e(t[n],i,o):t[n]=i,t}),n)}},Ze=function(){var e,t,r,o={assert:function(e){if(!o.has(e))throw new Me("Side channel does not contain "+Ne(e))},get:function(o){if(De&&o&&("object"==typeof o||"function"==typeof o)){if(e)return Ce(e,o)}else if(Ue){if(t)return Te(t,o)}else if(r)return function(e,t){var r=Le(e,t);return r&&r.value}(r,o)},has:function(o){if(De&&o&&("object"==typeof o||"function"==typeof o)){if(e)return We(e,o)}else if(Ue){if(t)return Be(t,o)}else if(r)return function(e,t){return!!Le(e,t)}(r,o);return!1},set:function(o,n){De&&o&&("object"==typeof o||"function"==typeof o)?(e||(e=new De),_e(e,o,n)):Ue?(t||(t=new Ue),qe(t,o,n)):(r||(r={key:{},next:null}),function(e,t,r){var o=Le(e,t);o?o.value=r:e.next={key:t,next:e.next,value:r}}(r,o,n))}};return o},et=Ye,tt=Ve,rt=Object.prototype.hasOwnProperty,ot={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},nt=Array.isArray,it=Array.prototype.push,at=function(e,t){it.apply(e,nt(t)?t:[t])},ct=Date.prototype.toISOString,pt=tt.default,ut={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:et.encode,encodeValuesOnly:!1,format:pt,formatter:tt.formatters[pt],indices:!1,serializeDate:function(e){return ct.call(e)},skipNulls:!1,strictNullHandling:!1},ft=function e(t,r,o,n,i,a,c,p,u,f,l,y,s,d,b){var h,g=t;if(b.has(t))throw new RangeError("Cyclic object value");if("function"==typeof c?g=c(r,g):g instanceof Date?g=f(g):"comma"===o&&nt(g)&&(g=et.maybeMap(g,(function(e){return e instanceof Date?f(e):e}))),null===g){if(n)return a&&!s?a(r,ut.encoder,d,"key",l):r;g=""}if("string"==typeof(h=g)||"number"==typeof h||"boolean"==typeof h||"symbol"==typeof h||"bigint"==typeof h||et.isBuffer(g))return a?[y(s?r:a(r,ut.encoder,d,"key",l))+"="+y(a(g,ut.encoder,d,"value",l))]:[y(r)+"="+y(String(g))];var m,v=[];if(void 0===g)return v;if("comma"===o&&nt(g))m=[{value:g.length>0?g.join(",")||null:void 0}];else if(nt(c))m=c;else{var j=Object.keys(g);m=p?j.sort(p):j}for(var S=0;S<m.length;++S){var w=m[S],O="object"==typeof w&&void 0!==w.value?w.value:g[w];if(!i||null!==O){var A=nt(g)?"function"==typeof o?o(r,w):r:r+(u?"."+w:"["+w+"]");b.set(t,!0);var P=Ze();at(v,e(O,A,o,n,i,a,c,p,u,f,l,y,s,d,P))}}return v},lt=Ye,yt=Object.prototype.hasOwnProperty,st=Array.isArray,dt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:lt.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},bt=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},ht=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},gt=function(e,t,r,o){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(n),c=a?n.slice(0,a.index):n,p=[];if(c){if(!r.plainObjects&&yt.call(Object.prototype,c)&&!r.allowPrototypes)return;p.push(c)}for(var u=0;r.depth>0&&null!==(a=i.exec(n))&&u<r.depth;){if(u+=1,!r.plainObjects&&yt.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(a[1])}return a&&p.push("["+n.slice(a.index)+"]"),function(e,t,r,o){for(var n=o?t:ht(t,r),i=e.length-1;i>=0;--i){var a,c=e[i];if("[]"===c&&r.parseArrays)a=[].concat(n);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]=n:a[p]=n:a={0:n}}n=a}return n}(p,t,r,o)}},mt={formats:Ve,parse:function(e,t){var r=function(e){if(!e)return dt;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?dt.charset:e.charset;return{allowDots:void 0===e.allowDots?dt.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:dt.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:dt.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:dt.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:dt.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:dt.comma,decoder:"function"==typeof e.decoder?e.decoder:dt.decoder,delimiter:"string"==typeof e.delimiter||lt.isRegExp(e.delimiter)?e.delimiter:dt.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:dt.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:dt.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:dt.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:dt.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:dt.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){var r,o={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=n.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,dt.decoder,p,"key"),f=t.strictNullHandling?null:""):(u=t.decoder(l.slice(0,s),dt.decoder,p,"key"),f=lt.maybeMap(ht(l.slice(s+1),t),(function(e){return t.decoder(e,dt.decoder,p,"value")}))),f&&t.interpretNumericEntities&&"iso-8859-1"===p&&(f=bt(f)),l.indexOf("[]=")>-1&&(f=st(f)?[f]:f),yt.call(o,u)?o[u]=lt.combine(o[u],f):o[u]=f}return o}(e,r):e,n=r.plainObjects?Object.create(null):{},i=Object.keys(o),a=0;a<i.length;++a){var c=i[a],p=gt(c,o[c],r,"string"==typeof e);n=lt.merge(n,p,r)}return!0===r.allowSparse?n:lt.compact(n)},stringify:function(e,t){var r,o=e,n=function(e){if(!e)return ut;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||ut.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=tt.default;if(void 0!==e.format){if(!rt.call(tt.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=tt.formatters[r],n=ut.filter;return("function"==typeof e.filter||nt(e.filter))&&(n=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:ut.addQueryPrefix,allowDots:void 0===e.allowDots?ut.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:ut.charsetSentinel,delimiter:void 0===e.delimiter?ut.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:ut.encode,encoder:"function"==typeof e.encoder?e.encoder:ut.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:ut.encodeValuesOnly,filter:n,format:r,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:ut.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:ut.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:ut.strictNullHandling}}(t);"function"==typeof n.filter?o=(0,n.filter)("",o):nt(n.filter)&&(r=n.filter);var i,a=[];if("object"!=typeof o||null===o)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(o)),n.sort&&r.sort(n.sort);for(var p=Ze(),u=0;u<r.length;++u){var f=r[u];n.skipNulls&&null===o[f]||at(a,ft(o[f],f,c,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,p))}var l=a.join(n.delimiter),y=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),l.length>0?y+l:""}},vt=function(e){return null!==e&&"string"==typeof e};e.createClient=function(e){var o=e.serviceDomain,n=e.apiKey;if(!o||!n)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!vt(o)||!vt(n))throw new Error("parameter is not string");var i="https://"+o+".microcms.io/api/v1",c=function(e){var o=e.endpoint,c=e.contentId,p=e.queries,u=void 0===p?{}:p;return t(void 0,void 0,void 0,(function(){var e,t,p,f,l,y;return r(this,(function(r){switch(r.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return mt.stringify(e,{arrayFormat:"comma"})}(u),t={headers:{"X-MICROCMS-API-KEY":n}},p=i+"/"+o+(c?"/"+c:"")+(e?"?"+e:""),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,a(p,t)];case 2:if(!(f=r.sent()).ok)throw new Error("fetch API response status: "+f.status);return[2,f.json()];case 3:if((l=r.sent()).data)throw l.data;if(null===(y=l.response)||void 0===y?void 0:y.data)throw l.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: "+l))];case 4:return[2]}}))}))};return{get:function(e){var o=e.endpoint,n=e.contentId,i=e.queries,a=void 0===i?{}:i;return t(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return o?[4,c({endpoint:o,contentId:n,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var o=e.endpoint,n=e.queries,i=void 0===n?{}:n;return t(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return o?[4,c({endpoint:o,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var o=e.endpoint,n=e.contentId,i=e.queries,a=void 0===i?{}:i;return t(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return o?[4,c({endpoint:o,contentId:n,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var o=e.endpoint,n=e.queries,i=void 0===n?{}:n;return t(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return o?[4,c({endpoint:o,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))}}},Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1,30 +1,89 @@
1
- export interface ClientParams {
1
+ /**
2
+ * microCMS createClient params
3
+ */
4
+ export interface MicroCMSClient {
2
5
  serviceDomain: string;
3
6
  apiKey: string;
4
- globalDraftKey?: string;
5
- }
6
- export interface MakeRequest {
7
- endpoint: string;
8
- contentId?: string;
9
- queries?: QueriesType;
10
- useGlobalDraftKey?: boolean;
11
- }
12
- export interface GetRequest {
13
- endpoint: string;
14
- contentId?: string;
15
- queries?: QueriesType;
16
- useGlobalDraftKey?: boolean;
17
7
  }
18
8
  declare type depthNumber = 1 | 2 | 3;
19
- export interface QueriesType {
9
+ /**
10
+ * microCMS queries
11
+ * https://document.microcms.io/content-api/get-list-contents#h9ce528688c
12
+ * https://document.microcms.io/content-api/get-content#h9ce528688c
13
+ */
14
+ export interface MicroCMSQueries {
20
15
  draftKey?: string;
21
16
  limit?: number;
22
17
  offset?: number;
23
18
  orders?: string;
24
- fields?: string;
19
+ fields?: string | string[];
25
20
  q?: string;
26
21
  depth?: depthNumber;
27
- ids?: string;
22
+ ids?: string | string[];
28
23
  filters?: string;
29
24
  }
25
+ /**
26
+ * microCMS contentId
27
+ * https://document.microcms.io/manual/content-id-setting
28
+ */
29
+ export interface MicroCMSContentId {
30
+ id: string;
31
+ }
32
+ /**
33
+ * microCMS content common date
34
+ */
35
+ export interface MicroCMSDate {
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ publishedAt?: string;
39
+ revisedAt?: string;
40
+ }
41
+ /**
42
+ * microCMS image
43
+ */
44
+ export interface MicroCMSImage {
45
+ url: string;
46
+ width?: number;
47
+ height?: number;
48
+ }
49
+ /**
50
+ * microCMS list api Response
51
+ */
52
+ export interface MicroCMSListResponse<T> {
53
+ contents: (T & MicroCMSListContent)[];
54
+ totalCount: number;
55
+ limit: number;
56
+ offset: number;
57
+ }
58
+ /**
59
+ * microCMS list content common types
60
+ */
61
+ export declare type MicroCMSListContent = MicroCMSContentId & MicroCMSDate;
62
+ /**
63
+ * microCMS object content common types
64
+ */
65
+ export declare type MicroCMSObjectContent = MicroCMSDate;
66
+ export interface MakeRequest {
67
+ endpoint: string;
68
+ contentId?: string;
69
+ queries?: MicroCMSQueries;
70
+ }
71
+ export interface GetRequest {
72
+ endpoint: string;
73
+ contentId?: string;
74
+ queries?: MicroCMSQueries;
75
+ }
76
+ export interface GetListDetailRequest {
77
+ endpoint: string;
78
+ contentId: string;
79
+ queries?: MicroCMSQueries;
80
+ }
81
+ export interface GetListRequest {
82
+ endpoint: string;
83
+ queries?: MicroCMSQueries;
84
+ }
85
+ export interface GetObjectRequest {
86
+ endpoint: string;
87
+ queries?: MicroCMSQueries;
88
+ }
30
89
  export {};
@@ -1,2 +1,2 @@
1
- import { QueriesType } from '../types';
2
- export declare const parseQuery: (queries: QueriesType) => string;
1
+ import { MicroCMSQueries } from '../types';
2
+ export declare const parseQuery: (queries: MicroCMSQueries) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microcms-js-sdk",
3
- "version": "1.2.0",
3
+ "version": "2.1.0",
4
4
  "description": "JavaScript SDK Client for microCMS.",
5
5
  "main": "./dist/cjs/microcms-js-sdk.js",
6
6
  "module": "./dist/esm/microcms-js-sdk.js",
@@ -12,13 +12,20 @@
12
12
  },
13
13
  "author": "microCMS",
14
14
  "license": "Apache-2.0",
15
- "keywords": ["JavaScript", "node", "SDK", "microCMS"],
15
+ "keywords": [
16
+ "JavaScript",
17
+ "node",
18
+ "SDK",
19
+ "microCMS"
20
+ ],
16
21
  "scripts": {
17
22
  "build": "rollup -c",
18
23
  "lint": "eslint ./src",
19
24
  "lint:fix": "eslint --fix ./src"
20
25
  },
21
- "files": ["dist"],
26
+ "files": [
27
+ "dist"
28
+ ],
22
29
  "dependencies": {
23
30
  "node-fetch": "^2.6.1",
24
31
  "qs": "^6.10.1"