microcms-js-sdk 2.0.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -9
- package/dist/cjs/createClient.d.ts +4 -1
- package/dist/cjs/microcms-js-sdk.js +2 -17
- package/dist/cjs/types.d.ts +25 -3
- package/dist/cjs/utils/constants.d.ts +2 -0
- package/dist/cjs/utils/isCheckValue.d.ts +6 -6
- package/dist/esm/createClient.d.ts +4 -1
- package/dist/esm/microcms-js-sdk.js +2 -2
- package/dist/esm/types.d.ts +25 -3
- package/dist/esm/utils/constants.d.ts +2 -0
- package/dist/esm/utils/isCheckValue.d.ts +6 -6
- package/dist/umd/createClient.d.ts +4 -1
- package/dist/umd/microcms-js-sdk.js +1 -1
- package/dist/umd/types.d.ts +25 -3
- package/dist/umd/utils/constants.d.ts +2 -0
- package/dist/umd/utils/isCheckValue.d.ts +6 -6
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ client
|
|
|
60
60
|
queries: { limit: 20, filters: 'createdAt[greater_than]2021' },
|
|
61
61
|
})
|
|
62
62
|
.then((res) => console.log(res))
|
|
63
|
-
.catch((err) => console.
|
|
63
|
+
.catch((err) => console.error(err));
|
|
64
64
|
|
|
65
65
|
client
|
|
66
66
|
.get({
|
|
@@ -69,7 +69,7 @@ client
|
|
|
69
69
|
queries: { fields: 'title,publishedAt' },
|
|
70
70
|
})
|
|
71
71
|
.then((res) => console.log(res))
|
|
72
|
-
.catch((err) => console.
|
|
72
|
+
.catch((err) => console.error(err));
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
And, Api corresponding to each content are also available. example.
|
|
@@ -81,7 +81,7 @@ client
|
|
|
81
81
|
endpoint: 'endpoint',
|
|
82
82
|
})
|
|
83
83
|
.then((res) => console.log(res))
|
|
84
|
-
.catch((err) => console.
|
|
84
|
+
.catch((err) => console.error(err));
|
|
85
85
|
|
|
86
86
|
// Get list API detail data
|
|
87
87
|
client
|
|
@@ -90,7 +90,7 @@ client
|
|
|
90
90
|
contentId: 'contentId',
|
|
91
91
|
})
|
|
92
92
|
.then((res) => console.log(res))
|
|
93
|
-
.catch((err) => console.
|
|
93
|
+
.catch((err) => console.error(err));
|
|
94
94
|
|
|
95
95
|
// Get object API data
|
|
96
96
|
client
|
|
@@ -98,7 +98,99 @@ client
|
|
|
98
98
|
endpoint: 'endpoint',
|
|
99
99
|
})
|
|
100
100
|
.then((res) => console.log(res))
|
|
101
|
-
.catch((err) => console.
|
|
101
|
+
.catch((err) => console.error(err));
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### WRITE API
|
|
105
|
+
|
|
106
|
+
The following is how to use the write system when making a request to the write system API.
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
// Create content
|
|
110
|
+
client
|
|
111
|
+
.create({
|
|
112
|
+
endpoint: 'endpoint',
|
|
113
|
+
content: {
|
|
114
|
+
title: 'title',
|
|
115
|
+
body: 'body',
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
.then((res) => console.log(res.id))
|
|
119
|
+
.catch((err) => console.error(err));
|
|
120
|
+
|
|
121
|
+
// Create content with specified ID
|
|
122
|
+
client
|
|
123
|
+
.create({
|
|
124
|
+
endpoint: 'endpoint',
|
|
125
|
+
contentId: 'contentId',
|
|
126
|
+
content: {
|
|
127
|
+
title: 'title',
|
|
128
|
+
body: 'body',
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
.then((res) => console.log(res.id))
|
|
132
|
+
.catch((err) => console.error(err));
|
|
133
|
+
// Create draft content
|
|
134
|
+
client
|
|
135
|
+
.create({
|
|
136
|
+
endpoint: 'endpoint',
|
|
137
|
+
content: {
|
|
138
|
+
title: 'title',
|
|
139
|
+
body: 'body',
|
|
140
|
+
},
|
|
141
|
+
// Available with microCMS paid plans
|
|
142
|
+
// https://microcms.io/pricing
|
|
143
|
+
isDraft: true,
|
|
144
|
+
})
|
|
145
|
+
.then((res) => console.log(res.id))
|
|
146
|
+
.catch((err) => console.error(err));
|
|
147
|
+
|
|
148
|
+
// Create draft content with specified ID
|
|
149
|
+
client
|
|
150
|
+
.create({
|
|
151
|
+
endpoint: 'endpoint',
|
|
152
|
+
contentId: 'contentId',
|
|
153
|
+
content: {
|
|
154
|
+
title: 'title',
|
|
155
|
+
body: 'body',
|
|
156
|
+
},
|
|
157
|
+
// Available with microCMS paid plans
|
|
158
|
+
// https://microcms.io/pricing
|
|
159
|
+
isDraft: true,
|
|
160
|
+
})
|
|
161
|
+
.then((res) => console.log(res.id))
|
|
162
|
+
.catch((err) => console.error(err));
|
|
163
|
+
|
|
164
|
+
// Update content
|
|
165
|
+
client
|
|
166
|
+
.update({
|
|
167
|
+
endpoint: 'endpoint',
|
|
168
|
+
contentId: 'contentId',
|
|
169
|
+
content: {
|
|
170
|
+
title: 'title',
|
|
171
|
+
},
|
|
172
|
+
})
|
|
173
|
+
.then((res) => console.log(res.id))
|
|
174
|
+
.catch((err) => console.error(err));
|
|
175
|
+
|
|
176
|
+
// Update object form content
|
|
177
|
+
client
|
|
178
|
+
.update({
|
|
179
|
+
endpoint: 'endpoint',
|
|
180
|
+
content: {
|
|
181
|
+
title: 'title',
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
.then((res) => console.log(res.id))
|
|
185
|
+
.catch((err) => console.error(err));
|
|
186
|
+
|
|
187
|
+
// Delete content
|
|
188
|
+
client
|
|
189
|
+
.delete({
|
|
190
|
+
endpoint: 'endpoint',
|
|
191
|
+
contentId: 'contentId',
|
|
192
|
+
})
|
|
193
|
+
.catch((err) => console.error(err));
|
|
102
194
|
```
|
|
103
195
|
|
|
104
196
|
### TypeScript
|
|
@@ -128,8 +220,8 @@ client.getList<Content>({ //other })
|
|
|
128
220
|
* id: string;
|
|
129
221
|
* createdAt: string;
|
|
130
222
|
* updatedAt: string;
|
|
131
|
-
* publishedAt
|
|
132
|
-
* revisedAt
|
|
223
|
+
* publishedAt?: string;
|
|
224
|
+
* revisedAt?: string;
|
|
133
225
|
* text: string; // This is Content type.
|
|
134
226
|
* }
|
|
135
227
|
*/
|
|
@@ -140,14 +232,55 @@ client.getListDetail<Content>({ //other })
|
|
|
140
232
|
* {
|
|
141
233
|
* createdAt: string;
|
|
142
234
|
* updatedAt: string;
|
|
143
|
-
* publishedAt
|
|
144
|
-
* revisedAt
|
|
235
|
+
* publishedAt?: string;
|
|
236
|
+
* revisedAt?: string;
|
|
145
237
|
* text: string; // This is Content type.
|
|
146
238
|
* }
|
|
147
239
|
*/
|
|
148
240
|
client.getObject<Content>({ //other })
|
|
149
241
|
```
|
|
150
242
|
|
|
243
|
+
Write functions can also be performed type-safely.
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
type Content = {
|
|
247
|
+
title: string
|
|
248
|
+
body?: string
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
client.create<Content>({
|
|
252
|
+
endpoint: 'endpoint',
|
|
253
|
+
// Since `content` will be of type `Content`, no required fields will be missed.
|
|
254
|
+
content: {
|
|
255
|
+
title: 'title',
|
|
256
|
+
body: 'body',
|
|
257
|
+
},
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
client.update<Content>({
|
|
261
|
+
endpoint: 'endpoint',
|
|
262
|
+
// The `content` will be of type `Partial<Content>`, so you can enter only the items needed for the update.
|
|
263
|
+
content: {
|
|
264
|
+
body: 'body',
|
|
265
|
+
},
|
|
266
|
+
})
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Tips
|
|
270
|
+
|
|
271
|
+
### Separate API keys for read and write
|
|
272
|
+
|
|
273
|
+
```javascript
|
|
274
|
+
const readClient = createClient({
|
|
275
|
+
serviceDomain: 'serviceDomain',
|
|
276
|
+
apiKey: 'readApiKey',
|
|
277
|
+
})
|
|
278
|
+
const writeClient = createClient({
|
|
279
|
+
serviceDomain: 'serviceDomain',
|
|
280
|
+
apiKey: 'writeApiKey',
|
|
281
|
+
})
|
|
282
|
+
```
|
|
283
|
+
|
|
151
284
|
# LICENSE
|
|
152
285
|
|
|
153
286
|
Apache-2.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent } from './types';
|
|
1
|
+
import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, WriteApiRequestResult, CreateRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent, UpdateRequest, DeleteRequest } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Initialize SDK Client
|
|
4
4
|
*/
|
|
@@ -7,4 +7,7 @@ export declare const createClient: ({ serviceDomain, apiKey }: MicroCMSClient) =
|
|
|
7
7
|
getList: <T_1 = any>({ endpoint, queries, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
|
|
8
8
|
getListDetail: <T_2 = any>({ endpoint, contentId, queries, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
|
|
9
9
|
getObject: <T_3 = any>({ endpoint, queries, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
|
|
10
|
+
create: <T_4 extends Record<string | number, any>>({ endpoint, contentId, content, isDraft, }: CreateRequest<T_4>) => Promise<WriteApiRequestResult>;
|
|
11
|
+
update: <T_5 extends Record<string | number, any>>({ endpoint, contentId, content, }: UpdateRequest<T_5>) => Promise<WriteApiRequestResult>;
|
|
12
|
+
delete: ({ endpoint, contentId, }: DeleteRequest) => Promise<void>;
|
|
10
13
|
};
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node-fetch"),
|
|
2
|
-
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */
|
|
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
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWljcm9jbXMtanMtc2RrLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OyJ9
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("node-fetch"),t=require("qs");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),o=n(t),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function c(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}a((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var a=function(e){return"string"==typeof e};exports.createClient=function(e){var t=e.serviceDomain,n=e.apiKey;if(!t||!n)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!a(t)||!a(n))throw new Error("parameter is not string");var s="https://".concat(t,".").concat("microcms.io","/api/").concat("v1"),d=function(e){var t=e.endpoint,a=e.contentId,d=e.queries,f=void 0===d?{}:d,l=e.method,p=e.customHeaders,v=e.customBody;return c(void 0,void 0,void 0,(function(){var e,c,d,h,w,y;return u(this,(function(u){switch(u.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return o.default.stringify(e,{arrayFormat:"comma"})}(f),c={headers:i(i({},p),{"X-MICROCMS-API-KEY":n}),body:v,method:l},d="".concat(s,"/").concat(t).concat(a?"/".concat(a):"").concat(e?"?".concat(e):""),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r.default(d,c)];case 2:if(!(h=u.sent()).ok)throw new Error("fetch API response status: ".concat(h.status));return"DELETE"===l?[2]:[2,h.json()];case 3:if((w=u.sent()).data)throw w.data;if(null===(y=w.response)||void 0===y?void 0:y.data)throw w.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(w)))];case 4:return[2]}}))}))};return{get:function(e){var t=e.endpoint,n=e.contentId,r=e.queries,o=void 0===r?{}:r;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,contentId:n,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var t=e.endpoint,n=e.queries,r=void 0===n?{}:n;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,queries:r})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var t=e.endpoint,n=e.contentId,r=e.queries,o=void 0===r?{}:r;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,contentId:n,queries:o})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var t=e.endpoint,n=e.queries,r=void 0===n?{}:n;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?[4,d({endpoint:t,queries:r})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var t=e.endpoint,n=e.contentId,r=e.content,o=e.isDraft,i=void 0!==o&&o;return c(void 0,void 0,void 0,(function(){var e,o,c,a;return u(this,(function(u){return t?(e=i?{status:"draft"}:{},o=n?"PUT":"POST",c={"Content-Type":"application/json"},a=JSON.stringify(r),[2,d({endpoint:t,contentId:n,queries:e,method:o,customHeaders:c,customBody:a})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var t=e.endpoint,n=e.contentId,r=e.content;return c(void 0,void 0,void 0,(function(){var e,o;return u(this,(function(i){return t?("PATCH",e={"Content-Type":"application/json"},o=JSON.stringify(r),[2,d({endpoint:t,contentId:n,method:"PATCH",customHeaders:e,customBody:o})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var t=e.endpoint,n=e.contentId;return c(void 0,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return t?n?("DELETE",[4,d({endpoint:t,contentId:n,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}};
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWljcm9jbXMtanMtc2RrLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BodyInit, HeadersInit } from 'node-fetch';
|
|
1
2
|
/**
|
|
2
3
|
* microCMS createClient params
|
|
3
4
|
*/
|
|
@@ -35,8 +36,8 @@ export interface MicroCMSContentId {
|
|
|
35
36
|
export interface MicroCMSDate {
|
|
36
37
|
createdAt: string;
|
|
37
38
|
updatedAt: string;
|
|
38
|
-
publishedAt
|
|
39
|
-
revisedAt
|
|
39
|
+
publishedAt?: string;
|
|
40
|
+
revisedAt?: string;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* microCMS image
|
|
@@ -66,7 +67,10 @@ export declare type MicroCMSObjectContent = MicroCMSDate;
|
|
|
66
67
|
export interface MakeRequest {
|
|
67
68
|
endpoint: string;
|
|
68
69
|
contentId?: string;
|
|
69
|
-
queries?: MicroCMSQueries
|
|
70
|
+
queries?: MicroCMSQueries & Record<string, any>;
|
|
71
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
72
|
+
customHeaders?: HeadersInit;
|
|
73
|
+
customBody?: BodyInit;
|
|
70
74
|
}
|
|
71
75
|
export interface GetRequest {
|
|
72
76
|
endpoint: string;
|
|
@@ -86,4 +90,22 @@ export interface GetObjectRequest {
|
|
|
86
90
|
endpoint: string;
|
|
87
91
|
queries?: MicroCMSQueries;
|
|
88
92
|
}
|
|
93
|
+
export interface WriteApiRequestResult {
|
|
94
|
+
id: string;
|
|
95
|
+
}
|
|
96
|
+
export interface CreateRequest<T> {
|
|
97
|
+
endpoint: string;
|
|
98
|
+
contentId?: string;
|
|
99
|
+
content: T;
|
|
100
|
+
isDraft?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface UpdateRequest<T> {
|
|
103
|
+
endpoint: string;
|
|
104
|
+
contentId?: string;
|
|
105
|
+
content: Partial<T>;
|
|
106
|
+
}
|
|
107
|
+
export interface DeleteRequest {
|
|
108
|
+
endpoint: string;
|
|
109
|
+
contentId: string;
|
|
110
|
+
}
|
|
89
111
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check object
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @
|
|
4
|
+
* @param {unknown} value
|
|
5
|
+
* @returns {boolean}
|
|
6
6
|
*/
|
|
7
|
-
export declare const isObject:
|
|
7
|
+
export declare const isObject: (value: unknown) => value is Record<string, unknown>;
|
|
8
8
|
/**
|
|
9
9
|
* Check string
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
12
|
-
* @
|
|
11
|
+
* @param {unknown} value
|
|
12
|
+
* @returns {boolean}
|
|
13
13
|
*/
|
|
14
|
-
export declare const isString: (value:
|
|
14
|
+
export declare const isString: (value: unknown) => value is string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent } from './types';
|
|
1
|
+
import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, WriteApiRequestResult, CreateRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent, UpdateRequest, DeleteRequest } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Initialize SDK Client
|
|
4
4
|
*/
|
|
@@ -7,4 +7,7 @@ export declare const createClient: ({ serviceDomain, apiKey }: MicroCMSClient) =
|
|
|
7
7
|
getList: <T_1 = any>({ endpoint, queries, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
|
|
8
8
|
getListDetail: <T_2 = any>({ endpoint, contentId, queries, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
|
|
9
9
|
getObject: <T_3 = any>({ endpoint, queries, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
|
|
10
|
+
create: <T_4 extends Record<string | number, any>>({ endpoint, contentId, content, isDraft, }: CreateRequest<T_4>) => Promise<WriteApiRequestResult>;
|
|
11
|
+
update: <T_5 extends Record<string | number, any>>({ endpoint, contentId, content, }: UpdateRequest<T_5>) => Promise<WriteApiRequestResult>;
|
|
12
|
+
delete: ({ endpoint, contentId, }: DeleteRequest) => Promise<void>;
|
|
10
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"node-fetch";import
|
|
1
|
+
import e from"node-fetch";import n from"qs";
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -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 n(e,r,n,t){return new(
|
|
15
|
+
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,u)}a((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;c;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=n.call(e,c)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var i=function(e){return"string"==typeof e},c=function(c){var u=c.serviceDomain,a=c.apiKey;if(!u||!a)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!i(u)||!i(a))throw new Error("parameter is not string");var s="https://".concat(u,".").concat("microcms.io","/api/").concat("v1"),d=function(i){var c=i.endpoint,u=i.contentId,d=i.queries,f=void 0===d?{}:d,p=i.method,l=i.customHeaders,v=i.customBody;return r(void 0,void 0,void 0,(function(){var r,i,d,h,m,w;return o(this,(function(o){switch(o.label){case 0:r=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return n.stringify(e,{arrayFormat:"comma"})}(f),i={headers:t(t({},l),{"X-MICROCMS-API-KEY":a}),body:v,method:p},d="".concat(s,"/").concat(c).concat(u?"/".concat(u):"").concat(r?"?".concat(r):""),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e(d,i)];case 2:if(!(h=o.sent()).ok)throw new Error("fetch API response status: ".concat(h.status));return"DELETE"===p?[2]:[2,h.json()];case 3:if((m=o.sent()).data)throw m.data;if(null===(w=m.response)||void 0===w?void 0:w.data)throw m.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(m)))];case 4:return[2]}}))}))};return{get:function(e){var n=e.endpoint,t=e.contentId,i=e.queries,c=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,contentId:t,queries:c})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var n=e.endpoint,t=e.queries,i=void 0===t?{}:t;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var n=e.endpoint,t=e.contentId,i=e.queries,c=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,contentId:t,queries:c})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var n=e.endpoint,t=e.queries,i=void 0===t?{}:t;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?[4,d({endpoint:n,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var n=e.endpoint,t=e.contentId,i=e.content,c=e.isDraft,u=void 0!==c&&c;return r(void 0,void 0,void 0,(function(){var e,r,c,a;return o(this,(function(o){return n?(e=u?{status:"draft"}:{},r=t?"PUT":"POST",c={"Content-Type":"application/json"},a=JSON.stringify(i),[2,d({endpoint:n,contentId:t,queries:e,method:r,customHeaders:c,customBody:a})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var n=e.endpoint,t=e.contentId,i=e.content;return r(void 0,void 0,void 0,(function(){var e,r;return o(this,(function(o){return n?("PATCH",e={"Content-Type":"application/json"},r=JSON.stringify(i),[2,d({endpoint:n,contentId:t,method:"PATCH",customHeaders:e,customBody:r})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var n=e.endpoint,t=e.contentId;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return n?t?("DELETE",[4,d({endpoint:n,contentId:t,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}};export{c as createClient};
|
|
16
16
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWljcm9jbXMtanMtc2RrLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7In0=
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BodyInit, HeadersInit } from 'node-fetch';
|
|
1
2
|
/**
|
|
2
3
|
* microCMS createClient params
|
|
3
4
|
*/
|
|
@@ -35,8 +36,8 @@ export interface MicroCMSContentId {
|
|
|
35
36
|
export interface MicroCMSDate {
|
|
36
37
|
createdAt: string;
|
|
37
38
|
updatedAt: string;
|
|
38
|
-
publishedAt
|
|
39
|
-
revisedAt
|
|
39
|
+
publishedAt?: string;
|
|
40
|
+
revisedAt?: string;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* microCMS image
|
|
@@ -66,7 +67,10 @@ export declare type MicroCMSObjectContent = MicroCMSDate;
|
|
|
66
67
|
export interface MakeRequest {
|
|
67
68
|
endpoint: string;
|
|
68
69
|
contentId?: string;
|
|
69
|
-
queries?: MicroCMSQueries
|
|
70
|
+
queries?: MicroCMSQueries & Record<string, any>;
|
|
71
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
72
|
+
customHeaders?: HeadersInit;
|
|
73
|
+
customBody?: BodyInit;
|
|
70
74
|
}
|
|
71
75
|
export interface GetRequest {
|
|
72
76
|
endpoint: string;
|
|
@@ -86,4 +90,22 @@ export interface GetObjectRequest {
|
|
|
86
90
|
endpoint: string;
|
|
87
91
|
queries?: MicroCMSQueries;
|
|
88
92
|
}
|
|
93
|
+
export interface WriteApiRequestResult {
|
|
94
|
+
id: string;
|
|
95
|
+
}
|
|
96
|
+
export interface CreateRequest<T> {
|
|
97
|
+
endpoint: string;
|
|
98
|
+
contentId?: string;
|
|
99
|
+
content: T;
|
|
100
|
+
isDraft?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface UpdateRequest<T> {
|
|
103
|
+
endpoint: string;
|
|
104
|
+
contentId?: string;
|
|
105
|
+
content: Partial<T>;
|
|
106
|
+
}
|
|
107
|
+
export interface DeleteRequest {
|
|
108
|
+
endpoint: string;
|
|
109
|
+
contentId: string;
|
|
110
|
+
}
|
|
89
111
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check object
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @
|
|
4
|
+
* @param {unknown} value
|
|
5
|
+
* @returns {boolean}
|
|
6
6
|
*/
|
|
7
|
-
export declare const isObject:
|
|
7
|
+
export declare const isObject: (value: unknown) => value is Record<string, unknown>;
|
|
8
8
|
/**
|
|
9
9
|
* Check string
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
12
|
-
* @
|
|
11
|
+
* @param {unknown} value
|
|
12
|
+
* @returns {boolean}
|
|
13
13
|
*/
|
|
14
|
-
export declare const isString: (value:
|
|
14
|
+
export declare const isString: (value: unknown) => value is string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent } from './types';
|
|
1
|
+
import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, WriteApiRequestResult, CreateRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent, UpdateRequest, DeleteRequest } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Initialize SDK Client
|
|
4
4
|
*/
|
|
@@ -7,4 +7,7 @@ export declare const createClient: ({ serviceDomain, apiKey }: MicroCMSClient) =
|
|
|
7
7
|
getList: <T_1 = any>({ endpoint, queries, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
|
|
8
8
|
getListDetail: <T_2 = any>({ endpoint, contentId, queries, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
|
|
9
9
|
getObject: <T_3 = any>({ endpoint, queries, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
|
|
10
|
+
create: <T_4 extends Record<string | number, any>>({ endpoint, contentId, content, isDraft, }: CreateRequest<T_4>) => Promise<WriteApiRequestResult>;
|
|
11
|
+
update: <T_5 extends Record<string | number, any>>({ endpoint, contentId, content, }: UpdateRequest<T_5>) => Promise<WriteApiRequestResult>;
|
|
12
|
+
delete: ({ endpoint, contentId, }: DeleteRequest) => Promise<void>;
|
|
10
13
|
};
|
|
@@ -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={},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,""")}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})}));
|
|
15
|
+
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{p(n.next(e))}catch(e){i(e)}}function c(e){try{p(n.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}p((n=n.apply(e,t||[])).next())}))}function n(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var i={exports:{}};!function(e,t){var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}(i,i.exports);var a,c=i.exports,p="undefined"!=typeof Symbol&&Symbol,u=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0},f="Function.prototype.bind called on incompatible ",l=Array.prototype.slice,y=Object.prototype.toString,s="[object Function]",d=function(e){var t=this;if("function"!=typeof t||y.call(t)!==s)throw new TypeError(f+t);for(var r,n=l.call(arguments,1),o=function(){if(this instanceof r){var o=t.apply(this,n.concat(l.call(arguments)));return Object(o)===o?o:this}return t.apply(e,n.concat(l.call(arguments)))},i=Math.max(0,t.length-n.length),a=[],c=0;c<i;c++)a.push("$"+c);if(r=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r},b=Function.prototype.bind||d,h=b.call(Function.call,Object.prototype.hasOwnProperty),m=SyntaxError,g=Function,v=TypeError,j=function(e){try{return g('"use strict"; return ('+e+").constructor;")()}catch(e){}},S=Object.getOwnPropertyDescriptor;if(S)try{S({},"")}catch(e){S=null}var w=function(){throw new v},O=S?function(){try{return w}catch(e){try{return S(arguments,"callee").get}catch(e){return w}}}():w,P="function"==typeof p&&"function"==typeof Symbol&&"symbol"==typeof p("foo")&&"symbol"==typeof Symbol("bar")&&u(),A=Object.getPrototypeOf||function(e){return e.__proto__},E={},x="undefined"==typeof Uint8Array?a:A(Uint8Array),I={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":P?A([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":E,"%AsyncGenerator%":E,"%AsyncGeneratorFunction%":E,"%AsyncIteratorPrototype%":E,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":E,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":P?A(A([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&P?A((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&P?A((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P?A(""[Symbol.iterator]()):a,"%Symbol%":P?Symbol:a,"%SyntaxError%":m,"%ThrowTypeError%":O,"%TypedArray%":x,"%TypeError%":v,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},k=function e(t){var r;if("%AsyncFunction%"===t)r=j("async function () {}");else if("%GeneratorFunction%"===t)r=j("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=j("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=A(o.prototype))}return I[t]=r,r},F={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},R=b,N=h,D=R.call(Function.call,Array.prototype.concat),M=R.call(Function.apply,Array.prototype.splice),T=R.call(Function.call,String.prototype.replace),U=R.call(Function.call,String.prototype.slice),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,q=/\\(\\)?/g,_=function(e){var t=U(e,0,1),r=U(e,-1);if("%"===t&&"%"!==r)throw new m("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new m("invalid intrinsic syntax, expected opening `%`");var n=[];return T(e,C,(function(e,t,r,o){n[n.length]=r?T(o,q,"$1"):t||e})),n},B=function(e,t){var r,n=e;if(N(F,n)&&(n="%"+(r=F[n])[0]+"%"),N(I,n)){var o=I[n];if(o===E&&(o=k(n)),void 0===o&&!t)throw new v("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new m("intrinsic "+e+" does not exist!")},L=function(e,t){if("string"!=typeof e||0===e.length)throw new v("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new v('"allowMissing" argument must be a boolean');var r=_(e),n=r.length>0?r[0]:"",o=B("%"+n+"%",t),i=o.name,a=o.value,c=!1,p=o.alias;p&&(n=p[0],M(r,D([0,1],p)));for(var u=1,f=!0;u<r.length;u+=1){var l=r[u],y=U(l,0,1),s=U(l,-1);if(('"'===y||"'"===y||"`"===y||'"'===s||"'"===s||"`"===s)&&y!==s)throw new m("property names with quotes must have matching quotes");if("constructor"!==l&&f||(c=!0),N(I,i="%"+(n+="."+l)+"%"))a=I[i];else if(null!=a){if(!(l in a)){if(!t)throw new v("base intrinsic for "+e+" exists, but the property is not available.");return}if(S&&u+1>=r.length){var d=S(a,l);a=(f=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[l]}else f=N(a,l),a=a[l];f&&!c&&(I[i]=a)}}return a},W={exports:{}};!function(e){var t=b,r=L,n=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||t.call(o,n),a=r("%Object.getOwnPropertyDescriptor%",!0),c=r("%Object.defineProperty%",!0),p=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var r=i(t,o,arguments);if(a&&c){var n=a(r,"length");n.configurable&&c(r,"length",{value:1+p(0,e.length-(arguments.length-1))})}return r};var u=function(){return i(t,n,arguments)};c?c(e.exports,"apply",{value:u}):e.exports.apply=u}(W);var H=L,G=W.exports,z=G(H("String.prototype.indexOf")),V=o(Object.freeze({__proto__:null,default:{}})),Q="function"==typeof Map&&Map.prototype,J=Object.getOwnPropertyDescriptor&&Q?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$=Q&&J&&"function"==typeof J.get?J.get:null,K=Q&&Map.prototype.forEach,X="function"==typeof Set&&Set.prototype,Y=Object.getOwnPropertyDescriptor&&X?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Z=X&&Y&&"function"==typeof Y.get?Y.get:null,ee=X&&Set.prototype.forEach,te="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,re="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,ne="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,oe=Boolean.prototype.valueOf,ie=Object.prototype.toString,ae=Function.prototype.toString,ce=String.prototype.match,pe="function"==typeof BigInt?BigInt.prototype.valueOf:null,ue=Object.getOwnPropertySymbols,fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,le=Object.prototype.propertyIsEnumerable,ye=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),se=V.custom,de=se&&ve(se)?se:null,be="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag?Symbol.toStringTag:null;function he(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function me(e){return String(e).replace(/"/g,""")}function ge(e){return!("[object Array]"!==we(e)||be&&"object"==typeof e&&be in e)}function ve(e){if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!fe)return!1;try{return fe.call(e),!0}catch(e){}return!1}var je=Object.prototype.hasOwnProperty||function(e){return e in this};function Se(e,t){return je.call(e,t)}function we(e){return ie.call(e)}function Oe(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function Pe(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Pe(e.slice(0,t.maxStringLength),t)+n}return he(e.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,Ae),"single",t)}function Ae(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+t.toString(16).toUpperCase()}function Ee(e){return"Object("+e+")"}function xe(e){return e+" { ? }"}function Ie(e,t,r,n){return e+" ("+t+") {"+(n?ke(r,n):r.join(", "))+"}"}function ke(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+e.join(","+r)+"\n"+t.prev}function Fe(e,t){var r=ge(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=Se(e,o)?t(e[o],e):""}for(var i in e)Se(e,i)&&(r&&String(Number(i))===i&&i<e.length||(/[^\w$]/.test(i)?n.push(t(i,e)+": "+t(e[i],e)):n.push(i+": "+t(e[i],e))));if("function"==typeof ue)for(var a=ue(e),c=0;c<a.length;c++)le.call(e,a[c])&&n.push("["+t(a[c])+"]: "+t(e[a[c]],e));return n}var Re=L,Ne=function(e,t){var r=H(e,!!t);return"function"==typeof r&&z(e,".prototype.")>-1?G(r):r},De=function e(t,r,n,o){var i=r||{};if(Se(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Se(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&i.maxStringLength!==1/0:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!Se(i,"customInspect")||i.customInspect;if("boolean"!=typeof a)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(Se(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return Pe(t,i);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var c=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=c&&c>0&&"object"==typeof t)return ge(t)?"[Array]":"[Object]";var p=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=Array(e.indent+1).join(" ")}return{base:r,prev:Array(t+1).join(r)}}(i,n);if(void 0===o)o=[];else if(Oe(o,t)>=0)return"[Circular]";function u(t,r,a){if(r&&(o=o.slice()).push(r),a){var c={depth:i.depth};return Se(i,"quoteStyle")&&(c.quoteStyle=i.quoteStyle),e(t,c,n+1,o)}return e(t,i,n+1,o)}if("function"==typeof t){var f=function(e){if(e.name)return e.name;var t=ce.call(ae.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),l=Fe(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(ve(t)){var y=fe.call(t);return"object"==typeof t?Ee(y):y}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var s="<"+String(t.nodeName).toLowerCase(),d=t.attributes||[],b=0;b<d.length;b++)s+=" "+d[b].name+"="+he(me(d[b].value),"double",i);return s+=">",t.childNodes&&t.childNodes.length&&(s+="..."),s+="</"+String(t.nodeName).toLowerCase()+">"}if(ge(t)){if(0===t.length)return"[]";var h=Fe(t,u);return p&&!function(e){for(var t=0;t<e.length;t++)if(Oe(e[t],"\n")>=0)return!1;return!0}(h)?"["+ke(h,p)+"]":"[ "+h.join(", ")+" ]"}if(function(e){return!("[object Error]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)){var m=Fe(t,u);return 0===m.length?"["+String(t)+"]":"{ ["+String(t)+"] "+m.join(", ")+" }"}if("object"==typeof t&&a){if(de&&"function"==typeof t[de])return t[de]();if("function"==typeof t.inspect)return t.inspect()}if(function(e){if(!$||!e||"object"!=typeof e)return!1;try{$.call(e);try{Z.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var g=[];return K.call(t,(function(e,r){g.push(u(r,t,!0)+" => "+u(e,t))})),Ie("Map",$.call(t),g,p)}if(function(e){if(!Z||!e||"object"!=typeof e)return!1;try{Z.call(e);try{$.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var v=[];return ee.call(t,(function(e){v.push(u(e,t))})),Ie("Set",Z.call(t),v,p)}if(function(e){if(!te||!e||"object"!=typeof e)return!1;try{te.call(e,te);try{re.call(e,re)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return xe("WeakMap");if(function(e){if(!re||!e||"object"!=typeof e)return!1;try{re.call(e,re);try{te.call(e,te)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return xe("WeakSet");if(function(e){if(!ne||!e||"object"!=typeof e)return!1;try{return ne.call(e),!0}catch(e){}return!1}(t))return xe("WeakRef");if(function(e){return!("[object Number]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(u(Number(t)));if(function(e){if(!e||"object"!=typeof e||!pe)return!1;try{return pe.call(e),!0}catch(e){}return!1}(t))return Ee(u(pe.call(t)));if(function(e){return!("[object Boolean]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(oe.call(t));if(function(e){return!("[object String]"!==we(e)||be&&"object"==typeof e&&be in e)}(t))return Ee(u(String(t)));if(!function(e){return!("[object Date]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)&&!function(e){return!("[object RegExp]"!==we(e)||be&&"object"==typeof e&&be in e)}(t)){var j=Fe(t,u),S=ye?ye(t)===Object.prototype:t instanceof Object||t.constructor===Object,w=t instanceof Object?"":"null prototype",O=!S&&be&&Object(t)===t&&be in t?we(t).slice(8,-1):w?"Object":"",P=(S||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(O||w?"["+[].concat(O||[],w||[]).join(": ")+"] ":"");return 0===j.length?P+"{}":p?P+"{"+ke(j,p)+"}":P+"{ "+j.join(", ")+" }"}return String(t)},Me=Re("%TypeError%"),Te=Re("%WeakMap%",!0),Ue=Re("%Map%",!0),Ce=Ne("WeakMap.prototype.get",!0),qe=Ne("WeakMap.prototype.set",!0),_e=Ne("WeakMap.prototype.has",!0),Be=Ne("Map.prototype.get",!0),Le=Ne("Map.prototype.set",!0),We=Ne("Map.prototype.has",!0),He=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r},Ge=String.prototype.replace,ze=/%20/g,Ve="RFC3986",Qe={default:Ve,formatters:{RFC1738:function(e){return Ge.call(e,ze,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:Ve},Je=Qe,$e=Object.prototype.hasOwnProperty,Ke=Array.isArray,Xe=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),Ye=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},Ze={arrayToObject:Ye,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],i=o.obj[o.prop],a=Object.keys(i),c=0;c<a.length;++c){var p=a[c],u=i[p];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:i,prop:p}),r.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Ke(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,n,o){if(0===e.length)return e;var i=e;if("symbol"==typeof e?i=Symbol.prototype.toString.call(e):"string"!=typeof e&&(i=String(e)),"iso-8859-1"===r)return escape(i).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var a="",c=0;c<i.length;++c){var p=i.charCodeAt(c);45===p||46===p||95===p||126===p||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===Je.RFC1738&&(40===p||41===p)?a+=i.charAt(c):p<128?a+=Xe[p]:p<2048?a+=Xe[192|p>>6]+Xe[128|63&p]:p<55296||p>=57344?a+=Xe[224|p>>12]+Xe[128|p>>6&63]+Xe[128|63&p]:(c+=1,p=65536+((1023&p)<<10|1023&i.charCodeAt(c)),a+=Xe[240|p>>18]+Xe[128|p>>12&63]+Xe[128|p>>6&63]+Xe[128|63&p])}return a},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(Ke(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(Ke(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!$e.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return Ke(t)&&!Ke(r)&&(o=Ye(t,n)),Ke(t)&&Ke(r)?(r.forEach((function(r,o){if($e.call(t,o)){var i=t[o];i&&"object"==typeof i&&r&&"object"==typeof r?t[o]=e(i,r,n):t.push(r)}else t[o]=r})),t):Object.keys(r).reduce((function(t,o){var i=r[o];return $e.call(t,o)?t[o]=e(t[o],i,n):t[o]=i,t}),o)}},et=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new Me("Side channel does not contain "+De(e))},get:function(n){if(Te&&n&&("object"==typeof n||"function"==typeof n)){if(e)return Ce(e,n)}else if(Ue){if(t)return Be(t,n)}else if(r)return function(e,t){var r=He(e,t);return r&&r.value}(r,n)},has:function(n){if(Te&&n&&("object"==typeof n||"function"==typeof n)){if(e)return _e(e,n)}else if(Ue){if(t)return We(t,n)}else if(r)return function(e,t){return!!He(e,t)}(r,n);return!1},set:function(n,o){Te&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new Te),qe(e,n,o)):Ue?(t||(t=new Ue),Le(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=He(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n},tt=Ze,rt=Qe,nt=Object.prototype.hasOwnProperty,ot={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},it=Array.isArray,at=Array.prototype.push,ct=function(e,t){at.apply(e,it(t)?t:[t])},pt=Date.prototype.toISOString,ut=rt.default,ft={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:tt.encode,encodeValuesOnly:!1,format:ut,formatter:rt.formatters[ut],indices:!1,serializeDate:function(e){return pt.call(e)},skipNulls:!1,strictNullHandling:!1},lt=function e(t,r,n,o,i,a,c,p,u,f,l,y,s,d,b){var h,m=t;if(b.has(t))throw new RangeError("Cyclic object value");if("function"==typeof c?m=c(r,m):m instanceof Date?m=f(m):"comma"===n&&it(m)&&(m=tt.maybeMap(m,(function(e){return e instanceof Date?f(e):e}))),null===m){if(o)return a&&!s?a(r,ft.encoder,d,"key",l):r;m=""}if("string"==typeof(h=m)||"number"==typeof h||"boolean"==typeof h||"symbol"==typeof h||"bigint"==typeof h||tt.isBuffer(m))return a?[y(s?r:a(r,ft.encoder,d,"key",l))+"="+y(a(m,ft.encoder,d,"value",l))]:[y(r)+"="+y(String(m))];var g,v=[];if(void 0===m)return v;if("comma"===n&&it(m))g=[{value:m.length>0?m.join(",")||null:void 0}];else if(it(c))g=c;else{var j=Object.keys(m);g=p?j.sort(p):j}for(var S=0;S<g.length;++S){var w=g[S],O="object"==typeof w&&void 0!==w.value?w.value:m[w];if(!i||null!==O){var P=it(m)?"function"==typeof n?n(r,w):r:r+(u?"."+w:"["+w+"]");b.set(t,!0);var A=et();ct(v,e(O,P,n,o,i,a,c,p,u,f,l,y,s,d,A))}}return v},yt=Ze,st=Object.prototype.hasOwnProperty,dt=Array.isArray,bt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:yt.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},ht=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},mt=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},gt=function(e,t,r,n){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(o),c=a?o.slice(0,a.index):o,p=[];if(c){if(!r.plainObjects&&st.call(Object.prototype,c)&&!r.allowPrototypes)return;p.push(c)}for(var u=0;r.depth>0&&null!==(a=i.exec(o))&&u<r.depth;){if(u+=1,!r.plainObjects&&st.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(a[1])}return a&&p.push("["+o.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:mt(t,r),i=e.length-1;i>=0;--i){var a,c=e[i];if("[]"===c&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var p="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,u=parseInt(p,10);r.parseArrays||""!==p?!isNaN(u)&&c!==p&&String(u)===p&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(a=[])[u]=o:a[p]=o:a={0:o}}o=a}return o}(p,t,r,n)}},vt={formats:Qe,parse:function(e,t){var r=function(e){if(!e)return bt;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?bt.charset:e.charset;return{allowDots:void 0===e.allowDots?bt.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:bt.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:bt.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:bt.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:bt.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:bt.comma,decoder:"function"==typeof e.decoder?e.decoder:bt.decoder,delimiter:"string"==typeof e.delimiter||yt.isRegExp(e.delimiter)?e.delimiter:bt.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:bt.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:bt.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:bt.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:bt.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:bt.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var n="string"==typeof e?function(e,t){var r,n={},o=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=o.split(t.delimiter,i),c=-1,p=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?p="utf-8":"utf8=%26%2310003%3B"===a[r]&&(p="iso-8859-1"),c=r,r=a.length);for(r=0;r<a.length;++r)if(r!==c){var u,f,l=a[r],y=l.indexOf("]="),s=-1===y?l.indexOf("="):y+1;-1===s?(u=t.decoder(l,bt.decoder,p,"key"),f=t.strictNullHandling?null:""):(u=t.decoder(l.slice(0,s),bt.decoder,p,"key"),f=yt.maybeMap(mt(l.slice(s+1),t),(function(e){return t.decoder(e,bt.decoder,p,"value")}))),f&&t.interpretNumericEntities&&"iso-8859-1"===p&&(f=ht(f)),l.indexOf("[]=")>-1&&(f=dt(f)?[f]:f),st.call(n,u)?n[u]=yt.combine(n[u],f):n[u]=f}return n}(e,r):e,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var c=i[a],p=gt(c,n[c],r,"string"==typeof e);o=yt.merge(o,p,r)}return!0===r.allowSparse?o:yt.compact(o)},stringify:function(e,t){var r,n=e,o=function(e){if(!e)return ft;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||ft.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=rt.default;if(void 0!==e.format){if(!nt.call(rt.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=rt.formatters[r],o=ft.filter;return("function"==typeof e.filter||it(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:ft.addQueryPrefix,allowDots:void 0===e.allowDots?ft.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:ft.charsetSentinel,delimiter:void 0===e.delimiter?ft.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:ft.encode,encoder:"function"==typeof e.encoder?e.encoder:ft.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:ft.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:ft.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:ft.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:ft.strictNullHandling}}(t);"function"==typeof o.filter?n=(0,o.filter)("",n):it(o.filter)&&(r=o.filter);var i,a=[];if("object"!=typeof n||null===n)return"";i=t&&t.arrayFormat in ot?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var c=ot[i];r||(r=Object.keys(n)),o.sort&&r.sort(o.sort);for(var p=et(),u=0;u<r.length;++u){var f=r[u];o.skipNulls&&null===n[f]||ct(a,lt(n[f],f,c,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset,p))}var l=a.join(o.delimiter),y=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),l.length>0?y+l:""}},jt=function(e){return"string"==typeof e};e.createClient=function(e){var o=e.serviceDomain,i=e.apiKey;if(!o||!i)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!jt(o)||!jt(i))throw new Error("parameter is not string");var a="https://".concat(o,".").concat("microcms.io","/api/").concat("v1"),p=function(e){var o=e.endpoint,p=e.contentId,u=e.queries,f=void 0===u?{}:u,l=e.method,y=e.customHeaders,s=e.customBody;return r(void 0,void 0,void 0,(function(){var e,r,u,d,b,h;return n(this,(function(n){switch(n.label){case 0:e=function(e){if(null===(t=e)||"object"!=typeof t)throw new Error("queries is not object");var t;return vt.stringify(e,{arrayFormat:"comma"})}(f),r={headers:t(t({},y),{"X-MICROCMS-API-KEY":i}),body:s,method:l},u="".concat(a,"/").concat(o).concat(p?"/".concat(p):"").concat(e?"?".concat(e):""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,c(u,r)];case 2:if(!(d=n.sent()).ok)throw new Error("fetch API response status: ".concat(d.status));return"DELETE"===l?[2]:[2,d.json()];case 3:if((b=n.sent()).data)throw b.data;if(null===(h=b.response)||void 0===h?void 0:h.data)throw b.response.data;return[2,Promise.reject(new Error("serviceDomain or endpoint may be wrong.\n Details: ".concat(b)))];case 4:return[2]}}))}))};return{get:function(e){var t=e.endpoint,o=e.contentId,i=e.queries,a=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,contentId:o,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getList:function(e){var t=e.endpoint,o=e.queries,i=void 0===o?{}:o;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getListDetail:function(e){var t=e.endpoint,o=e.contentId,i=e.queries,a=void 0===i?{}:i;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,contentId:o,queries:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},getObject:function(e){var t=e.endpoint,o=e.queries,i=void 0===o?{}:o;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?[4,p({endpoint:t,queries:i})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,e.sent()]}}))}))},create:function(e){var t=e.endpoint,o=e.contentId,i=e.content,a=e.isDraft,c=void 0!==a&&a;return r(void 0,void 0,void 0,(function(){var e,r,a,u;return n(this,(function(n){return t?(e=c?{status:"draft"}:{},r=o?"PUT":"POST",a={"Content-Type":"application/json"},u=JSON.stringify(i),[2,p({endpoint:t,contentId:o,queries:e,method:r,customHeaders:a,customBody:u})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(e){var t=e.endpoint,o=e.contentId,i=e.content;return r(void 0,void 0,void 0,(function(){var e,r;return n(this,(function(n){return t?("PATCH",e={"Content-Type":"application/json"},r=JSON.stringify(i),[2,p({endpoint:t,contentId:o,method:"PATCH",customHeaders:e,customBody:r})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(e){var t=e.endpoint,o=e.contentId;return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t?o?("DELETE",[4,p({endpoint:t,contentId:o,method:"DELETE"})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return e.sent(),[2]}}))}))}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/dist/umd/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BodyInit, HeadersInit } from 'node-fetch';
|
|
1
2
|
/**
|
|
2
3
|
* microCMS createClient params
|
|
3
4
|
*/
|
|
@@ -35,8 +36,8 @@ export interface MicroCMSContentId {
|
|
|
35
36
|
export interface MicroCMSDate {
|
|
36
37
|
createdAt: string;
|
|
37
38
|
updatedAt: string;
|
|
38
|
-
publishedAt
|
|
39
|
-
revisedAt
|
|
39
|
+
publishedAt?: string;
|
|
40
|
+
revisedAt?: string;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* microCMS image
|
|
@@ -66,7 +67,10 @@ export declare type MicroCMSObjectContent = MicroCMSDate;
|
|
|
66
67
|
export interface MakeRequest {
|
|
67
68
|
endpoint: string;
|
|
68
69
|
contentId?: string;
|
|
69
|
-
queries?: MicroCMSQueries
|
|
70
|
+
queries?: MicroCMSQueries & Record<string, any>;
|
|
71
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
72
|
+
customHeaders?: HeadersInit;
|
|
73
|
+
customBody?: BodyInit;
|
|
70
74
|
}
|
|
71
75
|
export interface GetRequest {
|
|
72
76
|
endpoint: string;
|
|
@@ -86,4 +90,22 @@ export interface GetObjectRequest {
|
|
|
86
90
|
endpoint: string;
|
|
87
91
|
queries?: MicroCMSQueries;
|
|
88
92
|
}
|
|
93
|
+
export interface WriteApiRequestResult {
|
|
94
|
+
id: string;
|
|
95
|
+
}
|
|
96
|
+
export interface CreateRequest<T> {
|
|
97
|
+
endpoint: string;
|
|
98
|
+
contentId?: string;
|
|
99
|
+
content: T;
|
|
100
|
+
isDraft?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface UpdateRequest<T> {
|
|
103
|
+
endpoint: string;
|
|
104
|
+
contentId?: string;
|
|
105
|
+
content: Partial<T>;
|
|
106
|
+
}
|
|
107
|
+
export interface DeleteRequest {
|
|
108
|
+
endpoint: string;
|
|
109
|
+
contentId: string;
|
|
110
|
+
}
|
|
89
111
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check object
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @
|
|
4
|
+
* @param {unknown} value
|
|
5
|
+
* @returns {boolean}
|
|
6
6
|
*/
|
|
7
|
-
export declare const isObject:
|
|
7
|
+
export declare const isObject: (value: unknown) => value is Record<string, unknown>;
|
|
8
8
|
/**
|
|
9
9
|
* Check string
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
12
|
-
* @
|
|
11
|
+
* @param {unknown} value
|
|
12
|
+
* @returns {boolean}
|
|
13
13
|
*/
|
|
14
|
-
export declare const isString: (value:
|
|
14
|
+
export declare const isString: (value: unknown) => value is string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "microcms-js-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
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",
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "rollup -c",
|
|
23
23
|
"lint": "eslint ./src",
|
|
24
|
-
"lint:fix": "eslint --fix ./src"
|
|
24
|
+
"lint:fix": "eslint --fix ./src",
|
|
25
|
+
"test": "jest --coverage=false",
|
|
26
|
+
"test:coverage": "jest --coverage=true"
|
|
25
27
|
},
|
|
26
28
|
"files": [
|
|
27
29
|
"dist"
|
|
@@ -35,6 +37,7 @@
|
|
|
35
37
|
"@rollup/plugin-commonjs": "^19.0.0",
|
|
36
38
|
"@rollup/plugin-json": "^4.1.0",
|
|
37
39
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
40
|
+
"@types/jest": "^28.1.6",
|
|
38
41
|
"@types/node": "^15.0.2",
|
|
39
42
|
"@types/node-fetch": "^2.5.10",
|
|
40
43
|
"@types/qs": "^6.9.6",
|
|
@@ -45,12 +48,16 @@
|
|
|
45
48
|
"eslint-config-prettier": "^8.3.0",
|
|
46
49
|
"eslint-config-standard": "^16.0.2",
|
|
47
50
|
"eslint-plugin-import": "^2.22.1",
|
|
51
|
+
"eslint-plugin-jest": "^26.6.0",
|
|
48
52
|
"eslint-plugin-node": "^11.1.0",
|
|
49
53
|
"eslint-plugin-standard": "^5.0.0",
|
|
54
|
+
"jest": "^28.1.3",
|
|
55
|
+
"msw": "^0.44.2",
|
|
50
56
|
"prettier": "^2.2.1",
|
|
51
57
|
"rollup": "^2.47.0",
|
|
52
58
|
"rollup-plugin-terser": "^7.0.2",
|
|
53
59
|
"rollup-plugin-typescript2": "^0.30.0",
|
|
54
|
-
"
|
|
60
|
+
"ts-jest": "^28.0.7",
|
|
61
|
+
"typescript": "^4.7.4"
|
|
55
62
|
}
|
|
56
|
-
}
|
|
63
|
+
}
|