최한솔

modify files

Showing 59 changed files with 0 additions and 11462 deletions
1 -const express = require('express');
2 -const line = require('@line/bot-sdk');
3 -
4 -const config = {
5 - channelAccessToken: 'L+RJ15lZgeSoWgeHf9BqgEhm8lYh11qALzPlDV85VGXHfmiKqj3CX1V9DvqakFeJqwWgfQRejsUIWqf/kJuTLQcRC5ws2pyJJbr0VFEXptoYicgiRDzuA51W91dTcFL6/olvLNS1zAf1xO2wxpTGvQdB04t89/1O/w1cDnyilFU=',
6 - channelSecret: 'e8e139b4cf31d22ed234d62a9b336e74'
7 -};
8 -
9 -const app = express();
10 -<<<<<<< HEAD
11 -app.post('/webhook', line.middleware(config), (req, res) => {
12 - Promise
13 - .all(req.body.events.map(handleEvent))
14 - .then((result) => res.json(result));
15 -});
16 -
17 -const client = new line.Client(config);
18 -function handleEvent(event) {
19 - if (event.type !== 'message' || event.message.type !== 'text') {
20 - return Promise.resolve(null);
21 - }
22 -
23 - return client.replyMessage(event.replyToken, {
24 - type: 'text',
25 - text: event.message.text
26 - });
27 -}
28 -
29 -app.listen(3000);
30 -/*
31 -var express = require('express');
32 -var app = express();
33 -const line = require('@line/bot-sdk');
34 -
35 -const config = {
36 - channelAccessToken: 'L+RJ15lZgeSoWgeHf9BqgEhm8lYh11qALzPlDV85VGXHfmiKqj3CX1V9DvqakFeJqwWgfQRejsUIWqf/kJuTLQcRC5ws2pyJJbr0VFEXptoYicgiRDzuA51W91dTcFL6/olvLNS1zAf1xO2wxpTGvQdB04t89/1O/w1cDnyilFU=',
37 - channelSecret: 'e8e139b4cf31d22ed234d62a9b336e74',
38 -};
39 -
40 -<<<<<<< HEAD
41 -const app = express();
42 -=======
43 ->>>>>>> 5c3493c34733e95cc8b593c61c6fbeefcc069682
44 -app.post('https://bots.dialogflow.com/line/d1584d25-0e52-48da-b6cc-20e021dc5e70/webhook', line.middleware(config), (req,res)=>{
45 - promise
46 - .all(req.body.events.map(handleEvent))
47 - .then((result)=>res.json(result));
48 -});
49 -
50 -const clinet = new line.Client(config);
51 -function handleEvent(event){
52 - if(event.type !== 'message' || event.message.type != 'text'){
53 - return Promise.resolve(null);
54 - }
55 -
56 - return client.replyMessage(event.replyToken,{
57 - type:'text',
58 - text: event.message.text
59 - });
60 -}
61 -<<<<<<< HEAD
62 -=======
63 -
64 -// create LINE SDK client
65 -const client = new line.Client(config);
66 -
67 -// create Express app
68 -// about Express itself: https://expressjs.com/
69 -
70 -// register a webhook handler with middleware
71 -// about the middleware, please refer to doc
72 -app.post('https://mylinebottest1.herokuapp.com/callback', line.middleware(config), (req, res) => {
73 - Promise
74 - .all(req.body.events.map(handleEvent))
75 - .then((result) => res.json(result))
76 - .catch((err) => { //error handling
77 - console.error(err);
78 - res.status(200).end();
79 - });
80 -});
81 -
82 -// event handler
83 -function handleEvent(event) {
84 - if (event.type !== 'message' || event.message.type !== 'text') {
85 - // ignore non-text-message event
86 - return Promise.resolve(null);
87 - }
88 - return new Promise(function (resolve, reject) {
89 - //내가 짠 것
90 - function getup(shour, smin, ampm) {//몇시에 자려고 할 때 언제 일어나면 좋을지
91 - if (shour != '(hour)' && smin != '(minute)') {
92 - //; //탈출
93 - var setTime = new Date();
94 -
95 - if (shour == 12) {
96 - shour = 0;
97 - }
98 -
99 - if (ampm == "AM") {
100 - setTime.setHours(shour);
101 - }
102 - else if (ampm == "PM") {
103 - setTime.setHours(shour + 12);
104 - }
105 -
106 - setTime.setMinutes(smin);
107 -
108 - var gres1 = new Date(setTime.getTime() - 270 * 60000);
109 - var gres2 = new Date(res1.getTime() - 90 * 60000);
110 - var gres3 = new Date(res2.getTime() - 90 * 60000);
111 - var gres4 = new Date(res3.getTime() - 90 * 60000);
112 -
113 - function retDate(dateObj) {
114 - var formatted = '';
115 - var pm = false;
116 - if (dateObj.getHours() > 12) {
117 - formatted = dateObj.getHours() - 12;
118 - pm = true;
119 - }
120 - else if (dateObj.getHours() < 12 && dateObj.getHours() != 0) {
121 - formatted = dateObj.getHours();
122 - }
123 - else if (dateObj.getHours() == 0) {
124 - formatted = "12";
125 - }
126 - else if (dateObj.getHours() == 12) {
127 - formatted = "12";
128 - pm = true;
129 - }
130 -
131 - if (dateObj.getMinutes() < 10) {
132 - formatted = formatted + ":0" + dateObj.getMinutes();
133 - }
134 - else {
135 - formatted = formatted + ":" + dateObj.getMinutes();
136 - }
137 -
138 - if (pm == true) {
139 - formatted = formatted + " PM";
140 - }
141 - else {
142 - formatted = formatted + " AM";
143 - }
144 - return formatted;
145 - }
146 -
147 - console.log(String(retDate(gres1)));
148 - console.log(String(retDate(gres2)));
149 - console.log(String(retDate(gres3)));
150 - console.log(String(retDate(gres4)));
151 -
152 - $('#results').fadeIn();
153 - $('#feedback').fadeIn();
154 - $('#ad').fadeIn();
155 - } // end hour/minute check if
156 - else {
157 - alert("Please select an hour and a minute before trying to calculate!");
158 - } // end not-filled check
159 - };// end calculate
160 -})};
161 -
162 -
163 -function sleep(ghour, gmin, ampm) { //몇시에 일어나려고 할 때 언제 자면 좋을지
164 - //$('#start').hide();
165 - var zDate = new Date();
166 -
167 - var sres1 = new Date(zDate.getTime() + 104*60000);
168 - var sres2 = new Date(res1.getTime() + 90*60000);
169 - var sres3 = new Date(res2.getTime() + 90*60000);
170 - var sres4 = new Date(res3.getTime() + 90*60000);
171 - var sres5 = new Date(res4.getTime() + 90*60000);
172 - var sres6 = new Date(res5.getTime() + 90*60000);
173 -
174 - function retDate(dateObj) {
175 - var formatted = '';
176 - var pm = false;
177 - if(dateObj.getHours() > 12) {
178 - formatted = dateObj.getHours() - 12;
179 - pm = true;
180 - } else if(dateObj.getHours() < 12 && dateObj.getHours() != 0) {
181 - formatted = dateObj.getHours();
182 - } else if(dateObj.getHours() == 0) {
183 - formatted = "12";
184 - } else if(dateObj.getHours() == 12) {
185 - formatted = "12";
186 - pm = true;
187 - }
188 - if(dateObj.getMinutes() < 10) {
189 - formatted = formatted + ":0" + dateObj.getMinutes();
190 - } else {
191 - formatted = formatted + ":" + dateObj.getMinutes();
192 - }
193 - if(pm == true) {
194 - formatted = formatted + " PM";
195 - } else {
196 - formatted = formatted + " AM";
197 - }
198 - return formatted;
199 - }
200 -
201 - console.log(String(retDate(sres1)));
202 - console.log(String(retDate(sres2)));
203 - console.log(String(retDate(sres3)));
204 - console.log(String(retDate(sres4)));
205 - console.log(String(retDate(sres5)));
206 - console.log(String(retDate(sres6)));
207 -
208 - $('#resultsNow').fadeIn();
209 - $('#feedback').fadeIn();
210 - $('#ad').fadeIn();
211 -};
212 -*/
213 -/*
214 -//sleep 함수
215 -console.log("You should try to fall asleep at one of the following times: ");
216 -"sres1" title="Six Cycles: Nine Hours of Sleep"
217 -or
218 -"sres2" title="Five Cycles: Seven and a half Hours of Sleep"
219 -or
220 -"sres3" title="Four Cycles: Six Hours of Sleep"
221 -or
222 -"sres4" title="Three Cycles: Four and a half Hours of Sleep">
223 -
224 -console.log("Please keep in mind that you should be falling asleep at these times.");
225 -console.log("The average human takes fourteen minutes to fall asleep, so plan accordingly!");
226 -
227 -console.log("꿀잠봇 works by counting backwards in sleep cycles.");
228 -console.log("Waking up in the middle of a sleep cycle leaves you feeling tired and groggy, but waking up in between cycles wakes you up feeling refreshed and alert!");
229 -console.log("A good night's sleep consists of 5-6 complete sleep cycles.");
230 -//getup 함수
231 -console.log("If you head to bed right now, you should try to wake up at one of the following times:");
232 -"gres1" title="One Cycle: One and a half Hours of Sleep"
233 -or
234 -"gres2" title="Two Cycles: Three Hours of Sleep"
235 -or
236 -"gres3" title="Three Cycles: Four and a half Hours of Sleep"
237 -or
238 -"gres4" title="Four Cycles: Six Hours of Sleep"
239 -or
240 -"gres5" title="Five Cycles: Seven and a half Hours of Sleep"
241 -or
242 -"gres6" title="Six Cycles: Nine Hours of Sleep"
243 -
244 -console.log("Please keep in mind that you should try to wake up at one of these times.");
245 -console.log("The average human takes fourteen minutes to fall asleep, so plan accordingly!");
246 -
247 -console.log("꿀잠봇 works by counting backwards in sleep cycles.");
248 -console.log("Waking up in the middle of a sleep cycle leaves you feeling tired and groggy, but waking up in between cycles wakes you up feeling refreshed and alert!");
249 -console.log("A good night's sleep consists of 5-6 complete sleep cycles.");
250 -*/
251 -
252 -/*
253 - //언어 감지 option
254 - var detect_options = {
255 - url : languagedetect_api_url,
256 - form : {'query': event.message.text},
257 - headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret}
258 - };
259 -
260 - //papago 언어 감지
261 - request.post(detect_options,function(error,response,body){
262 - console.log(response.statusCode);
263 - if(!error && response.statusCode == 200){
264 - var detect_body = JSON.parse(response.body);
265 - var source = '';
266 - var target = '';
267 - var result = { type: 'text', text:''};
268 -
269 - //언어 감지가 제대로 됐는지 확인
270 - console.log(detect_body.langCode);
271 -
272 -
273 - //번역은 한국어->영어 / 영어->한국어만 지원
274 - if(detect_body.langCode == 'ko'||detect_body.langCode == 'en'){
275 - source = detect_body.langCode == 'ko' ? 'ko':'en';
276 - target = source == 'ko' ? 'en':'ko';
277 - //papago 번역 option
278 - var options = {
279 - url: translate_api_url,
280 - // 한국어(source : ko), 영어(target: en), 카톡에서 받는 메시지(text)
281 - form: {'source':source, 'target':target, 'text':event.message.text},
282 - headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret}
283 - };
284 -
285 - // Naver Post API
286 - request.post(options, function(error, response, body){
287 - // Translate API Sucess
288 - if(!error && response.statusCode == 200){
289 - // JSON
290 - var objBody = JSON.parse(response.body);
291 - // Message 잘 찍히는지 확인
292 -
293 - result.text = objBody.message.result.translatedText;
294 - console.log(result.text);
295 - //번역된 문장 보내기
296 - client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
297 - }
298 - });
299 - }
300 - // 메시지의 언어가 영어 또는 한국어가 아닐 경우
301 - else{
302 - result.text = '언어를 감지할 수 없습니다. \n 번역 언어는 한글 또는 영어만 가능합니다.';
303 - client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
304 - }
305 -
306 - }
307 -
308 - });
309 -*/
310 -
311 ->>>>>>> heroku
312 -=======
313 ->>>>>>> 5c3493c34733e95cc8b593c61c6fbeefcc069682
314 -
315 -app.listen(3000, function () {
316 - console.log('Linebot listening on port 3000!');
317 -});
1 -## 6.8.3 (05 Nov 2019)
2 -
3 -### Bug fix
4 -
5 -* Add exception handler in middleware (#153)
6 -
7 -### Feature
8 -
9 -* Flex Message Update 1 (#173)
10 -* Support friend statistics API (#161)
11 -
12 -### Misc
13 -
14 -* Update dependencies (#174)
15 -
16 -## 6.8.2 (08 Aug 2019)
17 -
18 -### Bug fix
19 -
20 -* Fix LINEThings Scenario Execution Event Types (#158)
21 -
22 -## 6.8.1 (29 Jul 2019)
23 -
24 -### Bug fix
25 -
26 -* Fix a type wrong in Template Message (#163)
27 -
28 -### Feature
29 -* Get `X-LINE-Request-Id` by using `responseData['x-line-request-id']` (#151 #157)
30 -
31 -## 6.8.0 (25 Jun 2019)
32 -
33 -### Feature
34 -
35 -* Add new parameter in push/reply/multicast/broadcast API to catch up the newest bot API (#147)
36 -* Add new APIs in bot API (#147)
37 - - Get the target limit for additional messages
38 - - Get number of messages sent this month
39 - - Get number of sent broadcast messages
40 - - Send broadcast message
41 -
42 -### Breaking changes
43 -* Deprecate Node 6 and start to support Node 12 (#139)
44 -* Remove polyfills for Node 6 (#149)
45 -
46 -### Type
47 -
48 -* Add LINE Things Event (#150)
49 -
50 -### Misc
51 -* Update axios and other dependencies by running `npm audit fix` to fix vulnerabilities. (#148 #154)
52 -
53 -## 6.7.0 (18 Apr 2019)
54 -
55 -### Feature
56 -
57 -* Add alt URL field to URI action (#135)
58 -* Implement (un)linkRichMenuToMultipleUsers (#135)
59 -
60 -### Type
61 -
62 -* Fix typo in a type (#124)
63 -
64 -
65 -## 6.6.0 (4 Mar 2019)
66 -
67 -### Feature
68 -
69 -* Add DeviceLinkEvent / DeviceUnlinkEvent (#123)
70 -
71 -### Type
72 -
73 -* Fix FlexSpacer to have optional 'size' property (#122)
74 -
75 -### Misc
76 -
77 -* Run `npm audit fix` to fix minor dependency vulnerability.
78 -
79 -
80 -## 6.5.0 (16 Feb 2019)
81 -
82 -### Feature
83 -
84 -* Add APIs to get number of sent messages (#116)
85 -* Add account link event (#117)
86 -
87 -### Misc
88 -
89 -* Fix a typo in doc (#119)
90 -
91 -
92 -## 6.4.0 (19 Nov 2018)
93 -
94 -### Feature
95 -
96 -* Add `getLinkToken` API (#96)
97 -* Handle `req.rawBody` in Google Cloud Functions (#101)
98 -* [Kitchensink] Add ngrok functionality (#99)
99 -
100 -### Type
101 -
102 -* Add types for video in imagemap message (#100)
103 -* Add `contentProvider` fields to content messages (#103)
104 -* Add `destination` field to webhook request body (#102)
105 -* Add `MemberJoinEvent` and `MemberLeaveEvent` types (#107)
106 -
107 -### Misc
108 -
109 -* Don't include doc in released source
110 -* Upgrade TypeScript to 3.1.6 (#94)
111 -* Refactoring (#94, #98, #99)
112 -* Remove webhook-tester tool
113 -
114 -
115 -## 6.3.0 (21 Sep 2018)
116 -
117 -### Feature
118 -
119 -* Add default rich menu APIs (#87)
120 -
121 -### Type
122 -
123 -* Add missing `defaultAction` field to `TemplateColumn`
124 -
125 -### Misc
126 -
127 -* Use VuePress as documentation engine (#85)
128 -* Upgrade minimum supported Node.js version to 6
129 -
130 -
131 -## 6.2.1 (16 Aug 2018)
132 -
133 -### Misc
134 -
135 -* Remove gitbook-cli from dev dependencies
136 -
137 -
138 -## 6.2.0 (15 Aug 2018)
139 -
140 -#### Type
141 -
142 -* Add QuickReply types (#83)
143 -* Format type comments
144 -
145 -#### Misc
146 -
147 -* Upgrade TypeScript to 3
148 -
149 -
150 -## 6.1.1 (14 Aug 2018)
151 -
152 -#### Type
153 -
154 -* Update FlexMessage types (#81)
155 -
156 -#### Misc
157 -
158 -* Add test coverage (#78)
159 -* Add JSDoc comments (#80)
160 -
161 -
162 -## 6.1.0 (19 June 2018)
163 -
164 -#### Type
165 -
166 -* Add types for flex message (#74)
167 -* Simplify type definition for `Action`
168 -
169 -
170 -## 6.0.3 (18 June 2018)
171 -
172 -#### Misc
173 -
174 -* Move get-audio-duration dep to proper package.json (#73)
175 -* Vulnerability fix with `npm audit fix`
176 -
177 -
178 -## 6.0.2 (21 May 2018)
179 -
180 -#### Type
181 -
182 -* Add missing `displayText` field to postback action (#63)
183 -* Add missing `FileEventMessage` to `EventMessage` (#71)
184 -
185 -#### Misc
186 -
187 -* Add audio duration lib to kitchensink example (#68)
188 -
189 -
190 -## 6.0.1 (13 Mar 2018)
191 -
192 -#### Type
193 -
194 -* Fix misimplemented 'AudioMessage' type (#61)
195 -
196 -
197 -## 6.0.0 (27 Feb 2018)
198 -
199 -#### Major
200 -
201 -* Fix misimplemented 'unlinkRichMenuFromUser' API
202 -
203 -#### Type
204 -
205 -* Fix TemplateColumn type definition (#48)
206 -
207 -#### Misc
208 -
209 -* Update GitHub issue template (#43)
210 -* Add Code of Conduct (#50)
211 -* Catch errors properly in examples (#52)
212 -
213 -
214 -## 5.2.0 (11 Dec 2017)
215 -
216 -#### Minor
217 -
218 -* Set Content-Length manually for postBinary (#42)
219 -
220 -
221 -## 5.1.0 (7 Dec 2017)
222 -
223 -#### Minor
224 -
225 -* Add new fields (#39)
226 -
227 -#### Misc
228 -
229 -* Fix Windows build (#38)
230 -* Add start scripts and webhook info to examples
231 -
232 -
233 -## 5.0.1 (14 Nov 2017)
234 -
235 -#### Minor
236 -
237 -* Fix typo in `ImageMapMessage` type
238 -* Add kitchensink example (#36)
239 -
240 -
241 -## 5.0.0 (2 Nov 2017)
242 -
243 -#### Major
244 -
245 -* Implement rich menu API (#34)
246 -
247 -#### Type
248 -
249 -* Rename `ImageMapArea` and `TemplateAction`s into general ones
250 -
251 -#### Misc
252 -
253 -* Do not enforce `checkJSON` for some APIs where it means nothing
254 -* Change how to check request object in test cases
255 -
256 -
257 -## 4.0.0 (25 Oct 2017)
258 -
259 -#### Major
260 -
261 -* Make index script export exceptions and types (#31)
262 -
263 -#### Type
264 -
265 -* Simplify config types for client and middleware (#31)
266 -
267 -#### Misc
268 -
269 -* Fix information and links in doc
270 -* Use Prettier instead of TSLint (#30)
271 -* Install git hooks for precommit and prepush (#30)
272 -
273 -
274 -## 3.1.1 (19 Sep 2017)
275 -
276 -#### Type
277 -
278 -* Fix type of postback.params
279 -
280 -
281 -## 3.1.0 (19 Sep 2017)
282 -
283 -#### Major
284 -
285 -* Make middleware return `SignatureValidationFailed` for no signature (#26)
286 -
287 -#### Type
288 -
289 -* Add `FileEventMessage` type
290 -
291 -
292 -## 3.0.0 (8 Sep 2017)
293 -
294 -#### Major
295 -
296 -* Implement "Get group/room member profile" API (#15)
297 -* Implement "Get group/room member IDs" API (#23)
298 -* `getMessageContent` now returns `Promise<ReadableStream>` (#20)
299 -
300 -#### Type
301 -
302 -* Add "datetimepicker" support (#21)
303 -* Fix typo in `TemplateURIAction` type (#21)
304 -
305 -#### Misc
306 -
307 -* Package updates and corresponding fixes
308 -* Use npm 5 instead of Yarn in dev
309 -* Fix `clean` script to work in Windows
310 -* Use "axios" for internal HTTP client instead of "got" (#20)
311 -
312 -
313 -## 2.0.0 (12 June 2017)
314 -
315 -#### Type
316 -
317 -* Use literal types for 'type' fields
318 -
319 -#### Misc
320 -
321 -* Update yarn.lock with the latest Yarn
322 -
323 -
324 -## 1.1.0 (31 May 2017)
325 -
326 -* Handle pre-parsed body (string and buffer only)
327 -
328 -#### Type
329 -
330 -* Separate config type into client and middleware types
331 -* Add `userId` to group and room event sources
332 -
333 -#### Misc
334 -
335 -* Create issue template (#4)
336 -
337 -
338 -## 1.0.0 (11 May 2017)
339 -
340 -* Initial release
1 -# LINE Messaging API SDK for nodejs
2 -
3 -[![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs)
4 -[![npmjs](https://badge.fury.io/js/%40line%2Fbot-sdk.svg)](https://www.npmjs.com/package/@line/bot-sdk)
5 -
6 -
7 -## Introduction
8 -The LINE Messaging API SDK for nodejs makes it easy to develop bots using LINE Messaging API, and you can create a sample bot within minutes.
9 -
10 -## Documentation
11 -
12 -See the official API documentation for more information
13 -
14 -- English: https://developers.line.biz/en/docs/messaging-api/overview/
15 -- Japanese: https://developers.line.biz/ja/docs/messaging-api/overview/
16 -
17 -line-bot-sdk-nodejs documentation: https://line.github.io/line-bot-sdk-nodejs/#getting-started
18 -
19 -## Requirements
20 -
21 -* **Node.js** 8 or higher
22 -
23 -## Installation
24 -
25 -Using [npm](https://www.npmjs.com/):
26 -
27 -``` bash
28 -$ npm install @line/bot-sdk --save
29 -```
30 -
31 -## Help and media
32 -FAQ: https://developers.line.biz/en/faq/
33 -
34 -Community Q&A: https://www.line-community.me/questions
35 -
36 -News: https://developers.line.biz/en/news/
37 -
38 -Twitter: @LINE_DEV
39 -
40 -## Versioning
41 -This project respects semantic versioning
42 -
43 -See http://semver.org/
44 -
45 -## Contributing
46 -
47 -Please check [CONTRIBUTING](CONTRIBUTING.md) before making a contribution.
48 -
49 -## License
50 -```
51 -Copyright (C) 2016 LINE Corp.
52 -
53 -Licensed under the Apache License, Version 2.0 (the "License");
54 -you may not use this file except in compliance with the License.
55 -You may obtain a copy of the License at
56 -
57 - http://www.apache.org/licenses/LICENSE-2.0
58 -
59 -Unless required by applicable law or agreed to in writing, software
60 -distributed under the License is distributed on an "AS IS" BASIS,
61 -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
62 -See the License for the specific language governing permissions and
63 -limitations under the License.
64 -```
1 -/// <reference types="node" />
2 -import { Readable } from "stream";
3 -import * as Types from "./types";
4 -export default class Client {
5 - config: Types.ClientConfig;
6 - private http;
7 - constructor(config: Types.ClientConfig);
8 - private parseHTTPResponse;
9 - pushMessage(to: string, messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
10 - replyMessage(replyToken: string, messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
11 - multicast(to: string[], messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
12 - broadcast(messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
13 - getProfile(userId: string): Promise<Types.Profile>;
14 - private getChatMemberProfile;
15 - getGroupMemberProfile(groupId: string, userId: string): Promise<Types.Profile>;
16 - getRoomMemberProfile(roomId: string, userId: string): Promise<Types.Profile>;
17 - private getChatMemberIds;
18 - getGroupMemberIds(groupId: string): Promise<string[]>;
19 - getRoomMemberIds(roomId: string): Promise<string[]>;
20 - getMessageContent(messageId: string): Promise<Readable>;
21 - private leaveChat;
22 - leaveGroup(groupId: string): Promise<any>;
23 - leaveRoom(roomId: string): Promise<any>;
24 - getRichMenu(richMenuId: string): Promise<Types.RichMenuResponse>;
25 - createRichMenu(richMenu: Types.RichMenu): Promise<string>;
26 - deleteRichMenu(richMenuId: string): Promise<any>;
27 - getRichMenuIdOfUser(userId: string): Promise<string>;
28 - linkRichMenuToUser(userId: string, richMenuId: string): Promise<any>;
29 - unlinkRichMenuFromUser(userId: string): Promise<any>;
30 - linkRichMenuToMultipleUsers(richMenuId: string, userIds: string[]): Promise<any>;
31 - unlinkRichMenusFromMultipleUsers(userIds: string[]): Promise<any>;
32 - getRichMenuImage(richMenuId: string): Promise<Readable>;
33 - setRichMenuImage(richMenuId: string, data: Buffer | Readable, contentType?: string): Promise<any>;
34 - getRichMenuList(): Promise<Array<Types.RichMenuResponse>>;
35 - setDefaultRichMenu(richMenuId: string): Promise<{}>;
36 - getDefaultRichMenuId(): Promise<string>;
37 - deleteDefaultRichMenu(): Promise<{}>;
38 - getLinkToken(userId: string): Promise<string>;
39 - getNumberOfSentReplyMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
40 - getNumberOfSentPushMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
41 - getNumberOfSentMulticastMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
42 - getTargetLimitForAdditionalMessages(): Promise<Types.TargetLimitForAdditionalMessages>;
43 - getNumberOfMessagesSentThisMonth(): Promise<Types.NumberOfMessagesSentThisMonth>;
44 - getNumberOfSentBroadcastMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
45 - getNumberOfMessageDeliveries(date: string): Promise<Types.NumberOfMessageDeliveriesResponse>;
46 - getNumberOfFollowers(date: string): Promise<Types.NumberOfFollowersResponse>;
47 - getFriendDemographics(): Promise<Types.FriendDemoGraphics>;
48 -}
49 -export declare class OAuth {
50 - private http;
51 - constructor();
52 - issueAccessToken(client_id: string, client_secret: string): Promise<{
53 - access_token: string;
54 - expires_in: number;
55 - token_type: "Bearer";
56 - }>;
57 - revokeAccessToken(access_token: string): Promise<{}>;
58 -}
1 -"use strict";
2 -Object.defineProperty(exports, "__esModule", { value: true });
3 -const http_1 = require("./http");
4 -const Types = require("./types");
5 -const exceptions_1 = require("./exceptions");
6 -function toArray(maybeArr) {
7 - return Array.isArray(maybeArr) ? maybeArr : [maybeArr];
8 -}
9 -function ensureJSON(raw) {
10 - if (typeof raw === "object") {
11 - return raw;
12 - }
13 - else {
14 - throw new exceptions_1.JSONParseError("Failed to parse response body as JSON", raw);
15 - }
16 -}
17 -const API_HOST = process.env.API_BASE_URL || "https://api.line.me/v2/";
18 -const BOT_BASE_URL = process.env.API_BASE_URL || `${API_HOST}bot/`;
19 -const OAUTH_BASE_URL = `${API_HOST}oauth/`;
20 -class Client {
21 - constructor(config) {
22 - if (!config.channelAccessToken) {
23 - throw new Error("no channel access token");
24 - }
25 - this.config = config;
26 - this.http = new http_1.default({
27 - baseURL: BOT_BASE_URL,
28 - defaultHeaders: {
29 - Authorization: "Bearer " + this.config.channelAccessToken,
30 - },
31 - responseParser: this.parseHTTPResponse.bind(this),
32 - });
33 - }
34 - parseHTTPResponse(response) {
35 - const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types;
36 - let resBody = Object.assign({}, response.data);
37 - if (response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME]) {
38 - resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] =
39 - response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME];
40 - }
41 - return resBody;
42 - }
43 - pushMessage(to, messages, notificationDisabled = false) {
44 - return this.http.post("/message/push", {
45 - messages: toArray(messages),
46 - to,
47 - notificationDisabled,
48 - });
49 - }
50 - replyMessage(replyToken, messages, notificationDisabled = false) {
51 - return this.http.post("/message/reply", {
52 - messages: toArray(messages),
53 - replyToken,
54 - notificationDisabled,
55 - });
56 - }
57 - async multicast(to, messages, notificationDisabled = false) {
58 - return this.http.post("/message/multicast", {
59 - messages: toArray(messages),
60 - to,
61 - notificationDisabled,
62 - });
63 - }
64 - async broadcast(messages, notificationDisabled = false) {
65 - return this.http.post("/message/broadcast", {
66 - messages: toArray(messages),
67 - notificationDisabled,
68 - });
69 - }
70 - async getProfile(userId) {
71 - const profile = await this.http.get(`/profile/${userId}`);
72 - return ensureJSON(profile);
73 - }
74 - async getChatMemberProfile(chatType, chatId, userId) {
75 - const profile = await this.http.get(`/${chatType}/${chatId}/member/${userId}`);
76 - return ensureJSON(profile);
77 - }
78 - async getGroupMemberProfile(groupId, userId) {
79 - return this.getChatMemberProfile("group", groupId, userId);
80 - }
81 - async getRoomMemberProfile(roomId, userId) {
82 - return this.getChatMemberProfile("room", roomId, userId);
83 - }
84 - async getChatMemberIds(chatType, chatId) {
85 - let memberIds = [];
86 - let start;
87 - do {
88 - const res = await this.http.get(`/${chatType}/${chatId}/members/ids`, start ? { start } : null);
89 - ensureJSON(res);
90 - memberIds = memberIds.concat(res.memberIds);
91 - start = res.next;
92 - } while (start);
93 - return memberIds;
94 - }
95 - async getGroupMemberIds(groupId) {
96 - return this.getChatMemberIds("group", groupId);
97 - }
98 - async getRoomMemberIds(roomId) {
99 - return this.getChatMemberIds("room", roomId);
100 - }
101 - async getMessageContent(messageId) {
102 - return this.http.getStream(`/message/${messageId}/content`);
103 - }
104 - leaveChat(chatType, chatId) {
105 - return this.http.post(`/${chatType}/${chatId}/leave`);
106 - }
107 - async leaveGroup(groupId) {
108 - return this.leaveChat("group", groupId);
109 - }
110 - async leaveRoom(roomId) {
111 - return this.leaveChat("room", roomId);
112 - }
113 - async getRichMenu(richMenuId) {
114 - const res = await this.http.get(`/richmenu/${richMenuId}`);
115 - return ensureJSON(res);
116 - }
117 - async createRichMenu(richMenu) {
118 - const res = await this.http.post("/richmenu", richMenu);
119 - return ensureJSON(res).richMenuId;
120 - }
121 - async deleteRichMenu(richMenuId) {
122 - return this.http.delete(`/richmenu/${richMenuId}`);
123 - }
124 - async getRichMenuIdOfUser(userId) {
125 - const res = await this.http.get(`/user/${userId}/richmenu`);
126 - return ensureJSON(res).richMenuId;
127 - }
128 - async linkRichMenuToUser(userId, richMenuId) {
129 - return this.http.post(`/user/${userId}/richmenu/${richMenuId}`);
130 - }
131 - async unlinkRichMenuFromUser(userId) {
132 - return this.http.delete(`/user/${userId}/richmenu`);
133 - }
134 - async linkRichMenuToMultipleUsers(richMenuId, userIds) {
135 - return this.http.post("/richmenu/bulk/link", {
136 - richMenuId,
137 - userIds,
138 - });
139 - }
140 - async unlinkRichMenusFromMultipleUsers(userIds) {
141 - return this.http.post("/richmenu/bulk/unlink", {
142 - userIds,
143 - });
144 - }
145 - async getRichMenuImage(richMenuId) {
146 - return this.http.getStream(`/richmenu/${richMenuId}/content`);
147 - }
148 - async setRichMenuImage(richMenuId, data, contentType) {
149 - return this.http.postBinary(`/richmenu/${richMenuId}/content`, data, contentType);
150 - }
151 - async getRichMenuList() {
152 - const res = await this.http.get(`/richmenu/list`);
153 - return ensureJSON(res).richmenus;
154 - }
155 - async setDefaultRichMenu(richMenuId) {
156 - return this.http.post(`/user/all/richmenu/${richMenuId}`);
157 - }
158 - async getDefaultRichMenuId() {
159 - const res = await this.http.get("/user/all/richmenu");
160 - return ensureJSON(res).richMenuId;
161 - }
162 - async deleteDefaultRichMenu() {
163 - return this.http.delete("/user/all/richmenu");
164 - }
165 - async getLinkToken(userId) {
166 - const res = await this.http.post(`/user/${userId}/linkToken`);
167 - return ensureJSON(res).linkToken;
168 - }
169 - async getNumberOfSentReplyMessages(date) {
170 - const res = await this.http.get(`/message/delivery/reply?date=${date}`);
171 - return ensureJSON(res);
172 - }
173 - async getNumberOfSentPushMessages(date) {
174 - const res = await this.http.get(`/message/delivery/push?date=${date}`);
175 - return ensureJSON(res);
176 - }
177 - async getNumberOfSentMulticastMessages(date) {
178 - const res = await this.http.get(`/message/delivery/multicast?date=${date}`);
179 - return ensureJSON(res);
180 - }
181 - async getTargetLimitForAdditionalMessages() {
182 - const res = await this.http.get("/message/quota");
183 - return ensureJSON(res);
184 - }
185 - async getNumberOfMessagesSentThisMonth() {
186 - const res = await this.http.get("/message/quota/consumption");
187 - return ensureJSON(res);
188 - }
189 - async getNumberOfSentBroadcastMessages(date) {
190 - const res = await this.http.get(`/message/delivery/broadcast?date=${date}`);
191 - return ensureJSON(res);
192 - }
193 - async getNumberOfMessageDeliveries(date) {
194 - const res = await this.http.get(`/insight/message/delivery?date=${date}`);
195 - return ensureJSON(res);
196 - }
197 - async getNumberOfFollowers(date) {
198 - const res = await this.http.get(`/insight/followers?date=${date}`);
199 - return ensureJSON(res);
200 - }
201 - async getFriendDemographics() {
202 - const res = await this.http.get(`/insight/demographic`);
203 - return ensureJSON(res);
204 - }
205 -}
206 -exports.default = Client;
207 -class OAuth {
208 - constructor() {
209 - this.http = new http_1.default({
210 - baseURL: OAUTH_BASE_URL,
211 - });
212 - }
213 - issueAccessToken(client_id, client_secret) {
214 - return this.http.postForm("/accessToken", {
215 - grant_type: "client_credentials",
216 - client_id,
217 - client_secret,
218 - });
219 - }
220 - revokeAccessToken(access_token) {
221 - return this.http.postForm("/revoke", { access_token });
222 - }
223 -}
224 -exports.OAuth = OAuth;
1 -/// <reference types="node" />
2 -import { AxiosResponse } from "axios";
3 -import { Readable } from "stream";
4 -declare type httpClientConfig = {
5 - baseURL?: string;
6 - defaultHeaders?: any;
7 - responseParser?: <T>(res: AxiosResponse) => T;
8 -};
9 -export default class HTTPClient {
10 - private instance;
11 - private config;
12 - constructor(config?: httpClientConfig);
13 - get<T>(url: string, params?: any): Promise<T>;
14 - getStream(url: string, params?: any): Promise<Readable>;
15 - post<T>(url: string, body?: any): Promise<T>;
16 - postForm<T>(url: string, body?: any): Promise<T>;
17 - postBinary<T>(url: string, data: Buffer | Readable, contentType?: string): Promise<T>;
18 - delete<T>(url: string, params?: any): Promise<T>;
19 - private wrapError;
20 -}
21 -export {};
1 -"use strict";
2 -Object.defineProperty(exports, "__esModule", { value: true });
3 -const axios_1 = require("axios");
4 -const stream_1 = require("stream");
5 -const exceptions_1 = require("./exceptions");
6 -const fileType = require("file-type");
7 -const qs = require("querystring");
8 -const pkg = require("../package.json");
9 -class HTTPClient {
10 - constructor(config = {}) {
11 - this.config = config;
12 - const { baseURL, defaultHeaders } = config;
13 - this.instance = axios_1.default.create({
14 - baseURL,
15 - headers: Object.assign({}, defaultHeaders, {
16 - "User-Agent": `${pkg.name}/${pkg.version}`,
17 - }),
18 - });
19 - this.instance.interceptors.response.use(res => res, err => Promise.reject(this.wrapError(err)));
20 - }
21 - async get(url, params) {
22 - const res = await this.instance.get(url, { params });
23 - return res.data;
24 - }
25 - async getStream(url, params) {
26 - const res = await this.instance.get(url, {
27 - params,
28 - responseType: "stream",
29 - });
30 - return res.data;
31 - }
32 - async post(url, body) {
33 - const res = await this.instance.post(url, body, {
34 - headers: { "Content-Type": "application/json" },
35 - });
36 - const { responseParser } = this.config;
37 - if (responseParser)
38 - return responseParser(res);
39 - else
40 - return res.data;
41 - }
42 - async postForm(url, body) {
43 - const res = await this.instance.post(url, qs.stringify(body), {
44 - headers: { "Content-Type": "application/x-www-form-urlencoded" },
45 - });
46 - return res.data;
47 - }
48 - async postBinary(url, data, contentType) {
49 - const buffer = await (async () => {
50 - if (Buffer.isBuffer(data)) {
51 - return data;
52 - }
53 - else if (data instanceof stream_1.Readable) {
54 - return new Promise((resolve, reject) => {
55 - const buffers = [];
56 - let size = 0;
57 - data.on("data", (chunk) => {
58 - buffers.push(chunk);
59 - size += chunk.length;
60 - });
61 - data.on("end", () => resolve(Buffer.concat(buffers, size)));
62 - data.on("error", reject);
63 - });
64 - }
65 - else {
66 - throw new Error("invalid data type for postBinary");
67 - }
68 - })();
69 - const res = await this.instance.post(url, buffer, {
70 - headers: {
71 - "Content-Type": contentType || fileType(buffer).mime,
72 - "Content-Length": buffer.length,
73 - },
74 - });
75 - return res.data;
76 - }
77 - async delete(url, params) {
78 - const res = await this.instance.delete(url, { params });
79 - return res.data;
80 - }
81 - wrapError(err) {
82 - if (err.response) {
83 - return new exceptions_1.HTTPError(err.message, err.response.status, err.response.statusText, err);
84 - }
85 - else if (err.code) {
86 - return new exceptions_1.RequestError(err.message, err.code, err);
87 - }
88 - else if (err.config) {
89 - // unknown, but from axios
90 - return new exceptions_1.ReadError(err);
91 - }
92 - // otherwise, just rethrow
93 - return err;
94 - }
95 -}
96 -exports.default = HTTPClient;
1 -import Client, { OAuth } from "./client";
2 -import middleware from "./middleware";
3 -import validateSignature from "./validate-signature";
4 -export { Client, middleware, validateSignature, OAuth };
5 -export * from "./exceptions";
6 -export * from "./types";
1 -"use strict";
2 -function __export(m) {
3 - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4 -}
5 -Object.defineProperty(exports, "__esModule", { value: true });
6 -const client_1 = require("./client");
7 -exports.Client = client_1.default;
8 -exports.OAuth = client_1.OAuth;
9 -const middleware_1 = require("./middleware");
10 -exports.middleware = middleware_1.default;
11 -const validate_signature_1 = require("./validate-signature");
12 -exports.validateSignature = validate_signature_1.default;
13 -// re-export exceptions and types
14 -__export(require("./exceptions"));
15 -__export(require("./types"));
1 -/// <reference types="node" />
2 -import * as http from "http";
3 -import * as Types from "./types";
4 -export declare type Request = http.IncomingMessage & {
5 - body: any;
6 -};
7 -export declare type Response = http.ServerResponse;
8 -export declare type NextCallback = (err?: Error) => void;
9 -export declare type Middleware = (req: Request, res: Response, next: NextCallback) => void | Promise<void>;
10 -export default function middleware(config: Types.MiddlewareConfig): Middleware;
1 -"use strict";
2 -Object.defineProperty(exports, "__esModule", { value: true });
3 -const body_parser_1 = require("body-parser");
4 -const exceptions_1 = require("./exceptions");
5 -const validate_signature_1 = require("./validate-signature");
6 -function isValidBody(body) {
7 - return (body && typeof body === "string") || Buffer.isBuffer(body);
8 -}
9 -function middleware(config) {
10 - if (!config.channelSecret) {
11 - throw new Error("no channel secret");
12 - }
13 - const secret = config.channelSecret;
14 - const _middleware = async (req, res, next) => {
15 - // header names are lower-cased
16 - // https://nodejs.org/api/http.html#http_message_headers
17 - const signature = req.headers["x-line-signature"];
18 - if (!signature) {
19 - next(new exceptions_1.SignatureValidationFailed("no signature"));
20 - return;
21 - }
22 - const body = await (async () => {
23 - if (isValidBody(req.rawBody)) {
24 - // rawBody is provided in Google Cloud Functions and others
25 - return req.rawBody;
26 - }
27 - else if (isValidBody(req.body)) {
28 - return req.body;
29 - }
30 - else {
31 - // body may not be parsed yet, parse it to a buffer
32 - return new Promise((resolve, reject) => body_parser_1.raw({ type: "*/*" })(req, res, (error) => error ? reject(error) : resolve(req.body)));
33 - }
34 - })();
35 - if (!validate_signature_1.default(body, secret, signature)) {
36 - next(new exceptions_1.SignatureValidationFailed("signature validation failed", signature));
37 - return;
38 - }
39 - const strBody = Buffer.isBuffer(body) ? body.toString() : body;
40 - try {
41 - req.body = JSON.parse(strBody);
42 - next();
43 - }
44 - catch (err) {
45 - next(new exceptions_1.JSONParseError(err.message, strBody));
46 - }
47 - };
48 - return (req, res, next) => {
49 - _middleware(req, res, next).catch(next);
50 - };
51 -}
52 -exports.default = middleware;
1 -export interface Config {
2 - channelAccessToken?: string;
3 - channelSecret?: string;
4 -}
5 -export interface ClientConfig extends Config {
6 - channelAccessToken: string;
7 -}
8 -export interface MiddlewareConfig extends Config {
9 - channelSecret: string;
10 -}
11 -export declare type Profile = {
12 - displayName: string;
13 - userId: string;
14 - pictureUrl: string;
15 - statusMessage: string;
16 -};
17 -/**
18 - * Request body which is sent by webhook.
19 - *
20 - * @see [Request body](https://developers.line.biz/en/reference/messaging-api/#request-body)
21 - */
22 -export declare type WebhookRequestBody = {
23 - /**
24 - * User ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, U[0-9a-f]{32}.
25 - */
26 - destination: string;
27 - /**
28 - * Information about the event
29 - */
30 - events: Array<WebhookEvent>;
31 -};
32 -/**
33 - * JSON objects which contain events generated on the LINE Platform.
34 - *
35 - * @see [Webhook event objects](https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects)
36 - */
37 -export declare type WebhookEvent = MessageEvent | FollowEvent | UnfollowEvent | JoinEvent | LeaveEvent | MemberJoinEvent | MemberLeaveEvent | PostbackEvent | BeaconEvent | AccountLinkEvent | DeviceLinkEvent | DeviceUnlinkEvent | LINEThingsScenarioExecutionEvent;
38 -export declare type EventBase = {
39 - /**
40 - * Time of the event in milliseconds
41 - */
42 - timestamp: number;
43 - /**
44 - * Source user, group, or room object with information about the source of the event.
45 - */
46 - source: EventSource;
47 -};
48 -export declare type EventSource = User | Group | Room;
49 -export declare type User = {
50 - type: "user";
51 - userId: string;
52 -};
53 -export declare type Group = {
54 - type: "group";
55 - groupId: string;
56 - /**
57 - * ID of the source user.
58 - *
59 - * Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
60 - * Not included if the user has not agreed to the
61 - * [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
62 - */
63 - userId?: string;
64 -};
65 -export declare type Room = {
66 - type: "room";
67 - roomId: string;
68 - /**
69 - * ID of the source user.
70 - *
71 - * Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
72 - * Not included if the user has not agreed to the
73 - * [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
74 - */
75 - userId?: string;
76 -};
77 -export declare type ReplyableEvent = EventBase & {
78 - replyToken: string;
79 -};
80 -/**
81 - * Webhook event object which contains the sent message.
82 - *
83 - * The `message` property contains a message object which corresponds with the
84 - * message type. You can reply to message events.
85 - *
86 - * @see [Message event](https://developers.line.biz/en/reference/messaging-api/#message-event)
87 - */
88 -export declare type MessageEvent = {
89 - type: "message";
90 - message: EventMessage;
91 -} & ReplyableEvent;
92 -/**
93 - * Event object for when your account is added as a friend (or unblocked).
94 - */
95 -export declare type FollowEvent = {
96 - type: "follow";
97 -} & ReplyableEvent;
98 -/**
99 - * Event object for when your account is blocked.
100 - */
101 -export declare type UnfollowEvent = {
102 - type: "unfollow";
103 -} & EventBase;
104 -/**
105 - * Event object for when your bot joins a group or room. You can reply to join events.
106 - *
107 - * A join event is triggered at different times for groups and rooms.
108 - *
109 - * - For groups: A join event is sent when a user invites your bot.
110 - * - For rooms: A join event is sent when the first event (for example when a
111 - * user sends a message or is added to the room) occurs after your bot is
112 - * added.
113 - */
114 -export declare type JoinEvent = {
115 - type: "join";
116 -} & ReplyableEvent;
117 -/**
118 - * Event object for when a user removes your bot from a group or a room.
119 - */
120 -export declare type LeaveEvent = {
121 - type: "leave";
122 -} & EventBase;
123 -/**
124 - * Event object for when a user joins a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
125 - * or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
126 - */
127 -export declare type MemberJoinEvent = {
128 - type: "memberJoined";
129 - /**
130 - * User ID of users who joined
131 - * Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
132 - */
133 - joined: {
134 - members: Array<User>;
135 - };
136 -} & ReplyableEvent;
137 -/**
138 - * Event object for when a user leaves a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
139 - * or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
140 - */
141 -export declare type MemberLeaveEvent = {
142 - type: "memberLeft";
143 - /**
144 - * User ID of users who left
145 - * Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
146 - */
147 - left: {
148 - members: Array<User>;
149 - };
150 -} & EventBase;
151 -/**
152 - * Event object for when a user performs an action on a
153 - * [template message](https://developers.line.biz/en/reference/messaging-api/#template-messages).
154 - */
155 -export declare type PostbackEvent = {
156 - type: "postback";
157 - postback: Postback;
158 -} & ReplyableEvent;
159 -/**
160 - * Event object for when a user enters or leaves the range of a
161 - * [LINE Beacon](https://developers.line.biz/en/docs/messaging-api/using-beacons/).
162 - */
163 -export declare type BeaconEvent = ReplyableEvent & {
164 - type: "beacon";
165 - beacon: {
166 - type: "enter" | "leave" | "banner";
167 - /**
168 - * Hardware ID of the beacon that was detected
169 - */
170 - hwid: string;
171 - /**
172 - * Device message of beacon that was detected.
173 - *
174 - * This message consists of data generated by the beacon to send notifications to bots.
175 - * Only included in webhooks from devices that support the "device message" property.
176 - * For more information, see the
177 - * [LINE Simple Beacon specification](https://github.com/line/line-simple-beacon/blob/master/README.en.md/#line-simple-beacon-frame).
178 - */
179 - dm?: string;
180 - };
181 -};
182 -/**
183 - * Event object for when a user has linked his/her LINE account with a provider's service account.
184 - */
185 -export declare type AccountLinkEvent = ReplyableEvent & {
186 - type: "accountLink";
187 - link: {
188 - result: "ok" | "failed";
189 - /**
190 - * Specified nonce when verifying the user ID
191 - */
192 - nonce: string;
193 - };
194 -};
195 -/**
196 - * Indicates that a LINE Things-compatible device has been linked with LINE by a user operation.
197 - * For more information, see [Receiving device link events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#link-event).
198 - */
199 -export declare type DeviceLinkEvent = ReplyableEvent & {
200 - type: "things";
201 - things: {
202 - /**
203 - * Device ID of the LINE Things-compatible device that was linked with LINE
204 - */
205 - deviceId: string;
206 - type: "link";
207 - };
208 -};
209 -/**
210 - * Indicates that a LINE Things-compatible device has been unlinked from LINE by a user operation.
211 - * For more information, see [Receiving device unlink events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#unlink-event).
212 - */
213 -export declare type DeviceUnlinkEvent = ReplyableEvent & {
214 - type: "things";
215 - things: {
216 - /**
217 - * Device ID of the LINE Things-compatible device that was unlinked with LINE
218 - */
219 - deviceId: string;
220 - type: "unlink";
221 - };
222 -};
223 -export declare type LINEThingsScenarioExecutionEvent = ReplyableEvent & {
224 - type: "things";
225 - things: {
226 - type: "scenarioResult";
227 - /**
228 - * Device ID of the device that executed the scenario
229 - */
230 - deviceId: string;
231 - result: {
232 - /**
233 - * Scenario ID executed
234 - */
235 - scenarioId: string;
236 - /**
237 - * Revision number of the scenario set containing the executed scenario
238 - */
239 - revision: number;
240 - /**
241 - * Timestamp for when execution of scenario action started (milliseconds, LINE app time)
242 - */
243 - startTime: number;
244 - /**
245 - * Timestamp for when execution of scenario was completed (milliseconds, LINE app time)
246 - */
247 - endtime: number;
248 - /**
249 - * Scenario execution completion status
250 - * See also [things.resultCode definitions](https://developers.line.biz/en/reference/messaging-api/#things-resultcode).
251 - */
252 - resultCode: "success" | "gatt_error" | "runtime_error";
253 - /**
254 - * Execution result of individual operations specified in action
255 - * Note that an array of actions specified in a scenario has the following characteristics
256 - * - The actions defined in a scenario are performed sequentially, from top to bottom.
257 - * - Each action produces some result when executed.
258 - * Even actions that do not generate data, such as `SLEEP`, return an execution result of type `void`.
259 - * The number of items in an action array may be 0.
260 - *
261 - * Therefore, things.actionResults has the following properties:
262 - * - The number of items in the array matches the number of actions defined in the scenario.
263 - * - The order of execution results matches the order in which actions are performed.
264 - * That is, in a scenario set with multiple `GATT_READ` actions,
265 - * the results are returned in the order in which each individual `GATT_READ` action was performed.
266 - * - If 0 actions are defined in the scenario, the number of items in things.actionResults will be 0.
267 - */
268 - actionResults: Array<LINEThingsActionResult>;
269 - /**
270 - * Data contained in notification
271 - * The value is Base64-encoded binary data.
272 - * Only included for scenarios where `trigger.type = BLE_NOTIFICATION`.
273 - */
274 - bleNotificationPayload?: string;
275 - /**
276 - * Error reason
277 - */
278 - errorReason?: string;
279 - };
280 - };
281 -};
282 -export declare type LINEThingsActionResult = {
283 - /**
284 - * `void`, `binary`
285 - * Depends on `type` of the executed action.
286 - * This property is always included if `things.actionResults` is not empty.
287 - */
288 - type: "void" | "binary";
289 - /**
290 - * Base64-encoded binary data
291 - * This property is always included when `things.actionResults[].type` is `binary`.
292 - */
293 - data?: string;
294 -};
295 -export declare type EventMessage = TextEventMessage | ImageEventMessage | VideoEventMessage | AudioEventMessage | LocationEventMessage | FileEventMessage | StickerEventMessage;
296 -export declare type EventMessageBase = {
297 - id: string;
298 -};
299 -/**
300 - * Message object which contains the text sent from the source.
301 - */
302 -export declare type TextEventMessage = {
303 - type: "text";
304 - text: string;
305 -} & EventMessageBase;
306 -export declare type ContentProvider<WithPreview extends boolean = true> = {
307 - /**
308 - * The content is provided by LINE.
309 - *
310 - * The data itself can be retrieved from the content API.
311 - */
312 - type: "line";
313 -} | {
314 - /**
315 - * The content is provided by a provider other than LINE
316 - */
317 - type: "external";
318 - /**
319 - * URL of the content. Only included when contentProvider.type is external.
320 - */
321 - originalContentUrl: string;
322 - /**
323 - * URL of the content preview. Only included when contentProvider.type is external.
324 - *
325 - * For contents without preview (e.g. audio), it's undefined.
326 - */
327 - previewImageUrl: WithPreview extends true ? string : undefined;
328 -};
329 -/**
330 - * Message object which contains the image content sent from the source.
331 - * The binary image data can be retrieved using Client#getMessageContent.
332 - */
333 -export declare type ImageEventMessage = {
334 - type: "image";
335 - contentProvider: ContentProvider;
336 -} & EventMessageBase;
337 -/**
338 - * Message object which contains the video content sent from the source.
339 - * The binary video data can be retrieved using Client#getMessageContent.
340 - */
341 -export declare type VideoEventMessage = {
342 - type: "video";
343 - contentProvider: ContentProvider;
344 -} & EventMessageBase;
345 -/**
346 - * Message object which contains the audio content sent from the source.
347 - * The binary audio data can be retrieved using Client#getMessageContent.
348 - */
349 -export declare type AudioEventMessage = {
350 - type: "audio";
351 - duration: number;
352 - contentProvider: ContentProvider<false>;
353 -} & EventMessageBase;
354 -/**
355 - * Message object which contains the file sent from the source.
356 - * The binary data can be retrieved using Client#getMessageContent.
357 - */
358 -export declare type FileEventMessage = {
359 - type: "file";
360 - fileName: string;
361 - fileSize: string;
362 -} & EventMessageBase;
363 -/**
364 - * Message object which contains the location data sent from the source.
365 - */
366 -export declare type LocationEventMessage = {
367 - type: "location";
368 - title: string;
369 - address: string;
370 - latitude: number;
371 - longitude: number;
372 -} & EventMessageBase;
373 -/**
374 - * Message object which contains the sticker data sent from the source.
375 - * For a list of basic LINE stickers and sticker IDs, see
376 - * [sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
377 - */
378 -export declare type StickerEventMessage = {
379 - type: "sticker";
380 - packageId: string;
381 - stickerId: string;
382 -} & EventMessageBase;
383 -export declare type Postback = {
384 - data: string;
385 - /**
386 - * Object with the date and time selected by a user through a
387 - * [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
388 - * Only returned for postback actions via a
389 - * [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
390 - * The `full-date`, `time-hour`, and `time-minute` formats follow the
391 - * [RFC3339 protocol](https://www.ietf.org/rfc/rfc3339.txt).
392 - */
393 - params?: {
394 - /**
395 - * Date selected by user. Only included in the `date` mode.
396 - */
397 - date?: string;
398 - /**
399 - * Time selected by the user. Only included in the `time` mode.
400 - */
401 - time?: string;
402 - /**
403 - * Date and time selected by the user. Only included in the `datetime` mode.
404 - */
405 - datetime?: string;
406 - };
407 -};
408 -/**
409 - * JSON object which contains the contents of the message you send.
410 - *
411 - * @see [Message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects)
412 - */
413 -export declare type Message = TextMessage | ImageMessage | VideoMessage | AudioMessage | LocationMessage | StickerMessage | ImageMapMessage | TemplateMessage | FlexMessage;
414 -/**
415 - * @see [Common properties for messages](https://developers.line.biz/en/reference/messaging-api/#common-properties-for-messages)
416 - */
417 -export declare type MessageCommon = {
418 - /**
419 - * For the quick reply feature.
420 - * For more information, see [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
421 - *
422 - * If the user receives multiple
423 - * [message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects),
424 - * the quickReply property of the last message object is displayed.
425 - */
426 - quickReply?: QuickReply;
427 -};
428 -/**
429 - * @see [Text message](https://developers.line.biz/en/reference/messaging-api/#text-message)
430 - */
431 -export declare type TextMessage = MessageCommon & {
432 - type: "text";
433 - /**
434 - * Message text. You can include the following emoji:
435 - *
436 - * - Unicode emoji
437 - * - LINE original emoji
438 - * ([Unicode codepoint table for LINE original emoji](https://developers.line.biz/media/messaging-api/emoji-list.pdf))
439 - *
440 - * Max: 2000 characters
441 - */
442 - text: string;
443 -};
444 -/**
445 - * @see [Image message](https://developers.line.biz/en/reference/messaging-api/#image-message)
446 - */
447 -export declare type ImageMessage = MessageCommon & {
448 - type: "image";
449 - /**
450 - * Image URL (Max: 1000 characters)
451 - *
452 - * - **HTTPS**
453 - * - JPEG
454 - * - Max: 1024 x 1024
455 - * - Max: 1 MB
456 - */
457 - originalContentUrl: string;
458 - /**
459 - * Preview image URL (Max: 1000 characters)
460 - *
461 - * - **HTTPS**
462 - * - JPEG
463 - * - Max: 240 x 240
464 - * - Max: 1 MB
465 - */
466 - previewImageUrl: string;
467 -};
468 -/**
469 - * @see [Video message](https://developers.line.biz/en/reference/messaging-api/#video-message)
470 - */
471 -export declare type VideoMessage = MessageCommon & {
472 - type: "video";
473 - /**
474 - * URL of video file (Max: 1000 characters)
475 - *
476 - * - **HTTPS**
477 - * - mp4
478 - * - Max: 1 minute
479 - * - Max: 10 MB
480 - *
481 - * A very wide or tall video may be cropped when played in some environments.
482 - */
483 - originalContentUrl: string;
484 - /**
485 - * URL of preview image (Max: 1000 characters)
486 - *
487 - * - **HTTPS**
488 - * - JPEG
489 - * - Max: 240 x 240
490 - * - Max: 1 MB
491 - */
492 - previewImageUrl: string;
493 -};
494 -/**
495 - * @see [Audio message](https://developers.line.biz/en/reference/messaging-api/#audio-message)
496 - */
497 -export declare type AudioMessage = MessageCommon & {
498 - type: "audio";
499 - /**
500 - * URL of audio file (Max: 1000 characters)
501 - *
502 - * - **HTTPS**
503 - * - m4a
504 - * - Max: 1 minute
505 - * - Max: 10 MB
506 - */
507 - originalContentUrl: string;
508 - /**
509 - * Length of audio file (milliseconds)
510 - */
511 - duration: number;
512 -};
513 -/**
514 - * @see [Location message](https://developers.line.biz/en/reference/messaging-api/#location-message)
515 - */
516 -export declare type LocationMessage = MessageCommon & {
517 - type: "location";
518 - /**
519 - * Title (Max: 100 characters)
520 - */
521 - title: string;
522 - /**
523 - * Address (Max: 100 characters)
524 - */
525 - address: string;
526 - latitude: number;
527 - longitude: number;
528 -};
529 -/**
530 - * @see [Sticker message](https://developers.line.biz/en/reference/messaging-api/#sticker-message)
531 - */
532 -export declare type StickerMessage = MessageCommon & {
533 - type: "sticker";
534 - /**
535 - * Package ID for a set of stickers.
536 - * For information on package IDs, see the
537 - * [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
538 - */
539 - packageId: string;
540 - /**
541 - * Sticker ID.
542 - * For a list of sticker IDs for stickers that can be sent with the Messaging
543 - * API, see the
544 - * [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
545 - */
546 - stickerId: string;
547 -};
548 -/**
549 - * @see [Imagemap message](https://developers.line.biz/en/reference/messaging-api/#imagemap-message)
550 - */
551 -export declare type ImageMapMessage = MessageCommon & {
552 - type: "imagemap";
553 - /**
554 - * [Base URL](https://developers.line.biz/en/reference/messaging-api/#base-url) of image
555 - * (Max: 1000 characters, **HTTPS**)
556 - */
557 - baseUrl: string;
558 - /**
559 - * Alternative text (Max: 400 characters)
560 - */
561 - altText: string;
562 - baseSize: Size;
563 - /**
564 - * Video to play inside a image map messages
565 - */
566 - video?: {
567 - /**
568 - * URL of video file (Max: 1000 characters)
569 - *
570 - * - **HTTPS**
571 - * - mp4
572 - * - Max: 1 minute
573 - * - Max: 10 MB
574 - *
575 - * A very wide or tall video may be cropped when played in some environments.
576 - */
577 - originalContentUrl: string;
578 - /**
579 - * URL of preview image (Max: 1000 characters)
580 - *
581 - * - **HTTPS**
582 - * - JPEG
583 - * - Max: 240 x 240
584 - * - Max: 1 MB
585 - */
586 - previewImageUrl: string;
587 - area: Area;
588 - /**
589 - * External link to be displayed after a video is played
590 - * This property is required if you set a video to play and a label to display after the video on the imagemap
591 - */
592 - externalLink?: {
593 - linkUri: string;
594 - label: string;
595 - };
596 - };
597 - /**
598 - * Action when tapped (Max: 50)
599 - */
600 - actions: ImageMapAction[];
601 -};
602 -/**
603 - * Template messages are messages with predefined layouts which you can
604 - * customize. For more information, see
605 - * [template messages](https://developers.line.biz/en/docs/messaging-api/message-types/#template-messages).
606 - *
607 - * The following template types are available:
608 - *
609 - * - [Buttons](https://developers.line.biz/en/reference/messaging-api/#buttons)
610 - * - [Confirm](https://developers.line.biz/en/reference/messaging-api/#confirm)
611 - * - [Carousel](https://developers.line.biz/en/reference/messaging-api/#carousel)
612 - * - [Image carousel](https://developers.line.biz/en/reference/messaging-api/#image-carousel)
613 - *
614 - * @see [Template messages](https://developers.line.biz/en/reference/messaging-api/#template-messages)
615 - */
616 -export declare type TemplateMessage = MessageCommon & {
617 - type: "template";
618 - /**
619 - * Alternative text (Max: 400 characters)
620 - */
621 - altText: string;
622 - /**
623 - * Carousel template content
624 - */
625 - template: TemplateContent;
626 -};
627 -/**
628 - * Flex Messages are messages with a customizable layout.
629 - * You can customize the layout freely by combining multiple elements.
630 - * For more information, see
631 - * [Using Flex Messages](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/).
632 - *
633 - * @see [Flex messages](https://developers.line.biz/en/reference/messaging-api/#flex-message)
634 - */
635 -export declare type FlexMessage = MessageCommon & {
636 - type: "flex";
637 - altText: string;
638 - contents: FlexContainer;
639 -};
640 -/**
641 - * Object which specifies the actions and tappable regions of an imagemap.
642 - *
643 - * When a region is tapped, the user is redirected to the URI specified in
644 - * `uri` and the message specified in `message` is sent.
645 - *
646 - * @see [Imagemap action objects](https://developers.line.biz/en/reference/messaging-api/#imagemap-action-objects)
647 - */
648 -export declare type ImageMapAction = ImageMapURIAction | ImageMapMessageAction;
649 -export declare type ImageMapActionBase = {
650 - /** Defined tappable area */
651 - area: Area;
652 -};
653 -export declare type ImageMapURIAction = {
654 - type: "uri";
655 - /**
656 - * Webpage URL (Max: 1000 characters)
657 - */
658 - linkUri: string;
659 -} & ImageMapActionBase;
660 -export declare type ImageMapMessageAction = {
661 - type: "message";
662 - /**
663 - * Message to send (Max: 400 characters)
664 - */
665 - text: string;
666 -} & ImageMapActionBase;
667 -export declare type Area = {
668 - /**
669 - * Horizontal position relative to the top-left corner of the area
670 - */
671 - x: number;
672 - /**
673 - * Vertical position relative to the top-left corner of the area
674 - */
675 - y: number;
676 - /**
677 - * Width of the tappable area
678 - */
679 - width: number;
680 - /**
681 - * Height of the tappable area
682 - */
683 - height: number;
684 -};
685 -/**
686 - * A container is the top-level structure of a Flex Message. Here are the types of containers available.
687 - *
688 - * - [Bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
689 - * - [Carousel](https://developers.line.biz/en/reference/messaging-api/#f-carousel)
690 - *
691 - * See [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
692 - * for the containers' JSON data samples and usage.
693 - */
694 -export declare type FlexContainer = FlexBubble | FlexCarousel;
695 -/**
696 - * This is a container that contains one message bubble. It can contain four
697 - * blocks: header, hero, body, and footer.
698 - *
699 - * For more information about using each block, see
700 - * [Block](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/#block).
701 - */
702 -export declare type FlexBubble = {
703 - type: "bubble";
704 - size?: "nano" | "micro" | "kilo" | "mega" | "giga";
705 - /**
706 - * Text directionality and the order of components in horizontal boxes in the
707 - * container. Specify one of the following values:
708 - *
709 - * - `ltr`: Left to right
710 - * - `rtl`: Right to left
711 - *
712 - * The default value is `ltr`.
713 - */
714 - direction?: "ltr" | "rtl";
715 - header?: FlexBox;
716 - hero?: FlexBox | FlexImage;
717 - body?: FlexBox;
718 - footer?: FlexBox;
719 - styles?: FlexBubbleStyle;
720 - action?: Action;
721 -};
722 -export declare type FlexBubbleStyle = {
723 - header?: FlexBlockStyle;
724 - hero?: FlexBlockStyle;
725 - body?: FlexBlockStyle;
726 - footer?: FlexBlockStyle;
727 -};
728 -export declare type FlexBlockStyle = {
729 - /**
730 - * Background color of the block. Use a hexadecimal color code.
731 - */
732 - backgroundColor?: string;
733 - /**
734 - * - `true` to place a separator above the block.
735 - * - `true` will be ignored for the first block in a container because you
736 - * cannot place a separator above the first block.
737 - * - The default value is `false`.
738 - */
739 - separator?: boolean;
740 - /**
741 - * Color of the separator. Use a hexadecimal color code.
742 - */
743 - separatorColor?: string;
744 -};
745 -export declare type FlexCarousel = {
746 - type: "carousel";
747 - /**
748 - * (Max: 10 bubbles)
749 - */
750 - contents: FlexBubble[];
751 -};
752 -/**
753 - * Components are objects that compose a Flex Message container. Here are the
754 - * types of components available:
755 - *
756 - * - [Box](https://developers.line.biz/en/reference/messaging-api/#box)
757 - * - [Button](https://developers.line.biz/en/reference/messaging-api/#button)
758 - * - [Image](https://developers.line.biz/en/reference/messaging-api/#f-image)
759 - * - [Icon](https://developers.line.biz/en/reference/messaging-api/#icon)
760 - * - [Text](https://developers.line.biz/en/reference/messaging-api/#f-text)
761 - * - [Span](https://developers.line.biz/en/reference/messaging-api/#span)
762 - * - [Separator](https://developers.line.biz/en/reference/messaging-api/#separator)
763 - * - [Filler](https://developers.line.biz/en/reference/messaging-api/#filler)
764 - * - [Spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
765 - *
766 - * See the followings for the components' JSON data samples and usage.
767 - *
768 - * - [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
769 - * - [Flex Message layout](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/)
770 - */
771 -export declare type FlexComponent = FlexBox | FlexButton | FlexImage | FlexIcon | FlexText | FlexSpan | FlexSeparator | FlexFiller | FlexSpacer;
772 -/**
773 - * This is a component that defines the layout of child components.
774 - * You can also include a box in a box.
775 - */
776 -export declare type FlexBox = {
777 - type: "box";
778 - /**
779 - * The placement style of components in this box. Specify one of the following values:
780 - *
781 - * - `horizontal`: Components are placed horizontally. The `direction`
782 - * property of the [bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
783 - * container specifies the order.
784 - * - `vertical`: Components are placed vertically from top to bottom.
785 - * - `baseline`: Components are placed in the same way as `horizontal` is
786 - * specified except the baselines of the components are aligned.
787 - *
788 - * For more information, see
789 - * [Types of box layouts](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-layout-types).
790 - */
791 - layout: "horizontal" | "vertical" | "baseline";
792 - /**
793 - * Components in this box. Here are the types of components available:
794 - *
795 - * - When the `layout` property is `horizontal` or `vertical`:
796 - * + [Box](https://developers.line.biz/en/reference/messaging-api/#box)
797 - * + [button](https://developers.line.biz/en/reference/messaging-api/#button)
798 - * + [image](https://developers.line.biz/en/reference/messaging-api/#f-image)
799 - * + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
800 - * + [separator](https://developers.line.biz/en/reference/messaging-api/#separator)
801 - * + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
802 - * + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
803 - * - When the `layout` property is `baseline`:
804 - * + [icon](https://developers.line.biz/en/reference/messaging-api/#icon)
805 - * + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
806 - * + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
807 - * + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
808 - */
809 - contents: FlexComponent[];
810 - /**
811 - * Background color of the block. In addition to the RGB color, an alpha
812 - * channel (transparency) can also be set. Use a hexadecimal color code.
813 - * (Example:#RRGGBBAA) The default value is `#00000000`.
814 - */
815 - backgroundColor?: string;
816 - /**
817 - * Color of box border. Use a hexadecimal color code.
818 - */
819 - borderColor?: string;
820 - /**
821 - * Width of box border. You can specify a value in pixels or any one of none,
822 - * light, normal, medium, semi-bold, or bold. none does not render a border
823 - * while the others become wider in the order of listing.
824 - */
825 - borderWidth?: string | "none" | "light" | "normal" | "medium" | "semi-bold" | "bold";
826 - /**
827 - * Radius at the time of rounding the corners of the border. You can specify a
828 - * value in pixels or any one of `none`, `xs`, `sm`, `md`, `lg`, `xl`, or `xxl`. none does not
829 - * round the corner while the others increase in radius in the order of listing. The default value is none.
830 - */
831 - cornerRadius?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
832 - /**
833 - * Width of the box. For more information, see [Width of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-width) in the API documentation.
834 - */
835 - width?: string;
836 - /**
837 - * Height of the box. For more information, see [Height of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-height) in the API documentation.
838 - */
839 - height?: string;
840 - /**
841 - * The ratio of the width or height of this box within the parent box. The
842 - * default value for the horizontal parent box is `1`, and the default value
843 - * for the vertical parent box is `0`.
844 - *
845 - * For more information, see
846 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
847 - */
848 - flex?: number;
849 - /**
850 - * Minimum space between components in this box.
851 - *
852 - * - `none` does not set a space while the other values set a space whose
853 - * size increases in the order of listing.
854 - * - The default value is `none`.
855 - * - To override this setting for a specific component, set the `margin`
856 - * property of that component.
857 - */
858 - spacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
859 - /**
860 - * Minimum space between this box and the previous component in the parent box.
861 - *
862 - * - `none` does not set a space while the other values set a space whose
863 - * size increases in the order of listing.
864 - * - The default value is the value of the `spacing` property of the parent
865 - * box.
866 - * - If this box is the first component in the parent box, the `margin`
867 - * property will be ignored.
868 - */
869 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
870 - /**
871 - * Free space between the borders of this box and the child element.
872 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
873 - */
874 - paddingAll?: string;
875 - /**
876 - * Free space between the border at the upper end of this box and the upper end of the child element.
877 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
878 - */
879 - paddingTop?: string;
880 - /**
881 - * Free space between the border at the lower end of this box and the lower end of the child element.
882 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
883 - */
884 - paddingBottom?: string;
885 - /**
886 - * Free space between the border at the left end of this box and the left end of the child element.
887 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
888 - */
889 - paddingStart?: string;
890 - /**
891 - * Free space between the border at the right end of this box and the right end of the child element.
892 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
893 - */
894 - paddingEnd?: string;
895 - /**
896 - * Action performed when this button is tapped.
897 - *
898 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
899 - */
900 - action?: Action;
901 -} & Offset;
902 -export declare type Offset = {
903 - /**
904 - * Reference position for placing this box. Specify one of the following values:
905 - * - `relative`: Use the previous box as reference.
906 - * - `absolute`: Use the top left of parent element as reference.
907 - *
908 - * The default value is relative.
909 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
910 - */
911 - position?: "relative" | "absolute";
912 - /**
913 - * The top offset.
914 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
915 - */
916 - offsetTop?: string;
917 - /**
918 - * The bottom offset.
919 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
920 - */
921 - offsetBottom?: string;
922 - /**
923 - * The left offset.
924 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
925 - */
926 - offsetStart?: string;
927 - /**
928 - * The right offset.
929 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
930 - */
931 - offsetEnd?: string;
932 -};
933 -/**
934 - * This component draws a button.
935 - *
936 - * When the user taps a button, a specified action is performed.
937 - */
938 -export declare type FlexButton = {
939 - type: "button";
940 - /**
941 - * Action performed when this button is tapped.
942 - *
943 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
944 - */
945 - action: Action;
946 - /**
947 - * The ratio of the width or height of this box within the parent box.
948 - *
949 - * The default value for the horizontal parent box is `1`, and the default
950 - * value for the vertical parent box is `0`.
951 - *
952 - * For more information, see
953 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
954 - */
955 - flex?: number;
956 - /**
957 - * Minimum space between this box and the previous component in the parent box.
958 - *
959 - * - `none` does not set a space while the other values set a space whose
960 - * size increases in the order of listing.
961 - * - The default value is the value of the `spacing` property of the parent
962 - * box.
963 - * - If this box is the first component in the parent box, the `margin`
964 - * property will be ignored.
965 - */
966 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
967 - /**
968 - * Height of the button. The default value is `md`.
969 - */
970 - height?: "sm" | "md";
971 - /**
972 - * Style of the button. Specify one of the following values:
973 - *
974 - * - `link`: HTML link style
975 - * - `primary`: Style for dark color buttons
976 - * - `secondary`: Style for light color buttons
977 - *
978 - * The default value is `link`.
979 - */
980 - style?: "link" | "primary" | "secondary";
981 - /**
982 - * Use a hexadecimal color code.
983 - *
984 - * - Character color when the `style` property is `link`.
985 - * - Background color when the `style` property is `primary` or `secondary`.
986 - */
987 - color?: string;
988 - /**
989 - * Vertical alignment style. Specify one of the following values:
990 - *
991 - * - `top`: Top-aligned
992 - * - `bottom`: Bottom-aligned
993 - * - `center`: Center-aligned
994 - *
995 - * The default value is `top`.
996 - *
997 - * If the `layout` property of the parent box is `baseline`, the `gravity`
998 - * property will be ignored.
999 - */
1000 - gravity?: "top" | "bottom" | "center";
1001 -} & Offset;
1002 -/**
1003 - * This is an invisible component to fill extra space between components.
1004 - *
1005 - * - The filler's `flex` property is fixed to 1.
1006 - * - The `spacing` property of the parent box will be ignored for fillers.
1007 - */
1008 -export declare type FlexFiller = {
1009 - type: "filler";
1010 - /**
1011 - * The ratio of the width or height of this component within the parent box. For more information, see [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1012 - */
1013 - flex?: number;
1014 -};
1015 -/**
1016 - * This component draws an icon.
1017 - */
1018 -export declare type FlexIcon = {
1019 - type: "icon";
1020 - /**
1021 - * Image URL
1022 - *
1023 - * Protocol: HTTPS
1024 - * Image format: JPEG or PNG
1025 - * Maximum image size: 240×240 pixels
1026 - * Maximum data size: 1 MB
1027 - */
1028 - url: string;
1029 - /**
1030 - * Minimum space between this box and the previous component in the parent
1031 - * box.
1032 - *
1033 - * - `none` does not set a space while the other values set a space whose
1034 - * size increases in the order of listing.
1035 - * - The default value is the value of the `spacing` property of the parent
1036 - * box.
1037 - * - If this box is the first component in the parent box, the `margin`
1038 - * property will be ignored.
1039 - */
1040 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1041 - /**
1042 - * Maximum size of the icon width.
1043 - * The size increases in the order of listing.
1044 - * The default value is `md`.
1045 - */
1046 - size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
1047 - /**
1048 - * Aspect ratio of the icon. The default value is `1:1`.
1049 - */
1050 - aspectRatio?: "1:1" | "2:1" | "3:1";
1051 -} & Offset;
1052 -/**
1053 - * This component draws an image.
1054 - */
1055 -export declare type FlexImage = {
1056 - type: "image";
1057 - /**
1058 - * Image URL
1059 - *
1060 - * - Protocol: HTTPS
1061 - * - Image format: JPEG or PNG
1062 - * - Maximum image size: 1024×1024 pixels
1063 - * - Maximum data size: 1 MB
1064 - */
1065 - url: string;
1066 - /**
1067 - * The ratio of the width or height of this box within the parent box.
1068 - *
1069 - * The default value for the horizontal parent box is `1`, and the default
1070 - * value for the vertical parent box is `0`.
1071 - *
1072 - * - For more information, see
1073 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1074 - */
1075 - flex?: number;
1076 - /**
1077 - * Minimum space between this box and the previous component in the parent
1078 - * box.
1079 - *
1080 - * - `none` does not set a space while the other values set a space whose
1081 - * size increases in the order of listing.
1082 - * - The default value is the value of the `spacing` property of the parent
1083 - * box.
1084 - * - If this box is the first component in the parent box, the `margin`
1085 - * property will be ignored.
1086 - */
1087 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1088 - /**
1089 - * Horizontal alignment style. Specify one of the following values:
1090 - *
1091 - * - `start`: Left-aligned
1092 - * - `end`: Right-aligned
1093 - * - `center`: Center-aligned
1094 - *
1095 - * The default value is `center`.
1096 - */
1097 - align?: "start" | "end" | "center";
1098 - /**
1099 - * Vertical alignment style. Specify one of the following values:
1100 - *
1101 - * - `top`: Top-aligned
1102 - * - `bottom`: Bottom-aligned
1103 - * - `center`: Center-aligned
1104 - *
1105 - * The default value is `top`.
1106 - *
1107 - * If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored.
1108 - */
1109 - gravity?: "top" | "bottom" | "center";
1110 - /**
1111 - * Maximum size of the image width.
1112 - * The size increases in the order of listing.
1113 - * The default value is `md`.
1114 - */
1115 - size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" | "full";
1116 - /**
1117 - * Aspect ratio of the image.
1118 - * The default value is `1:1`.
1119 - */
1120 - aspectRatio?: "1:1" | "1.51:1" | "1.91:1" | "4:3" | "16:9" | "20:13" | "2:1" | "3:1" | "3:4" | "9:16" | "1:2" | "1:3";
1121 - /**
1122 - * Style of the image. Specify one of the following values:
1123 - *
1124 - * - `cover`: The image fills the entire drawing area. Parts of the image
1125 - * that do not fit in the drawing area are not displayed.
1126 - * - `fit`: The entire image is displayed in the drawing area. The background
1127 - * is displayed in the unused areas to the left and right of vertical images
1128 - * and in the areas above and below horizontal images.
1129 - *
1130 - * The default value is `fit`.
1131 - */
1132 - aspectMode?: "cover" | "fit";
1133 - /**
1134 - * Background color of the image. Use a hexadecimal color code.
1135 - */
1136 - backgroundColor?: string;
1137 - /**
1138 - * Action performed when this button is tapped.
1139 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1140 - */
1141 - action?: Action;
1142 -} & Offset;
1143 -/**
1144 - * This component draws a separator between components in the parent box.
1145 - */
1146 -export declare type FlexSeparator = {
1147 - type: "separator";
1148 - /**
1149 - * Minimum space between this box and the previous component in the parent
1150 - * box.
1151 - *
1152 - * - `none` does not set a space while the other values set a space whose
1153 - * size increases in the order of listing.
1154 - * - The default value is the value of the `spacing` property of the parent
1155 - * box.
1156 - * - If this box is the first component in the parent box, the `margin`
1157 - * property will be ignored.
1158 - */
1159 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1160 - /**
1161 - * Color of the separator. Use a hexadecimal color code.
1162 - */
1163 - color?: string;
1164 -};
1165 -/**
1166 - * This is an invisible component that places a fixed-size space at the
1167 - * beginning or end of the box.
1168 - */
1169 -export declare type FlexSpacer = {
1170 - type: "spacer";
1171 - /**
1172 - * Size of the space.
1173 - * The size increases in the order of listing.
1174 - * The default value is `md`.
1175 - */
1176 - size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1177 -};
1178 -export declare type FlexText = {
1179 - type: "text";
1180 - text: string;
1181 - /**
1182 - * Array of spans. Be sure to set either one of the `text` property or `contents` property. If you set the `contents` property, `text` is ignored.
1183 - */
1184 - contents?: FlexSpan[];
1185 - /**
1186 - * The ratio of the width or height of this box within the parent box.
1187 - *
1188 - * The default value for the horizontal parent box is `1`, and the default
1189 - * value for the vertical parent box is `0`.
1190 - *
1191 - * For more information, see
1192 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1193 - */
1194 - flex?: number;
1195 - /**
1196 - * Minimum space between this box and the previous component in the parent
1197 - * box.
1198 - *
1199 - * - `none` does not set a space while the other values set a space whose
1200 - * size increases in the order of listing.
1201 - * - The default value is the value of the `spacing` property of the parent
1202 - * box.
1203 - * - If this box is the first component in the parent box, the `margin`
1204 - * property will be ignored.
1205 - */
1206 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1207 - /**
1208 - * Font size.
1209 - * The size increases in the order of listing.
1210 - * The default value is `md`.
1211 - */
1212 - size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
1213 - /**
1214 - * Horizontal alignment style. Specify one of the following values:
1215 - *
1216 - * - `start`: Left-aligned
1217 - * - `end`: Right-aligned
1218 - * - `center`: Center-aligned
1219 - *
1220 - * The default value is `start`.
1221 - */
1222 - align?: "start" | "end" | "center";
1223 - /**
1224 - * Vertical alignment style. Specify one of the following values:
1225 - *
1226 - * - `top`: Top-aligned
1227 - * - `bottom`: Bottom-aligned
1228 - * - `center`: Center-aligned
1229 - *
1230 - * The default value is `top`.
1231 - *
1232 - * If the `layout` property of the parent box is `baseline`, the `gravity`
1233 - * property will be ignored.
1234 - */
1235 - gravity?: "top" | "bottom" | "center";
1236 - /**
1237 - * `true` to wrap text.
1238 - *
1239 - * The default value is `false`.
1240 - *
1241 - * If set to `true`, you can use a new line character (\n) to begin on a new
1242 - * line.
1243 - */
1244 - wrap?: boolean;
1245 - /**
1246 - * Max number of lines. If the text does not fit in the specified number of
1247 - * lines, an ellipsis (…) is displayed at the end of the last line. If set to
1248 - * 0, all the text is displayed. The default value is 0.
1249 - */
1250 - maxLines?: number;
1251 - /**
1252 - * Font weight.
1253 - * Specifying `bold`makes the font bold.
1254 - * The default value is `regular`.
1255 - */
1256 - weight?: "regular" | "bold";
1257 - /**
1258 - * Font color. Use a hexadecimal color code.
1259 - */
1260 - color?: string;
1261 - /**
1262 - * Action performed when this text is tapped.
1263 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1264 - */
1265 - action?: Action;
1266 - /**
1267 - * Style of the text. Specify one of the following values:
1268 - * - `normal`: Normal
1269 - * - `italic`: Italic
1270 - *
1271 - * The default value is `normal`.
1272 - */
1273 - style?: string;
1274 - /**
1275 - * Decoration of the text. Specify one of the following values:
1276 - * `none`: No decoration
1277 - * `underline`: Underline
1278 - * `line-through`: Strikethrough
1279 - *
1280 - * The default value is `none`.
1281 - */
1282 - decoration?: string;
1283 -} & Offset;
1284 -/**
1285 - * This component renders multiple text strings with different designs in one row. You can specify the color, size, weight, and decoration for the font. Span is set to `contents` property in [Text](https://developers.line.biz/en/reference/messaging-api/#f-text).
1286 - */
1287 -export declare type FlexSpan = {
1288 - type: "span";
1289 - /**
1290 - * Text. If the `wrap` property of the parent text is set to `true`, you can use a new line character (`\n`) to begin on a new line.
1291 - */
1292 - text: string;
1293 - /**
1294 - * Font color. Use a hexadecimal color code.
1295 - */
1296 - color?: string;
1297 - /**
1298 - * Font size. You can specify one of the following values: `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `xxl`, `3xl`, `4xl`, or `5xl`. The size increases in the order of listing. The default value is `md`.
1299 - */
1300 - size?: string;
1301 - /**
1302 - * Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
1303 - */
1304 - weight?: string;
1305 - /**
1306 - * Style of the text. Specify one of the following values:
1307 - * - `normal`: Normal
1308 - * - `italic`: Italic
1309 - *
1310 - * The default value is `normal`.
1311 - */
1312 - style?: string;
1313 - /**
1314 - * Decoration of the text. Specify one of the following values:
1315 - * `none`: No decoration
1316 - * `underline`: Underline
1317 - * `line-through`: Strikethrough
1318 - *
1319 - * The default value is `none`.
1320 - *
1321 - * Note: The decoration set in the `decoration` property of the [text](https://developers.line.biz/en/reference/messaging-api/#f-text) cannot be overwritten by the `decoration` property of the span.
1322 - */
1323 - decoration?: string;
1324 -};
1325 -export declare type TemplateContent = TemplateButtons | TemplateConfirm | TemplateCarousel | TemplateImageCarousel;
1326 -/**
1327 - * Template with an image, title, text, and multiple action buttons.
1328 - *
1329 - * Because of the height limitation for buttons template messages, the lower
1330 - * part of the text display area will get cut off if the height limitation is
1331 - * exceeded. For this reason, depending on the character width, the message
1332 - * text may not be fully displayed even when it is within the character limits.
1333 - */
1334 -export declare type TemplateButtons = {
1335 - type: "buttons";
1336 - /**
1337 - * Image URL (Max: 1000 characters)
1338 - *
1339 - * - HTTPS
1340 - * - JPEG or PNG
1341 - * - Max width: 1024px
1342 - * - Max: 1 MB
1343 - */
1344 - thumbnailImageUrl?: string;
1345 - /**
1346 - * Aspect ratio of the image. Specify one of the following values:
1347 - *
1348 - * - `rectangle`: 1.51:1
1349 - * - `square`: 1:1
1350 - *
1351 - * The default value is `rectangle`
1352 - */
1353 - imageAspectRatio?: "rectangle" | "square";
1354 - /**
1355 - * Size of the image. Specify one of the following values:
1356 - *
1357 - * - `cover`: The image fills the entire image area. Parts of the image that
1358 - * do not fit in the area are not displayed.
1359 - * - `contain`: The entire image is displayed in the image area. A background
1360 - * is displayed in the unused areas to the left and right of vertical images
1361 - * and in the areas above and below horizontal images.
1362 - *
1363 - * The default value is `cover`.
1364 - */
1365 - imageSize?: "cover" | "contain";
1366 - /**
1367 - * Background color of image. Specify a RGB color value.
1368 - * The default value is `#FFFFFF` (white).
1369 - */
1370 - imageBackgroundColor?: string;
1371 - /**
1372 - * Title (Max: 40 characters)
1373 - */
1374 - title?: string;
1375 - /**
1376 - * Message text
1377 - *
1378 - * - Max: 160 characters (no image or title)
1379 - * - Max: 60 characters (message with an image or title)
1380 - */
1381 - text: string;
1382 - /**
1383 - * Action when tapped (Max: 4)
1384 - */
1385 - actions: Action[];
1386 -};
1387 -/**
1388 - * Template with two action buttons.
1389 - *
1390 - * Because of the height limitation for confirm template messages, the lower
1391 - * part of the `text` display area will get cut off if the height limitation is
1392 - * exceeded. For this reason, depending on the character width, the message
1393 - * text may not be fully displayed even when it is within the character limits.
1394 - */
1395 -export declare type TemplateConfirm = {
1396 - type: "confirm";
1397 - /**
1398 - * Message text (Max: 240 characters)
1399 - */
1400 - text: string;
1401 - /**
1402 - * Action when tapped. Set 2 actions for the 2 buttons
1403 - */
1404 - actions: Action[];
1405 -};
1406 -/**
1407 - * Template with multiple columns which can be cycled like a carousel.
1408 - * The columns will be shown in order by scrolling horizontally.
1409 - *
1410 - * Because of the height limitation for carousel template messages, the lower
1411 - * part of the `text` display area will get cut off if the height limitation is
1412 - * exceeded. For this reason, depending on the character width, the message
1413 - * text may not be fully displayed even when it is within the character limits.
1414 - *
1415 - * Keep the number of actions consistent for all columns. If you use an image
1416 - * or title for a column, make sure to do the same for all other columns.
1417 - */
1418 -export declare type TemplateCarousel = {
1419 - type: "carousel";
1420 - /**
1421 - * Array of columns (Max: 10)
1422 - */
1423 - columns: TemplateColumn[];
1424 - /**
1425 - * Aspect ratio of the image. Specify one of the following values:
1426 - *
1427 - * - `rectangle`: 1.51:1
1428 - * - `square`: 1:1
1429 - *
1430 - * Applies to all columns. The default value is `rectangle`.
1431 - */
1432 - imageAspectRatio?: "rectangle" | "square";
1433 - /**
1434 - * Size of the image. Specify one of the following values:
1435 - *
1436 - * - `cover`: The image fills the entire image area. Parts of the image that
1437 - * do not fit in the area are not displayed.
1438 - * - `contain`: The entire image is displayed in the image area. A background
1439 - * is displayed in the unused areas to the left and right of vertical images
1440 - * and in the areas above and below horizontal images.
1441 - *
1442 - * Applies to all columns. The default value is `cover`.
1443 - */
1444 - imageSize?: "cover" | "contain";
1445 -};
1446 -export declare type TemplateColumn = {
1447 - /**
1448 - * Image URL (Max: 1000 characters)
1449 - *
1450 - * - HTTPS
1451 - * - JPEG or PNG
1452 - * - Aspect ratio: 1:1.51
1453 - * - Max width: 1024px
1454 - * - Max: 1 MB
1455 - */
1456 - thumbnailImageUrl?: string;
1457 - /**
1458 - * Background color of image. Specify a RGB color value.
1459 - * The default value is `#FFFFFF` (white).
1460 - */
1461 - imageBackgroundColor?: string;
1462 - /**
1463 - * Title (Max: 40 characters)
1464 - */
1465 - title?: string;
1466 - /**
1467 - * Message text
1468 - *
1469 - * - Max: 120 characters (no image or title)
1470 - * - Max: 60 characters (message with an image or title)
1471 - */
1472 - text: string;
1473 - /**
1474 - * Action when image is tapped; set for the entire image, title, and text area
1475 - */
1476 - defaultAction?: Action;
1477 - /**
1478 - * Action when tapped (Max: 3)
1479 - */
1480 - actions: Action[];
1481 -};
1482 -/**
1483 - * Template with multiple images which can be cycled like a carousel.
1484 - * The images will be shown in order by scrolling horizontally.
1485 - */
1486 -export declare type TemplateImageCarousel = {
1487 - type: "image_carousel";
1488 - /**
1489 - * Array of columns (Max: 10)
1490 - */
1491 - columns: TemplateImageColumn[];
1492 -};
1493 -export declare type TemplateImageColumn = {
1494 - /**
1495 - * Image URL (Max: 1000 characters)
1496 - *
1497 - * - HTTPS
1498 - * - JPEG or PNG
1499 - * - Aspect ratio: 1:1
1500 - * - Max width: 1024px
1501 - * - Max: 1 MB
1502 - */
1503 - imageUrl: string;
1504 - /**
1505 - * Action when image is tapped
1506 - */
1507 - action: Action<{
1508 - label?: string;
1509 - }>;
1510 -};
1511 -/**
1512 - * These properties are used for the quick reply.
1513 - *
1514 - * For more information, see
1515 - * [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
1516 - */
1517 -export declare type QuickReply = {
1518 - /**
1519 - * This is a container that contains
1520 - * [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
1521 - *
1522 - * Array of objects (Max: 13)
1523 - */
1524 - items: QuickReplyItem[];
1525 -};
1526 -/**
1527 - * This is a quick reply option that is displayed as a button.
1528 - *
1529 - * For more information, see
1530 - * [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
1531 - */
1532 -export declare type QuickReplyItem = {
1533 - type: "action";
1534 - /**
1535 - * URL of the icon that is displayed at the beginning of the button (Max: 1000 characters)
1536 - *
1537 - * - URL scheme: https
1538 - * - Image format: PNG
1539 - * - Aspect ratio: 1:1
1540 - * - Data size: Up to 1 MB
1541 - *
1542 - * There is no limit on the image size. If the `action` property has the
1543 - * following actions with empty `imageUrl`:
1544 - *
1545 - * - [camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1546 - * - [camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1547 - * - [location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1548 - *
1549 - * the default icon is displayed.
1550 - */
1551 - imageUrl?: string;
1552 - /**
1553 - * Action performed when this button is tapped.
1554 - *
1555 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1556 - *
1557 - * The following is a list of the available actions:
1558 - *
1559 - * - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
1560 - * - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
1561 - * - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
1562 - * - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1563 - * - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1564 - * - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1565 - */
1566 - action: Action;
1567 -};
1568 -/**
1569 - * These are types of actions for your bot to take when a user taps a button or an image in a message.
1570 - *
1571 - * - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
1572 - * - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
1573 - * - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
1574 - * - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
1575 - * - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1576 - * - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1577 - * - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1578 - */
1579 -export declare type Action<ExtraFields = {
1580 - label: string;
1581 -}> = (PostbackAction | MessageAction | URIAction | DatetimePickerAction | {
1582 - type: "camera";
1583 -} | {
1584 - type: "cameraRoll";
1585 -} | {
1586 - type: "location";
1587 -}) & ExtraFields;
1588 -/**
1589 - * When a control associated with this action is tapped, a postback event is
1590 - * returned via webhook with the specified string in the data property.
1591 - */
1592 -export declare type PostbackAction = {
1593 - type: "postback";
1594 - /**
1595 - * String returned via webhook in the `postback.data` property of the
1596 - * postback event (Max: 300 characters)
1597 - */
1598 - data: string;
1599 - /**
1600 - * Text displayed in the chat as a message sent by the user when the action
1601 - * is performed. Returned from the server through a webhook.
1602 - *
1603 - * - This property cannot be used with quick reply buttons. (Max: 300 characters)
1604 - * - The `displayText` and `text` properties cannot both be used at the same time.
1605 - * @deprecated
1606 - */
1607 - text?: string;
1608 - /**
1609 - * Text displayed in the chat as a message sent by the user when the action is performed.
1610 - *
1611 - * - Required for quick reply buttons.
1612 - * - Optional for the other message types.
1613 - *
1614 - * Max: 300 characters
1615 - *
1616 - * The `displayText` and `text` properties cannot both be used at the same time.
1617 - */
1618 - displayText?: string;
1619 -};
1620 -/**
1621 - * When a control associated with this action is tapped, the string in the text
1622 - * property is sent as a message from the user.
1623 - */
1624 -export declare type MessageAction = {
1625 - type: "message";
1626 - /**
1627 - * Text sent when the action is performed (Max: 300 characters)
1628 - */
1629 - text: string;
1630 -};
1631 -/**
1632 - * When a control associated with this action is tapped, the URI specified in
1633 - * the `uri` property is opened.
1634 - */
1635 -export declare type URIAction = {
1636 - type: "uri";
1637 - /**
1638 - * URI opened when the action is performed (Max: 1000 characters).
1639 - * Must start with `http`, `https`, or `tel`.
1640 - */
1641 - uri: string;
1642 - altUri?: AltURI;
1643 -};
1644 -/**
1645 - * URI opened on LINE for macOS and Windows when the action is performed (Max: 1000 characters)
1646 - * If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.
1647 - * The available schemes are http, https, line, and tel.
1648 - * For more information about the LINE URL scheme, see Using the LINE URL scheme.
1649 - * This property is supported on the following version of LINE.
1650 - *
1651 - * LINE 5.12.0 or later for macOS and Windows
1652 - * Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.
1653 - */
1654 -export declare type AltURI = {
1655 - desktop: string;
1656 -};
1657 -/**
1658 - * When a control associated with this action is tapped, a
1659 - * [postback event](https://developers.line.biz/en/reference/messaging-api/#postback-event)
1660 - * is returned via webhook with the date and time selected by the user from the
1661 - * date and time selection dialog.
1662 - *
1663 - * The datetime picker action does not support time zones.
1664 - *
1665 - * #### Date and time format
1666 - *
1667 - * The date and time formats for the `initial`, `max`, and `min` values are
1668 - * shown below. The `full-date`, `time-hour`, and `time-minute` formats follow
1669 - * the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) protocol.
1670 - *
1671 - * | Mode | Format | Example |
1672 - * | -------- | ------------------------------------------------------------ | -------------------------------- |
1673 - * | date | `full-date` (Max: 2100-12-31; Min: 1900-01-01) | 2017-06-18 |
1674 - * | time | `time-hour`:`time-minute` (Max: 23:59; Min: 00:00) | 00:0006:1523:59 |
1675 - * | datetime | `full-date`T`time-hour`:`time-minute` or `full-date`t`time-hour`:`time-minute` (Max: 2100-12-31T23:59; Min: 1900-01-01T00:00) | 2017-06-18T06:152017-06-18t06:15 |
1676 - */
1677 -export declare type DatetimePickerAction = {
1678 - type: "datetimepicker";
1679 - /**
1680 - * String returned via webhook in the `postback.data` property of the
1681 - * postback event (Max: 300 characters)
1682 - */
1683 - data: string;
1684 - mode: "date" | "time" | "datetime";
1685 - /**
1686 - * Initial value of date or time
1687 - */
1688 - initial?: string;
1689 - /**
1690 - * Largest date or time value that can be selected. Must be greater than the
1691 - * `min` value.
1692 - */
1693 - max?: string;
1694 - /**
1695 - * Smallest date or time value that can be selected. Must be less than the
1696 - * `max` value.
1697 - */
1698 - min?: string;
1699 -};
1700 -export declare type Size = {
1701 - width: number;
1702 - height: number;
1703 -};
1704 -/**
1705 - * Rich menus consist of either of these objects.
1706 - *
1707 - * - [Rich menu object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-object)
1708 - * without the rich menu ID. Use this object when you
1709 - * [create a rich menu](https://developers.line.biz/en/reference/messaging-api/#create-rich-menu).
1710 - * - [Rich menu response object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-response-object)
1711 - * with the rich menu ID. This object is returned when you
1712 - * [get a rich menu](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu)
1713 - * or [get a list of rich menus](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list).
1714 - *
1715 - * [Area objects](https://developers.line.biz/en/reference/messaging-api/#area-object) and
1716 - * [action objects](https://developers.line.biz/en/reference/messaging-api/#action-objects)
1717 - * are included in these objects.
1718 - */
1719 -export declare type RichMenu = {
1720 - /**
1721 - * [`size` object](https://developers.line.biz/en/reference/messaging-api/#size-object)
1722 - * which contains the width and height of the rich menu displayed in the chat.
1723 - * Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px.
1724 - */
1725 - size: Size;
1726 - /**
1727 - * `true` to display the rich menu by default. Otherwise, `false`.
1728 - */
1729 - selected: boolean;
1730 - /**
1731 - * Name of the rich menu.
1732 - *
1733 - * This value can be used to help manage your rich menus and is not displayed
1734 - * to users.
1735 - *
1736 - * (Max: 300 characters)
1737 - */
1738 - name: string;
1739 - /**
1740 - * Text displayed in the chat bar (Max: 14 characters)
1741 - */
1742 - chatBarText: string;
1743 - /**
1744 - * Array of [area objects](https://developers.line.biz/en/reference/messaging-api/#area-object)
1745 - * which define the coordinates and size of tappable areas
1746 - * (Max: 20 area objects)
1747 - */
1748 - areas: Array<{
1749 - bounds: Area;
1750 - action: Action<{}>;
1751 - }>;
1752 -};
1753 -export declare type RichMenuResponse = {
1754 - richMenuId: string;
1755 -} & RichMenu;
1756 -export declare type NumberOfMessagesSentResponse = InsightStatisticsResponse & {
1757 - /**
1758 - * The number of messages sent with the Messaging API on the date specified in date.
1759 - * The response has this property only when the value of status is `ready`.
1760 - */
1761 - success?: number;
1762 -};
1763 -export declare type TargetLimitForAdditionalMessages = {
1764 - /**
1765 - * One of the following values to indicate whether a target limit is set or not.
1766 - * - `none`: This indicates that a target limit is not set.
1767 - * - `limited`: This indicates that a target limit is set.
1768 - */
1769 - type: "none" | "limited";
1770 - /**
1771 - * The target limit for additional messages in the current month.
1772 - * This property is returned when the `type` property has a value of `limited`.
1773 - */
1774 - value?: number;
1775 -};
1776 -export declare type NumberOfMessagesSentThisMonth = {
1777 - /**
1778 - * The number of sent messages in the current month
1779 - */
1780 - totalUsage: number;
1781 -};
1782 -export declare const LINE_REQUEST_ID_HTTP_HEADER_NAME = "x-line-request-id";
1783 -export declare type MessageAPIResponseBase = {
1784 - [LINE_REQUEST_ID_HTTP_HEADER_NAME]?: string;
1785 -};
1786 -export declare type InsightStatisticsResponse = {
1787 - /**
1788 - * Calculation status. One of:
1789 - * - `ready`: Calculation has finished; the numbers are up-to-date.
1790 - * - `unready`: We haven't finished calculating the number of sent messages for the specified `date`. Calculation usually takes about a day. Please try again later.
1791 - * - `out_of_service`: The specified `date` is earlier than the date on which we first started calculating sent messages. Different APIs have different date. Check them at the [document](https://developers.line.biz/en/reference/messaging-api/).
1792 - */
1793 - status: "ready" | "unready" | "out_of_service";
1794 -};
1795 -export declare type NumberOfMessageDeliveries = InsightStatisticsResponse & {
1796 - /**
1797 - * Number of push messages sent to **all** of this LINE official account's friends (broadcast messages).
1798 - */
1799 - broadcast: number;
1800 - /**
1801 - * Number of push messages sent to **some** of this LINE official account's friends, based on specific attributes (targeted/segmented messages).
1802 - */
1803 - targeting: number;
1804 - /**
1805 - * Number of auto-response messages sent.
1806 - */
1807 - autoResponse: number;
1808 - /**
1809 - * Number of greeting messages sent.
1810 - */
1811 - welcomeResponse: number;
1812 - /**
1813 - * Number of messages sent from LINE Official Account Manager [Chat screen](https://www.linebiz.com/jp-en/manual/OfficialAccountManager/chats/screens/).
1814 - */
1815 - chat: number;
1816 - /**
1817 - * Number of broadcast messages sent with the [Send broadcast message](https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message) Messaging API operation.
1818 - */
1819 - apiBroadcast: number;
1820 - /**
1821 - * Number of push messages sent with the [Send push message](https://developers.line.biz/en/reference/messaging-api/#send-push-message) Messaging API operation.
1822 - */
1823 - apiPush: number;
1824 - /**
1825 - * Number of multicast messages sent with the [Send multicast message](https://developers.line.biz/en/reference/messaging-api/#send-multicast-message) Messaging API operation.
1826 - */
1827 - apiMulticast: number;
1828 - /**
1829 - * Number of replies sent with the [Send reply message](https://developers.line.biz/en/reference/messaging-api/#send-reply-message) Messaging API operation.
1830 - */
1831 - apiReply: number;
1832 -};
1833 -export declare type NumberOfFollowers = InsightStatisticsResponse & {
1834 - /**
1835 - * The number of times, as of the specified `date`, that a user added this LINE official account as a friend. The number doesn't decrease when a user blocks the account after adding it, or when they delete their own account.
1836 - */
1837 - followers: Number;
1838 - /**
1839 - * The number of users, as of the specified `date`, that the official account can reach with messages targeted by gender, age, or area. This number includes users for whom we estimated demographic attributes based on their activity in LINE and LINE-connected services.
1840 - */
1841 - targetedReaches: Number;
1842 - /**
1843 - * The number of users blocking the account as of the specified `date`. The number decreases when a user unblocks the account.
1844 - */
1845 - blocks: Number;
1846 -};
1847 -export declare type NumberOfMessageDeliveriesResponse = InsightStatisticsResponse | NumberOfMessageDeliveries;
1848 -export declare type NumberOfFollowersResponse = InsightStatisticsResponse | NumberOfFollowers;
1849 -declare type PercentageAble = {
1850 - percentage: number;
1851 -};
1852 -export declare type FriendDemoGraphics = {
1853 - /**
1854 - * `true` if friend demographic information is available.
1855 - */
1856 - available: boolean;
1857 - /**
1858 - * Percentage per gender
1859 - */
1860 - genders?: Array<{
1861 - /**
1862 - * Gender
1863 - */
1864 - gender: "unknown" | "male" | "female";
1865 - } & PercentageAble>;
1866 - /**
1867 - * Percentage per age group
1868 - */
1869 - ages?: Array<{
1870 - /**
1871 - * Age group
1872 - */
1873 - age: string;
1874 - } & PercentageAble>;
1875 - /**
1876 - * Percentage per area
1877 - */
1878 - areas?: Array<{
1879 - area: string;
1880 - } & PercentageAble>;
1881 - /**
1882 - * Percentage by OS
1883 - */
1884 - appTypes?: Array<{
1885 - appType: "ios" | "android" | "others";
1886 - } & PercentageAble>;
1887 - /**
1888 - * Percentage per friendship duration
1889 - */
1890 - subscriptionPeriods?: Array<{
1891 - /**
1892 - * Friendship duration
1893 - */
1894 - subscriptionPeriod: "over365days" | "within365days" | "within180days" | "within90days" | "within30days" | "within7days" | "unknown";
1895 - } & PercentageAble>;
1896 -};
1897 -export {};
1 -"use strict";
2 -Object.defineProperty(exports, "__esModule", { value: true });
3 -exports.LINE_REQUEST_ID_HTTP_HEADER_NAME = "x-line-request-id";
1 -"use strict";
2 -Object.defineProperty(exports, "__esModule", { value: true });
3 -const crypto_1 = require("crypto");
4 -function s2b(str, encoding) {
5 - return Buffer.from(str, encoding);
6 -}
7 -function safeCompare(a, b) {
8 - if (a.length !== b.length) {
9 - return false;
10 - }
11 - return crypto_1.timingSafeEqual(a, b);
12 -}
13 -function validateSignature(body, channelSecret, signature) {
14 - return safeCompare(crypto_1.createHmac("SHA256", channelSecret)
15 - .update(body)
16 - .digest(), s2b(signature, "base64"));
17 -}
18 -exports.default = validateSignature;
1 -import { Readable } from "stream";
2 -import HTTPClient from "./http";
3 -import * as Types from "./types";
4 -import { JSONParseError } from "./exceptions";
5 -import { AxiosResponse } from "axios";
6 -
7 -function toArray<T>(maybeArr: T | T[]): T[] {
8 - return Array.isArray(maybeArr) ? maybeArr : [maybeArr];
9 -}
10 -
11 -function ensureJSON<T>(raw: T): T {
12 - if (typeof raw === "object") {
13 - return raw;
14 - } else {
15 - throw new JSONParseError("Failed to parse response body as JSON", raw);
16 - }
17 -}
18 -
19 -type ChatType = "group" | "room";
20 -const API_HOST: string = process.env.API_BASE_URL || "https://api.line.me/v2/";
21 -const BOT_BASE_URL: string = process.env.API_BASE_URL || `${API_HOST}bot/`;
22 -const OAUTH_BASE_URL = `${API_HOST}oauth/`;
23 -
24 -export default class Client {
25 - public config: Types.ClientConfig;
26 - private http: HTTPClient;
27 -
28 - constructor(config: Types.ClientConfig) {
29 - if (!config.channelAccessToken) {
30 - throw new Error("no channel access token");
31 - }
32 -
33 - this.config = config;
34 - this.http = new HTTPClient({
35 - baseURL: BOT_BASE_URL,
36 - defaultHeaders: {
37 - Authorization: "Bearer " + this.config.channelAccessToken,
38 - },
39 - responseParser: this.parseHTTPResponse.bind(this),
40 - });
41 - }
42 -
43 - private parseHTTPResponse(response: AxiosResponse) {
44 - const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types;
45 - let resBody = {
46 - ...response.data,
47 - };
48 - if (response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME]) {
49 - resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] =
50 - response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME];
51 - }
52 - return resBody;
53 - }
54 -
55 - public pushMessage(
56 - to: string,
57 - messages: Types.Message | Types.Message[],
58 - notificationDisabled: boolean = false,
59 - ): Promise<Types.MessageAPIResponseBase> {
60 - return this.http.post("/message/push", {
61 - messages: toArray(messages),
62 - to,
63 - notificationDisabled,
64 - });
65 - }
66 -
67 - public replyMessage(
68 - replyToken: string,
69 - messages: Types.Message | Types.Message[],
70 - notificationDisabled: boolean = false,
71 - ): Promise<Types.MessageAPIResponseBase> {
72 - return this.http.post("/message/reply", {
73 - messages: toArray(messages),
74 - replyToken,
75 - notificationDisabled,
76 - });
77 - }
78 -
79 - public async multicast(
80 - to: string[],
81 - messages: Types.Message | Types.Message[],
82 - notificationDisabled: boolean = false,
83 - ): Promise<Types.MessageAPIResponseBase> {
84 - return this.http.post("/message/multicast", {
85 - messages: toArray(messages),
86 - to,
87 - notificationDisabled,
88 - });
89 - }
90 -
91 - public async broadcast(
92 - messages: Types.Message | Types.Message[],
93 - notificationDisabled: boolean = false,
94 - ): Promise<Types.MessageAPIResponseBase> {
95 - return this.http.post("/message/broadcast", {
96 - messages: toArray(messages),
97 - notificationDisabled,
98 - });
99 - }
100 -
101 - public async getProfile(userId: string): Promise<Types.Profile> {
102 - const profile = await this.http.get<Types.Profile>(`/profile/${userId}`);
103 - return ensureJSON(profile);
104 - }
105 -
106 - private async getChatMemberProfile(
107 - chatType: ChatType,
108 - chatId: string,
109 - userId: string,
110 - ): Promise<Types.Profile> {
111 - const profile = await this.http.get<Types.Profile>(
112 - `/${chatType}/${chatId}/member/${userId}`,
113 - );
114 - return ensureJSON(profile);
115 - }
116 -
117 - public async getGroupMemberProfile(
118 - groupId: string,
119 - userId: string,
120 - ): Promise<Types.Profile> {
121 - return this.getChatMemberProfile("group", groupId, userId);
122 - }
123 -
124 - public async getRoomMemberProfile(
125 - roomId: string,
126 - userId: string,
127 - ): Promise<Types.Profile> {
128 - return this.getChatMemberProfile("room", roomId, userId);
129 - }
130 -
131 - private async getChatMemberIds(
132 - chatType: ChatType,
133 - chatId: string,
134 - ): Promise<string[]> {
135 - let memberIds: string[] = [];
136 -
137 - let start: string;
138 - do {
139 - const res = await this.http.get<{ memberIds: string[]; next?: string }>(
140 - `/${chatType}/${chatId}/members/ids`,
141 - start ? { start } : null,
142 - );
143 - ensureJSON(res);
144 - memberIds = memberIds.concat(res.memberIds);
145 - start = res.next;
146 - } while (start);
147 -
148 - return memberIds;
149 - }
150 -
151 - public async getGroupMemberIds(groupId: string): Promise<string[]> {
152 - return this.getChatMemberIds("group", groupId);
153 - }
154 -
155 - public async getRoomMemberIds(roomId: string): Promise<string[]> {
156 - return this.getChatMemberIds("room", roomId);
157 - }
158 -
159 - public async getMessageContent(messageId: string): Promise<Readable> {
160 - return this.http.getStream(`/message/${messageId}/content`);
161 - }
162 -
163 - private leaveChat(chatType: ChatType, chatId: string): Promise<any> {
164 - return this.http.post(`/${chatType}/${chatId}/leave`);
165 - }
166 -
167 - public async leaveGroup(groupId: string): Promise<any> {
168 - return this.leaveChat("group", groupId);
169 - }
170 -
171 - public async leaveRoom(roomId: string): Promise<any> {
172 - return this.leaveChat("room", roomId);
173 - }
174 -
175 - public async getRichMenu(
176 - richMenuId: string,
177 - ): Promise<Types.RichMenuResponse> {
178 - const res = await this.http.get<Types.RichMenuResponse>(
179 - `/richmenu/${richMenuId}`,
180 - );
181 - return ensureJSON(res);
182 - }
183 -
184 - public async createRichMenu(richMenu: Types.RichMenu): Promise<string> {
185 - const res = await this.http.post<any>("/richmenu", richMenu);
186 - return ensureJSON(res).richMenuId;
187 - }
188 -
189 - public async deleteRichMenu(richMenuId: string): Promise<any> {
190 - return this.http.delete(`/richmenu/${richMenuId}`);
191 - }
192 -
193 - public async getRichMenuIdOfUser(userId: string): Promise<string> {
194 - const res = await this.http.get<any>(`/user/${userId}/richmenu`);
195 - return ensureJSON(res).richMenuId;
196 - }
197 -
198 - public async linkRichMenuToUser(
199 - userId: string,
200 - richMenuId: string,
201 - ): Promise<any> {
202 - return this.http.post(`/user/${userId}/richmenu/${richMenuId}`);
203 - }
204 -
205 - public async unlinkRichMenuFromUser(userId: string): Promise<any> {
206 - return this.http.delete(`/user/${userId}/richmenu`);
207 - }
208 -
209 - public async linkRichMenuToMultipleUsers(
210 - richMenuId: string,
211 - userIds: string[],
212 - ): Promise<any> {
213 - return this.http.post("/richmenu/bulk/link", {
214 - richMenuId,
215 - userIds,
216 - });
217 - }
218 -
219 - public async unlinkRichMenusFromMultipleUsers(
220 - userIds: string[],
221 - ): Promise<any> {
222 - return this.http.post("/richmenu/bulk/unlink", {
223 - userIds,
224 - });
225 - }
226 -
227 - public async getRichMenuImage(richMenuId: string): Promise<Readable> {
228 - return this.http.getStream(`/richmenu/${richMenuId}/content`);
229 - }
230 -
231 - public async setRichMenuImage(
232 - richMenuId: string,
233 - data: Buffer | Readable,
234 - contentType?: string,
235 - ): Promise<any> {
236 - return this.http.postBinary(
237 - `/richmenu/${richMenuId}/content`,
238 - data,
239 - contentType,
240 - );
241 - }
242 -
243 - public async getRichMenuList(): Promise<Array<Types.RichMenuResponse>> {
244 - const res = await this.http.get<any>(`/richmenu/list`);
245 - return ensureJSON(res).richmenus;
246 - }
247 -
248 - public async setDefaultRichMenu(richMenuId: string): Promise<{}> {
249 - return this.http.post(`/user/all/richmenu/${richMenuId}`);
250 - }
251 -
252 - public async getDefaultRichMenuId(): Promise<string> {
253 - const res = await this.http.get<any>("/user/all/richmenu");
254 - return ensureJSON(res).richMenuId;
255 - }
256 -
257 - public async deleteDefaultRichMenu(): Promise<{}> {
258 - return this.http.delete("/user/all/richmenu");
259 - }
260 -
261 - public async getLinkToken(userId: string): Promise<string> {
262 - const res = await this.http.post<any>(`/user/${userId}/linkToken`);
263 - return ensureJSON(res).linkToken;
264 - }
265 -
266 - public async getNumberOfSentReplyMessages(
267 - date: string,
268 - ): Promise<Types.NumberOfMessagesSentResponse> {
269 - const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
270 - `/message/delivery/reply?date=${date}`,
271 - );
272 - return ensureJSON(res);
273 - }
274 -
275 - public async getNumberOfSentPushMessages(
276 - date: string,
277 - ): Promise<Types.NumberOfMessagesSentResponse> {
278 - const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
279 - `/message/delivery/push?date=${date}`,
280 - );
281 - return ensureJSON(res);
282 - }
283 -
284 - public async getNumberOfSentMulticastMessages(
285 - date: string,
286 - ): Promise<Types.NumberOfMessagesSentResponse> {
287 - const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
288 - `/message/delivery/multicast?date=${date}`,
289 - );
290 - return ensureJSON(res);
291 - }
292 -
293 - public async getTargetLimitForAdditionalMessages(): Promise<
294 - Types.TargetLimitForAdditionalMessages
295 - > {
296 - const res = await this.http.get<Types.TargetLimitForAdditionalMessages>(
297 - "/message/quota",
298 - );
299 - return ensureJSON(res);
300 - }
301 -
302 - public async getNumberOfMessagesSentThisMonth(): Promise<
303 - Types.NumberOfMessagesSentThisMonth
304 - > {
305 - const res = await this.http.get<Types.NumberOfMessagesSentThisMonth>(
306 - "/message/quota/consumption",
307 - );
308 - return ensureJSON(res);
309 - }
310 -
311 - public async getNumberOfSentBroadcastMessages(
312 - date: string,
313 - ): Promise<Types.NumberOfMessagesSentResponse> {
314 - const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
315 - `/message/delivery/broadcast?date=${date}`,
316 - );
317 - return ensureJSON(res);
318 - }
319 -
320 - public async getNumberOfMessageDeliveries(
321 - date: string,
322 - ): Promise<Types.NumberOfMessageDeliveriesResponse> {
323 - const res = await this.http.get<Types.NumberOfMessageDeliveriesResponse>(
324 - `/insight/message/delivery?date=${date}`,
325 - );
326 - return ensureJSON(res);
327 - }
328 -
329 - public async getNumberOfFollowers(
330 - date: string,
331 - ): Promise<Types.NumberOfFollowersResponse> {
332 - const res = await this.http.get<Types.NumberOfFollowersResponse>(
333 - `/insight/followers?date=${date}`,
334 - );
335 - return ensureJSON(res);
336 - }
337 -
338 - public async getFriendDemographics(): Promise<Types.FriendDemoGraphics> {
339 - const res = await this.http.get<Types.FriendDemoGraphics>(
340 - `/insight/demographic`,
341 - );
342 - return ensureJSON(res);
343 - }
344 -}
345 -
346 -export class OAuth {
347 - private http: HTTPClient;
348 -
349 - constructor() {
350 - this.http = new HTTPClient({
351 - baseURL: OAUTH_BASE_URL,
352 - });
353 - }
354 -
355 - public issueAccessToken(
356 - client_id: string,
357 - client_secret: string,
358 - ): Promise<{
359 - access_token: string;
360 - expires_in: number;
361 - token_type: "Bearer";
362 - }> {
363 - return this.http.postForm("/accessToken", {
364 - grant_type: "client_credentials",
365 - client_id,
366 - client_secret,
367 - });
368 - }
369 -
370 - public revokeAccessToken(access_token: string): Promise<{}> {
371 - return this.http.postForm("/revoke", { access_token });
372 - }
373 -}
1 -import axios, { AxiosInstance, AxiosError, AxiosResponse } from "axios";
2 -import { Readable } from "stream";
3 -import { HTTPError, ReadError, RequestError } from "./exceptions";
4 -import * as fileType from "file-type";
5 -import * as qs from "querystring";
6 -
7 -const pkg = require("../package.json");
8 -
9 -type httpClientConfig = {
10 - baseURL?: string;
11 - defaultHeaders?: any;
12 - responseParser?: <T>(res: AxiosResponse) => T;
13 -};
14 -
15 -export default class HTTPClient {
16 - private instance: AxiosInstance;
17 - private config: httpClientConfig;
18 -
19 - constructor(config: httpClientConfig = {}) {
20 - this.config = config;
21 - const { baseURL, defaultHeaders } = config;
22 - this.instance = axios.create({
23 - baseURL,
24 - headers: Object.assign({}, defaultHeaders, {
25 - "User-Agent": `${pkg.name}/${pkg.version}`,
26 - }),
27 - });
28 -
29 - this.instance.interceptors.response.use(
30 - res => res,
31 - err => Promise.reject(this.wrapError(err)),
32 - );
33 - }
34 -
35 - public async get<T>(url: string, params?: any): Promise<T> {
36 - const res = await this.instance.get(url, { params });
37 - return res.data;
38 - }
39 -
40 - public async getStream(url: string, params?: any): Promise<Readable> {
41 - const res = await this.instance.get(url, {
42 - params,
43 - responseType: "stream",
44 - });
45 - return res.data as Readable;
46 - }
47 -
48 - public async post<T>(url: string, body?: any): Promise<T> {
49 - const res = await this.instance.post(url, body, {
50 - headers: { "Content-Type": "application/json" },
51 - });
52 -
53 - const { responseParser } = this.config;
54 - if (responseParser) return responseParser<T>(res);
55 - else return res.data;
56 - }
57 -
58 - public async postForm<T>(url: string, body?: any): Promise<T> {
59 - const res = await this.instance.post(url, qs.stringify(body), {
60 - headers: { "Content-Type": "application/x-www-form-urlencoded" },
61 - });
62 -
63 - return res.data;
64 - }
65 -
66 - public async postBinary<T>(
67 - url: string,
68 - data: Buffer | Readable,
69 - contentType?: string,
70 - ): Promise<T> {
71 - const buffer = await (async (): Promise<Buffer> => {
72 - if (Buffer.isBuffer(data)) {
73 - return data;
74 - } else if (data instanceof Readable) {
75 - return new Promise<Buffer>((resolve, reject) => {
76 - const buffers: Buffer[] = [];
77 - let size = 0;
78 - data.on("data", (chunk: Buffer) => {
79 - buffers.push(chunk);
80 - size += chunk.length;
81 - });
82 - data.on("end", () => resolve(Buffer.concat(buffers, size)));
83 - data.on("error", reject);
84 - });
85 - } else {
86 - throw new Error("invalid data type for postBinary");
87 - }
88 - })();
89 -
90 - const res = await this.instance.post(url, buffer, {
91 - headers: {
92 - "Content-Type": contentType || fileType(buffer).mime,
93 - "Content-Length": buffer.length,
94 - },
95 - });
96 -
97 - return res.data;
98 - }
99 -
100 - public async delete<T>(url: string, params?: any): Promise<T> {
101 - const res = await this.instance.delete(url, { params });
102 - return res.data;
103 - }
104 -
105 - private wrapError(err: AxiosError): Error {
106 - if (err.response) {
107 - return new HTTPError(
108 - err.message,
109 - err.response.status,
110 - err.response.statusText,
111 - err,
112 - );
113 - } else if (err.code) {
114 - return new RequestError(err.message, err.code, err);
115 - } else if (err.config) {
116 - // unknown, but from axios
117 - return new ReadError(err);
118 - }
119 -
120 - // otherwise, just rethrow
121 - return err;
122 - }
123 -}
1 -import Client, { OAuth } from "./client";
2 -import middleware from "./middleware";
3 -import validateSignature from "./validate-signature";
4 -
5 -export { Client, middleware, validateSignature, OAuth };
6 -
7 -// re-export exceptions and types
8 -export * from "./exceptions";
9 -export * from "./types";
1 -import { raw } from "body-parser";
2 -import * as http from "http";
3 -import { JSONParseError, SignatureValidationFailed } from "./exceptions";
4 -import * as Types from "./types";
5 -import validateSignature from "./validate-signature";
6 -
7 -export type Request = http.IncomingMessage & { body: any };
8 -export type Response = http.ServerResponse;
9 -export type NextCallback = (err?: Error) => void;
10 -
11 -export type Middleware = (
12 - req: Request,
13 - res: Response,
14 - next: NextCallback,
15 -) => void | Promise<void>;
16 -
17 -function isValidBody(body?: any): body is string | Buffer {
18 - return (body && typeof body === "string") || Buffer.isBuffer(body);
19 -}
20 -
21 -export default function middleware(config: Types.MiddlewareConfig): Middleware {
22 - if (!config.channelSecret) {
23 - throw new Error("no channel secret");
24 - }
25 -
26 - const secret = config.channelSecret;
27 -
28 - const _middleware: Middleware = async (req, res, next) => {
29 - // header names are lower-cased
30 - // https://nodejs.org/api/http.html#http_message_headers
31 - const signature = req.headers["x-line-signature"] as string;
32 -
33 - if (!signature) {
34 - next(new SignatureValidationFailed("no signature"));
35 - return;
36 - }
37 -
38 - const body = await (async (): Promise<string | Buffer> => {
39 - if (isValidBody((req as any).rawBody)) {
40 - // rawBody is provided in Google Cloud Functions and others
41 - return (req as any).rawBody;
42 - } else if (isValidBody(req.body)) {
43 - return req.body;
44 - } else {
45 - // body may not be parsed yet, parse it to a buffer
46 - return new Promise<Buffer>((resolve, reject) =>
47 - raw({ type: "*/*" })(req as any, res as any, (error: Error) =>
48 - error ? reject(error) : resolve(req.body),
49 - ),
50 - );
51 - }
52 - })();
53 -
54 - if (!validateSignature(body, secret, signature)) {
55 - next(
56 - new SignatureValidationFailed("signature validation failed", signature),
57 - );
58 - return;
59 - }
60 -
61 - const strBody = Buffer.isBuffer(body) ? body.toString() : body;
62 -
63 - try {
64 - req.body = JSON.parse(strBody);
65 - next();
66 - } catch (err) {
67 - next(new JSONParseError(err.message, strBody));
68 - }
69 - };
70 - return (req, res, next): void => {
71 - (<Promise<void>>_middleware(req, res, next)).catch(next);
72 - };
73 -}
1 -export interface Config {
2 - channelAccessToken?: string;
3 - channelSecret?: string;
4 -}
5 -
6 -export interface ClientConfig extends Config {
7 - channelAccessToken: string;
8 -}
9 -
10 -export interface MiddlewareConfig extends Config {
11 - channelSecret: string;
12 -}
13 -
14 -export type Profile = {
15 - displayName: string;
16 - userId: string;
17 - pictureUrl: string;
18 - statusMessage: string;
19 -};
20 -
21 -/**
22 - * Request body which is sent by webhook.
23 - *
24 - * @see [Request body](https://developers.line.biz/en/reference/messaging-api/#request-body)
25 - */
26 -export type WebhookRequestBody = {
27 - /**
28 - * User ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, U[0-9a-f]{32}.
29 - */
30 - destination: string;
31 -
32 - /**
33 - * Information about the event
34 - */
35 - events: Array<WebhookEvent>;
36 -};
37 -
38 -/**
39 - * JSON objects which contain events generated on the LINE Platform.
40 - *
41 - * @see [Webhook event objects](https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects)
42 - */
43 -export type WebhookEvent =
44 - | MessageEvent
45 - | FollowEvent
46 - | UnfollowEvent
47 - | JoinEvent
48 - | LeaveEvent
49 - | MemberJoinEvent
50 - | MemberLeaveEvent
51 - | PostbackEvent
52 - | BeaconEvent
53 - | AccountLinkEvent
54 - | DeviceLinkEvent
55 - | DeviceUnlinkEvent
56 - | LINEThingsScenarioExecutionEvent;
57 -
58 -export type EventBase = {
59 - /**
60 - * Time of the event in milliseconds
61 - */
62 - timestamp: number;
63 - /**
64 - * Source user, group, or room object with information about the source of the event.
65 - */
66 - source: EventSource;
67 -};
68 -
69 -export type EventSource = User | Group | Room;
70 -
71 -export type User = { type: "user"; userId: string };
72 -
73 -export type Group = {
74 - type: "group";
75 - groupId: string;
76 - /**
77 - * ID of the source user.
78 - *
79 - * Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
80 - * Not included if the user has not agreed to the
81 - * [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
82 - */
83 - userId?: string;
84 -};
85 -
86 -export type Room = {
87 - type: "room";
88 - roomId: string;
89 - /**
90 - * ID of the source user.
91 - *
92 - * Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
93 - * Not included if the user has not agreed to the
94 - * [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
95 - */
96 - userId?: string;
97 -};
98 -
99 -export type ReplyableEvent = EventBase & { replyToken: string };
100 -
101 -/**
102 - * Webhook event object which contains the sent message.
103 - *
104 - * The `message` property contains a message object which corresponds with the
105 - * message type. You can reply to message events.
106 - *
107 - * @see [Message event](https://developers.line.biz/en/reference/messaging-api/#message-event)
108 - */
109 -export type MessageEvent = {
110 - type: "message";
111 - message: EventMessage;
112 -} & ReplyableEvent;
113 -
114 -/**
115 - * Event object for when your account is added as a friend (or unblocked).
116 - */
117 -export type FollowEvent = { type: "follow" } & ReplyableEvent;
118 -
119 -/**
120 - * Event object for when your account is blocked.
121 - */
122 -export type UnfollowEvent = { type: "unfollow" } & EventBase;
123 -
124 -/**
125 - * Event object for when your bot joins a group or room. You can reply to join events.
126 - *
127 - * A join event is triggered at different times for groups and rooms.
128 - *
129 - * - For groups: A join event is sent when a user invites your bot.
130 - * - For rooms: A join event is sent when the first event (for example when a
131 - * user sends a message or is added to the room) occurs after your bot is
132 - * added.
133 - */
134 -export type JoinEvent = { type: "join" } & ReplyableEvent;
135 -
136 -/**
137 - * Event object for when a user removes your bot from a group or a room.
138 - */
139 -export type LeaveEvent = { type: "leave" } & EventBase;
140 -
141 -/**
142 - * Event object for when a user joins a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
143 - * or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
144 - */
145 -export type MemberJoinEvent = {
146 - type: "memberJoined";
147 - /**
148 - * User ID of users who joined
149 - * Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
150 - */
151 - joined: { members: Array<User> };
152 -} & ReplyableEvent;
153 -
154 -/**
155 - * Event object for when a user leaves a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
156 - * or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
157 - */
158 -export type MemberLeaveEvent = {
159 - type: "memberLeft";
160 - /**
161 - * User ID of users who left
162 - * Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
163 - */
164 - left: { members: Array<User> };
165 -} & EventBase;
166 -
167 -/**
168 - * Event object for when a user performs an action on a
169 - * [template message](https://developers.line.biz/en/reference/messaging-api/#template-messages).
170 - */
171 -export type PostbackEvent = {
172 - type: "postback";
173 - postback: Postback;
174 -} & ReplyableEvent;
175 -
176 -/**
177 - * Event object for when a user enters or leaves the range of a
178 - * [LINE Beacon](https://developers.line.biz/en/docs/messaging-api/using-beacons/).
179 - */
180 -export type BeaconEvent = ReplyableEvent & {
181 - type: "beacon";
182 - beacon: {
183 - type: "enter" | "leave" | "banner";
184 -
185 - /**
186 - * Hardware ID of the beacon that was detected
187 - */
188 - hwid: string;
189 -
190 - /**
191 - * Device message of beacon that was detected.
192 - *
193 - * This message consists of data generated by the beacon to send notifications to bots.
194 - * Only included in webhooks from devices that support the "device message" property.
195 - * For more information, see the
196 - * [LINE Simple Beacon specification](https://github.com/line/line-simple-beacon/blob/master/README.en.md/#line-simple-beacon-frame).
197 - */
198 - dm?: string;
199 - };
200 -};
201 -
202 -/**
203 - * Event object for when a user has linked his/her LINE account with a provider's service account.
204 - */
205 -export type AccountLinkEvent = ReplyableEvent & {
206 - type: "accountLink";
207 - link: {
208 - result: "ok" | "failed";
209 -
210 - /**
211 - * Specified nonce when verifying the user ID
212 - */
213 - nonce: string;
214 - };
215 -};
216 -
217 -/**
218 - * Indicates that a LINE Things-compatible device has been linked with LINE by a user operation.
219 - * For more information, see [Receiving device link events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#link-event).
220 - */
221 -export type DeviceLinkEvent = ReplyableEvent & {
222 - type: "things";
223 - things: {
224 - /**
225 - * Device ID of the LINE Things-compatible device that was linked with LINE
226 - */
227 - deviceId: string;
228 - type: "link";
229 - };
230 -};
231 -
232 -/**
233 - * Indicates that a LINE Things-compatible device has been unlinked from LINE by a user operation.
234 - * For more information, see [Receiving device unlink events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#unlink-event).
235 - */
236 -export type DeviceUnlinkEvent = ReplyableEvent & {
237 - type: "things";
238 - things: {
239 - /**
240 - * Device ID of the LINE Things-compatible device that was unlinked with LINE
241 - */
242 - deviceId: string;
243 - type: "unlink";
244 - };
245 -};
246 -
247 -export type LINEThingsScenarioExecutionEvent = ReplyableEvent & {
248 - type: "things";
249 - things: {
250 - type: "scenarioResult";
251 - /**
252 - * Device ID of the device that executed the scenario
253 - */
254 - deviceId: string;
255 - result: {
256 - /**
257 - * Scenario ID executed
258 - */
259 - scenarioId: string;
260 - /**
261 - * Revision number of the scenario set containing the executed scenario
262 - */
263 - revision: number;
264 - /**
265 - * Timestamp for when execution of scenario action started (milliseconds, LINE app time)
266 - */
267 - startTime: number;
268 - /**
269 - * Timestamp for when execution of scenario was completed (milliseconds, LINE app time)
270 - */
271 - endtime: number;
272 - /**
273 - * Scenario execution completion status
274 - * See also [things.resultCode definitions](https://developers.line.biz/en/reference/messaging-api/#things-resultcode).
275 - */
276 - resultCode: "success" | "gatt_error" | "runtime_error";
277 - /**
278 - * Execution result of individual operations specified in action
279 - * Note that an array of actions specified in a scenario has the following characteristics
280 - * - The actions defined in a scenario are performed sequentially, from top to bottom.
281 - * - Each action produces some result when executed.
282 - * Even actions that do not generate data, such as `SLEEP`, return an execution result of type `void`.
283 - * The number of items in an action array may be 0.
284 - *
285 - * Therefore, things.actionResults has the following properties:
286 - * - The number of items in the array matches the number of actions defined in the scenario.
287 - * - The order of execution results matches the order in which actions are performed.
288 - * That is, in a scenario set with multiple `GATT_READ` actions,
289 - * the results are returned in the order in which each individual `GATT_READ` action was performed.
290 - * - If 0 actions are defined in the scenario, the number of items in things.actionResults will be 0.
291 - */
292 - actionResults: Array<LINEThingsActionResult>;
293 - /**
294 - * Data contained in notification
295 - * The value is Base64-encoded binary data.
296 - * Only included for scenarios where `trigger.type = BLE_NOTIFICATION`.
297 - */
298 - bleNotificationPayload?: string;
299 - /**
300 - * Error reason
301 - */
302 - errorReason?: string;
303 - };
304 - };
305 -};
306 -
307 -export type LINEThingsActionResult = {
308 - /**
309 - * `void`, `binary`
310 - * Depends on `type` of the executed action.
311 - * This property is always included if `things.actionResults` is not empty.
312 - */
313 - type: "void" | "binary";
314 - /**
315 - * Base64-encoded binary data
316 - * This property is always included when `things.actionResults[].type` is `binary`.
317 - */
318 - data?: string;
319 -};
320 -
321 -export type EventMessage =
322 - | TextEventMessage
323 - | ImageEventMessage
324 - | VideoEventMessage
325 - | AudioEventMessage
326 - | LocationEventMessage
327 - | FileEventMessage
328 - | StickerEventMessage;
329 -
330 -export type EventMessageBase = { id: string };
331 -
332 -/**
333 - * Message object which contains the text sent from the source.
334 - */
335 -export type TextEventMessage = {
336 - type: "text";
337 - text: string;
338 -} & EventMessageBase;
339 -
340 -export type ContentProvider<WithPreview extends boolean = true> =
341 - | {
342 - /**
343 - * The content is provided by LINE.
344 - *
345 - * The data itself can be retrieved from the content API.
346 - */
347 - type: "line";
348 - }
349 - | {
350 - /**
351 - * The content is provided by a provider other than LINE
352 - */
353 - type: "external";
354 - /**
355 - * URL of the content. Only included when contentProvider.type is external.
356 - */
357 - originalContentUrl: string;
358 - /**
359 - * URL of the content preview. Only included when contentProvider.type is external.
360 - *
361 - * For contents without preview (e.g. audio), it's undefined.
362 - */
363 - previewImageUrl: WithPreview extends true ? string : undefined;
364 - };
365 -
366 -/**
367 - * Message object which contains the image content sent from the source.
368 - * The binary image data can be retrieved using Client#getMessageContent.
369 - */
370 -export type ImageEventMessage = {
371 - type: "image";
372 - contentProvider: ContentProvider;
373 -} & EventMessageBase;
374 -
375 -/**
376 - * Message object which contains the video content sent from the source.
377 - * The binary video data can be retrieved using Client#getMessageContent.
378 - */
379 -export type VideoEventMessage = {
380 - type: "video";
381 - contentProvider: ContentProvider;
382 -} & EventMessageBase;
383 -
384 -/**
385 - * Message object which contains the audio content sent from the source.
386 - * The binary audio data can be retrieved using Client#getMessageContent.
387 - */
388 -export type AudioEventMessage = {
389 - type: "audio";
390 - duration: number;
391 - contentProvider: ContentProvider<false>;
392 -} & EventMessageBase;
393 -
394 -/**
395 - * Message object which contains the file sent from the source.
396 - * The binary data can be retrieved using Client#getMessageContent.
397 - */
398 -export type FileEventMessage = {
399 - type: "file";
400 - fileName: string;
401 - fileSize: string;
402 -} & EventMessageBase;
403 -
404 -/**
405 - * Message object which contains the location data sent from the source.
406 - */
407 -export type LocationEventMessage = {
408 - type: "location";
409 - title: string;
410 - address: string;
411 - latitude: number;
412 - longitude: number;
413 -} & EventMessageBase;
414 -
415 -/**
416 - * Message object which contains the sticker data sent from the source.
417 - * For a list of basic LINE stickers and sticker IDs, see
418 - * [sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
419 - */
420 -export type StickerEventMessage = {
421 - type: "sticker";
422 - packageId: string;
423 - stickerId: string;
424 -} & EventMessageBase;
425 -
426 -export type Postback = {
427 - data: string;
428 - /**
429 - * Object with the date and time selected by a user through a
430 - * [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
431 - * Only returned for postback actions via a
432 - * [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
433 - * The `full-date`, `time-hour`, and `time-minute` formats follow the
434 - * [RFC3339 protocol](https://www.ietf.org/rfc/rfc3339.txt).
435 - */
436 - params?: {
437 - /**
438 - * Date selected by user. Only included in the `date` mode.
439 - */
440 - date?: string;
441 - /**
442 - * Time selected by the user. Only included in the `time` mode.
443 - */
444 - time?: string;
445 - /**
446 - * Date and time selected by the user. Only included in the `datetime` mode.
447 - */
448 - datetime?: string;
449 - };
450 -};
451 -
452 -/**
453 - * JSON object which contains the contents of the message you send.
454 - *
455 - * @see [Message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects)
456 - */
457 -export type Message =
458 - | TextMessage
459 - | ImageMessage
460 - | VideoMessage
461 - | AudioMessage
462 - | LocationMessage
463 - | StickerMessage
464 - | ImageMapMessage
465 - | TemplateMessage
466 - | FlexMessage;
467 -
468 -/**
469 - * @see [Common properties for messages](https://developers.line.biz/en/reference/messaging-api/#common-properties-for-messages)
470 - */
471 -export type MessageCommon = {
472 - /**
473 - * For the quick reply feature.
474 - * For more information, see [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
475 - *
476 - * If the user receives multiple
477 - * [message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects),
478 - * the quickReply property of the last message object is displayed.
479 - */
480 - quickReply?: QuickReply;
481 -};
482 -
483 -/**
484 - * @see [Text message](https://developers.line.biz/en/reference/messaging-api/#text-message)
485 - */
486 -export type TextMessage = MessageCommon & {
487 - type: "text";
488 - /**
489 - * Message text. You can include the following emoji:
490 - *
491 - * - Unicode emoji
492 - * - LINE original emoji
493 - * ([Unicode codepoint table for LINE original emoji](https://developers.line.biz/media/messaging-api/emoji-list.pdf))
494 - *
495 - * Max: 2000 characters
496 - */
497 - text: string;
498 -};
499 -
500 -/**
501 - * @see [Image message](https://developers.line.biz/en/reference/messaging-api/#image-message)
502 - */
503 -export type ImageMessage = MessageCommon & {
504 - type: "image";
505 - /**
506 - * Image URL (Max: 1000 characters)
507 - *
508 - * - **HTTPS**
509 - * - JPEG
510 - * - Max: 1024 x 1024
511 - * - Max: 1 MB
512 - */
513 - originalContentUrl: string;
514 - /**
515 - * Preview image URL (Max: 1000 characters)
516 - *
517 - * - **HTTPS**
518 - * - JPEG
519 - * - Max: 240 x 240
520 - * - Max: 1 MB
521 - */
522 - previewImageUrl: string;
523 -};
524 -
525 -/**
526 - * @see [Video message](https://developers.line.biz/en/reference/messaging-api/#video-message)
527 - */
528 -export type VideoMessage = MessageCommon & {
529 - type: "video";
530 - /**
531 - * URL of video file (Max: 1000 characters)
532 - *
533 - * - **HTTPS**
534 - * - mp4
535 - * - Max: 1 minute
536 - * - Max: 10 MB
537 - *
538 - * A very wide or tall video may be cropped when played in some environments.
539 - */
540 - originalContentUrl: string;
541 - /**
542 - * URL of preview image (Max: 1000 characters)
543 - *
544 - * - **HTTPS**
545 - * - JPEG
546 - * - Max: 240 x 240
547 - * - Max: 1 MB
548 - */
549 - previewImageUrl: string;
550 -};
551 -
552 -/**
553 - * @see [Audio message](https://developers.line.biz/en/reference/messaging-api/#audio-message)
554 - */
555 -export type AudioMessage = MessageCommon & {
556 - type: "audio";
557 - /**
558 - * URL of audio file (Max: 1000 characters)
559 - *
560 - * - **HTTPS**
561 - * - m4a
562 - * - Max: 1 minute
563 - * - Max: 10 MB
564 - */
565 - originalContentUrl: string;
566 - /**
567 - * Length of audio file (milliseconds)
568 - */
569 - duration: number;
570 -};
571 -
572 -/**
573 - * @see [Location message](https://developers.line.biz/en/reference/messaging-api/#location-message)
574 - */
575 -export type LocationMessage = MessageCommon & {
576 - type: "location";
577 - /**
578 - * Title (Max: 100 characters)
579 - */
580 - title: string;
581 - /**
582 - * Address (Max: 100 characters)
583 - */
584 - address: string;
585 - latitude: number;
586 - longitude: number;
587 -};
588 -
589 -/**
590 - * @see [Sticker message](https://developers.line.biz/en/reference/messaging-api/#sticker-message)
591 - */
592 -export type StickerMessage = MessageCommon & {
593 - type: "sticker";
594 - /**
595 - * Package ID for a set of stickers.
596 - * For information on package IDs, see the
597 - * [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
598 - */
599 - packageId: string;
600 - /**
601 - * Sticker ID.
602 - * For a list of sticker IDs for stickers that can be sent with the Messaging
603 - * API, see the
604 - * [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
605 - */
606 - stickerId: string;
607 -};
608 -
609 -/**
610 - * @see [Imagemap message](https://developers.line.biz/en/reference/messaging-api/#imagemap-message)
611 - */
612 -export type ImageMapMessage = MessageCommon & {
613 - type: "imagemap";
614 - /**
615 - * [Base URL](https://developers.line.biz/en/reference/messaging-api/#base-url) of image
616 - * (Max: 1000 characters, **HTTPS**)
617 - */
618 - baseUrl: string;
619 - /**
620 - * Alternative text (Max: 400 characters)
621 - */
622 - altText: string;
623 - baseSize: Size;
624 - /**
625 - * Video to play inside a image map messages
626 - */
627 - video?: {
628 - /**
629 - * URL of video file (Max: 1000 characters)
630 - *
631 - * - **HTTPS**
632 - * - mp4
633 - * - Max: 1 minute
634 - * - Max: 10 MB
635 - *
636 - * A very wide or tall video may be cropped when played in some environments.
637 - */
638 - originalContentUrl: string;
639 - /**
640 - * URL of preview image (Max: 1000 characters)
641 - *
642 - * - **HTTPS**
643 - * - JPEG
644 - * - Max: 240 x 240
645 - * - Max: 1 MB
646 - */
647 - previewImageUrl: string;
648 - area: Area;
649 - /**
650 - * External link to be displayed after a video is played
651 - * This property is required if you set a video to play and a label to display after the video on the imagemap
652 - */
653 - externalLink?: {
654 - linkUri: string;
655 - label: string;
656 - };
657 - };
658 - /**
659 - * Action when tapped (Max: 50)
660 - */
661 - actions: ImageMapAction[];
662 -};
663 -
664 -/**
665 - * Template messages are messages with predefined layouts which you can
666 - * customize. For more information, see
667 - * [template messages](https://developers.line.biz/en/docs/messaging-api/message-types/#template-messages).
668 - *
669 - * The following template types are available:
670 - *
671 - * - [Buttons](https://developers.line.biz/en/reference/messaging-api/#buttons)
672 - * - [Confirm](https://developers.line.biz/en/reference/messaging-api/#confirm)
673 - * - [Carousel](https://developers.line.biz/en/reference/messaging-api/#carousel)
674 - * - [Image carousel](https://developers.line.biz/en/reference/messaging-api/#image-carousel)
675 - *
676 - * @see [Template messages](https://developers.line.biz/en/reference/messaging-api/#template-messages)
677 - */
678 -export type TemplateMessage = MessageCommon & {
679 - type: "template";
680 - /**
681 - * Alternative text (Max: 400 characters)
682 - */
683 - altText: string;
684 - /**
685 - * Carousel template content
686 - */
687 - template: TemplateContent;
688 -};
689 -
690 -/**
691 - * Flex Messages are messages with a customizable layout.
692 - * You can customize the layout freely by combining multiple elements.
693 - * For more information, see
694 - * [Using Flex Messages](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/).
695 - *
696 - * @see [Flex messages](https://developers.line.biz/en/reference/messaging-api/#flex-message)
697 - */
698 -export type FlexMessage = MessageCommon & {
699 - type: "flex";
700 - altText: string;
701 - contents: FlexContainer;
702 -};
703 -
704 -/**
705 - * Object which specifies the actions and tappable regions of an imagemap.
706 - *
707 - * When a region is tapped, the user is redirected to the URI specified in
708 - * `uri` and the message specified in `message` is sent.
709 - *
710 - * @see [Imagemap action objects](https://developers.line.biz/en/reference/messaging-api/#imagemap-action-objects)
711 - */
712 -export type ImageMapAction = ImageMapURIAction | ImageMapMessageAction;
713 -
714 -export type ImageMapActionBase = {
715 - /** Defined tappable area */
716 - area: Area;
717 -};
718 -
719 -export type ImageMapURIAction = {
720 - type: "uri";
721 - /**
722 - * Webpage URL (Max: 1000 characters)
723 - */
724 - linkUri: string;
725 -} & ImageMapActionBase;
726 -
727 -export type ImageMapMessageAction = {
728 - type: "message";
729 - /**
730 - * Message to send (Max: 400 characters)
731 - */
732 - text: string;
733 -} & ImageMapActionBase;
734 -
735 -export type Area = {
736 - /**
737 - * Horizontal position relative to the top-left corner of the area
738 - */
739 - x: number;
740 - /**
741 - * Vertical position relative to the top-left corner of the area
742 - */
743 - y: number;
744 - /**
745 - * Width of the tappable area
746 - */
747 - width: number;
748 - /**
749 - * Height of the tappable area
750 - */
751 - height: number;
752 -};
753 -
754 -/**
755 - * A container is the top-level structure of a Flex Message. Here are the types of containers available.
756 - *
757 - * - [Bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
758 - * - [Carousel](https://developers.line.biz/en/reference/messaging-api/#f-carousel)
759 - *
760 - * See [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
761 - * for the containers' JSON data samples and usage.
762 - */
763 -export type FlexContainer = FlexBubble | FlexCarousel;
764 -
765 -/**
766 - * This is a container that contains one message bubble. It can contain four
767 - * blocks: header, hero, body, and footer.
768 - *
769 - * For more information about using each block, see
770 - * [Block](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/#block).
771 - */
772 -export type FlexBubble = {
773 - type: "bubble";
774 - size?: "nano" | "micro" | "kilo" | "mega" | "giga";
775 - /**
776 - * Text directionality and the order of components in horizontal boxes in the
777 - * container. Specify one of the following values:
778 - *
779 - * - `ltr`: Left to right
780 - * - `rtl`: Right to left
781 - *
782 - * The default value is `ltr`.
783 - */
784 - direction?: "ltr" | "rtl";
785 - header?: FlexBox;
786 - hero?: FlexBox | FlexImage;
787 - body?: FlexBox;
788 - footer?: FlexBox;
789 - styles?: FlexBubbleStyle;
790 - action?: Action;
791 -};
792 -
793 -export type FlexBubbleStyle = {
794 - header?: FlexBlockStyle;
795 - hero?: FlexBlockStyle;
796 - body?: FlexBlockStyle;
797 - footer?: FlexBlockStyle;
798 -};
799 -
800 -export type FlexBlockStyle = {
801 - /**
802 - * Background color of the block. Use a hexadecimal color code.
803 - */
804 - backgroundColor?: string;
805 - /**
806 - * - `true` to place a separator above the block.
807 - * - `true` will be ignored for the first block in a container because you
808 - * cannot place a separator above the first block.
809 - * - The default value is `false`.
810 - */
811 - separator?: boolean;
812 - /**
813 - * Color of the separator. Use a hexadecimal color code.
814 - */
815 - separatorColor?: string;
816 -};
817 -
818 -export type FlexCarousel = {
819 - type: "carousel";
820 - /**
821 - * (Max: 10 bubbles)
822 - */
823 - contents: FlexBubble[];
824 -};
825 -
826 -/**
827 - * Components are objects that compose a Flex Message container. Here are the
828 - * types of components available:
829 - *
830 - * - [Box](https://developers.line.biz/en/reference/messaging-api/#box)
831 - * - [Button](https://developers.line.biz/en/reference/messaging-api/#button)
832 - * - [Image](https://developers.line.biz/en/reference/messaging-api/#f-image)
833 - * - [Icon](https://developers.line.biz/en/reference/messaging-api/#icon)
834 - * - [Text](https://developers.line.biz/en/reference/messaging-api/#f-text)
835 - * - [Span](https://developers.line.biz/en/reference/messaging-api/#span)
836 - * - [Separator](https://developers.line.biz/en/reference/messaging-api/#separator)
837 - * - [Filler](https://developers.line.biz/en/reference/messaging-api/#filler)
838 - * - [Spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
839 - *
840 - * See the followings for the components' JSON data samples and usage.
841 - *
842 - * - [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
843 - * - [Flex Message layout](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/)
844 - */
845 -export type FlexComponent =
846 - | FlexBox
847 - | FlexButton
848 - | FlexImage
849 - | FlexIcon
850 - | FlexText
851 - | FlexSpan
852 - | FlexSeparator
853 - | FlexFiller
854 - | FlexSpacer;
855 -
856 -/**
857 - * This is a component that defines the layout of child components.
858 - * You can also include a box in a box.
859 - */
860 -export type FlexBox = {
861 - type: "box";
862 - /**
863 - * The placement style of components in this box. Specify one of the following values:
864 - *
865 - * - `horizontal`: Components are placed horizontally. The `direction`
866 - * property of the [bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
867 - * container specifies the order.
868 - * - `vertical`: Components are placed vertically from top to bottom.
869 - * - `baseline`: Components are placed in the same way as `horizontal` is
870 - * specified except the baselines of the components are aligned.
871 - *
872 - * For more information, see
873 - * [Types of box layouts](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-layout-types).
874 - */
875 - layout: "horizontal" | "vertical" | "baseline";
876 - /**
877 - * Components in this box. Here are the types of components available:
878 - *
879 - * - When the `layout` property is `horizontal` or `vertical`:
880 - * + [Box](https://developers.line.biz/en/reference/messaging-api/#box)
881 - * + [button](https://developers.line.biz/en/reference/messaging-api/#button)
882 - * + [image](https://developers.line.biz/en/reference/messaging-api/#f-image)
883 - * + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
884 - * + [separator](https://developers.line.biz/en/reference/messaging-api/#separator)
885 - * + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
886 - * + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
887 - * - When the `layout` property is `baseline`:
888 - * + [icon](https://developers.line.biz/en/reference/messaging-api/#icon)
889 - * + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
890 - * + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
891 - * + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
892 - */
893 - contents: FlexComponent[];
894 - /**
895 - * Background color of the block. In addition to the RGB color, an alpha
896 - * channel (transparency) can also be set. Use a hexadecimal color code.
897 - * (Example:#RRGGBBAA) The default value is `#00000000`.
898 - */
899 - backgroundColor?: string;
900 - /**
901 - * Color of box border. Use a hexadecimal color code.
902 - */
903 - borderColor?: string;
904 - /**
905 - * Width of box border. You can specify a value in pixels or any one of none,
906 - * light, normal, medium, semi-bold, or bold. none does not render a border
907 - * while the others become wider in the order of listing.
908 - */
909 - borderWidth?:
910 - | string
911 - | "none"
912 - | "light"
913 - | "normal"
914 - | "medium"
915 - | "semi-bold"
916 - | "bold";
917 - /**
918 - * Radius at the time of rounding the corners of the border. You can specify a
919 - * value in pixels or any one of `none`, `xs`, `sm`, `md`, `lg`, `xl`, or `xxl`. none does not
920 - * round the corner while the others increase in radius in the order of listing. The default value is none.
921 - */
922 - cornerRadius?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
923 - /**
924 - * Width of the box. For more information, see [Width of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-width) in the API documentation.
925 - */
926 - width?: string;
927 - /**
928 - * Height of the box. For more information, see [Height of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-height) in the API documentation.
929 - */
930 - height?: string;
931 - /**
932 - * The ratio of the width or height of this box within the parent box. The
933 - * default value for the horizontal parent box is `1`, and the default value
934 - * for the vertical parent box is `0`.
935 - *
936 - * For more information, see
937 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
938 - */
939 - flex?: number;
940 - /**
941 - * Minimum space between components in this box.
942 - *
943 - * - `none` does not set a space while the other values set a space whose
944 - * size increases in the order of listing.
945 - * - The default value is `none`.
946 - * - To override this setting for a specific component, set the `margin`
947 - * property of that component.
948 - */
949 - spacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
950 - /**
951 - * Minimum space between this box and the previous component in the parent box.
952 - *
953 - * - `none` does not set a space while the other values set a space whose
954 - * size increases in the order of listing.
955 - * - The default value is the value of the `spacing` property of the parent
956 - * box.
957 - * - If this box is the first component in the parent box, the `margin`
958 - * property will be ignored.
959 - */
960 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
961 - /**
962 - * Free space between the borders of this box and the child element.
963 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
964 - */
965 - paddingAll?: string;
966 - /**
967 - * Free space between the border at the upper end of this box and the upper end of the child element.
968 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
969 - */
970 - paddingTop?: string;
971 - /**
972 - * Free space between the border at the lower end of this box and the lower end of the child element.
973 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
974 - */
975 - paddingBottom?: string;
976 - /**
977 - * Free space between the border at the left end of this box and the left end of the child element.
978 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
979 - */
980 - paddingStart?: string;
981 - /**
982 - * Free space between the border at the right end of this box and the right end of the child element.
983 - * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
984 - */
985 - paddingEnd?: string;
986 - /**
987 - * Action performed when this button is tapped.
988 - *
989 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
990 - */
991 - action?: Action;
992 -} & Offset;
993 -
994 -export type Offset = {
995 - /**
996 - * Reference position for placing this box. Specify one of the following values:
997 - * - `relative`: Use the previous box as reference.
998 - * - `absolute`: Use the top left of parent element as reference.
999 - *
1000 - * The default value is relative.
1001 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1002 - */
1003 - position?: "relative" | "absolute";
1004 - /**
1005 - * The top offset.
1006 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1007 - */
1008 - offsetTop?: string;
1009 - /**
1010 - * The bottom offset.
1011 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1012 - */
1013 - offsetBottom?: string;
1014 - /**
1015 - * The left offset.
1016 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1017 - */
1018 - offsetStart?: string;
1019 - /**
1020 - * The right offset.
1021 - * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1022 - */
1023 - offsetEnd?: string;
1024 -};
1025 -
1026 -/**
1027 - * This component draws a button.
1028 - *
1029 - * When the user taps a button, a specified action is performed.
1030 - */
1031 -export type FlexButton = {
1032 - type: "button";
1033 - /**
1034 - * Action performed when this button is tapped.
1035 - *
1036 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1037 - */
1038 - action: Action;
1039 - /**
1040 - * The ratio of the width or height of this box within the parent box.
1041 - *
1042 - * The default value for the horizontal parent box is `1`, and the default
1043 - * value for the vertical parent box is `0`.
1044 - *
1045 - * For more information, see
1046 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1047 - */
1048 - flex?: number;
1049 - /**
1050 - * Minimum space between this box and the previous component in the parent box.
1051 - *
1052 - * - `none` does not set a space while the other values set a space whose
1053 - * size increases in the order of listing.
1054 - * - The default value is the value of the `spacing` property of the parent
1055 - * box.
1056 - * - If this box is the first component in the parent box, the `margin`
1057 - * property will be ignored.
1058 - */
1059 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1060 - /**
1061 - * Height of the button. The default value is `md`.
1062 - */
1063 - height?: "sm" | "md";
1064 - /**
1065 - * Style of the button. Specify one of the following values:
1066 - *
1067 - * - `link`: HTML link style
1068 - * - `primary`: Style for dark color buttons
1069 - * - `secondary`: Style for light color buttons
1070 - *
1071 - * The default value is `link`.
1072 - */
1073 - style?: "link" | "primary" | "secondary";
1074 - /**
1075 - * Use a hexadecimal color code.
1076 - *
1077 - * - Character color when the `style` property is `link`.
1078 - * - Background color when the `style` property is `primary` or `secondary`.
1079 - */
1080 - color?: string;
1081 - /**
1082 - * Vertical alignment style. Specify one of the following values:
1083 - *
1084 - * - `top`: Top-aligned
1085 - * - `bottom`: Bottom-aligned
1086 - * - `center`: Center-aligned
1087 - *
1088 - * The default value is `top`.
1089 - *
1090 - * If the `layout` property of the parent box is `baseline`, the `gravity`
1091 - * property will be ignored.
1092 - */
1093 - gravity?: "top" | "bottom" | "center";
1094 -} & Offset;
1095 -
1096 -/**
1097 - * This is an invisible component to fill extra space between components.
1098 - *
1099 - * - The filler's `flex` property is fixed to 1.
1100 - * - The `spacing` property of the parent box will be ignored for fillers.
1101 - */
1102 -export type FlexFiller = {
1103 - type: "filler";
1104 - /**
1105 - * The ratio of the width or height of this component within the parent box. For more information, see [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1106 - */
1107 - flex?: number;
1108 -};
1109 -
1110 -/**
1111 - * This component draws an icon.
1112 - */
1113 -export type FlexIcon = {
1114 - type: "icon";
1115 - /**
1116 - * Image URL
1117 - *
1118 - * Protocol: HTTPS
1119 - * Image format: JPEG or PNG
1120 - * Maximum image size: 240×240 pixels
1121 - * Maximum data size: 1 MB
1122 - */
1123 - url: string;
1124 - /**
1125 - * Minimum space between this box and the previous component in the parent
1126 - * box.
1127 - *
1128 - * - `none` does not set a space while the other values set a space whose
1129 - * size increases in the order of listing.
1130 - * - The default value is the value of the `spacing` property of the parent
1131 - * box.
1132 - * - If this box is the first component in the parent box, the `margin`
1133 - * property will be ignored.
1134 - */
1135 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1136 - /**
1137 - * Maximum size of the icon width.
1138 - * The size increases in the order of listing.
1139 - * The default value is `md`.
1140 - */
1141 - size?:
1142 - | "xxs"
1143 - | "xs"
1144 - | "sm"
1145 - | "md"
1146 - | "lg"
1147 - | "xl"
1148 - | "xxl"
1149 - | "3xl"
1150 - | "4xl"
1151 - | "5xl";
1152 - /**
1153 - * Aspect ratio of the icon. The default value is `1:1`.
1154 - */
1155 - aspectRatio?: "1:1" | "2:1" | "3:1";
1156 -} & Offset;
1157 -
1158 -/**
1159 - * This component draws an image.
1160 - */
1161 -export type FlexImage = {
1162 - type: "image";
1163 - /**
1164 - * Image URL
1165 - *
1166 - * - Protocol: HTTPS
1167 - * - Image format: JPEG or PNG
1168 - * - Maximum image size: 1024×1024 pixels
1169 - * - Maximum data size: 1 MB
1170 - */
1171 - url: string;
1172 - /**
1173 - * The ratio of the width or height of this box within the parent box.
1174 - *
1175 - * The default value for the horizontal parent box is `1`, and the default
1176 - * value for the vertical parent box is `0`.
1177 - *
1178 - * - For more information, see
1179 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1180 - */
1181 - flex?: number;
1182 - /**
1183 - * Minimum space between this box and the previous component in the parent
1184 - * box.
1185 - *
1186 - * - `none` does not set a space while the other values set a space whose
1187 - * size increases in the order of listing.
1188 - * - The default value is the value of the `spacing` property of the parent
1189 - * box.
1190 - * - If this box is the first component in the parent box, the `margin`
1191 - * property will be ignored.
1192 - */
1193 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1194 - /**
1195 - * Horizontal alignment style. Specify one of the following values:
1196 - *
1197 - * - `start`: Left-aligned
1198 - * - `end`: Right-aligned
1199 - * - `center`: Center-aligned
1200 - *
1201 - * The default value is `center`.
1202 - */
1203 - align?: "start" | "end" | "center";
1204 - /**
1205 - * Vertical alignment style. Specify one of the following values:
1206 - *
1207 - * - `top`: Top-aligned
1208 - * - `bottom`: Bottom-aligned
1209 - * - `center`: Center-aligned
1210 - *
1211 - * The default value is `top`.
1212 - *
1213 - * If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored.
1214 - */
1215 - gravity?: "top" | "bottom" | "center";
1216 - /**
1217 - * Maximum size of the image width.
1218 - * The size increases in the order of listing.
1219 - * The default value is `md`.
1220 - */
1221 - size?:
1222 - | "xxs"
1223 - | "xs"
1224 - | "sm"
1225 - | "md"
1226 - | "lg"
1227 - | "xl"
1228 - | "xxl"
1229 - | "3xl"
1230 - | "4xl"
1231 - | "5xl"
1232 - | "full";
1233 - /**
1234 - * Aspect ratio of the image.
1235 - * The default value is `1:1`.
1236 - */
1237 - aspectRatio?:
1238 - | "1:1"
1239 - | "1.51:1"
1240 - | "1.91:1"
1241 - | "4:3"
1242 - | "16:9"
1243 - | "20:13"
1244 - | "2:1"
1245 - | "3:1"
1246 - | "3:4"
1247 - | "9:16"
1248 - | "1:2"
1249 - | "1:3";
1250 - /**
1251 - * Style of the image. Specify one of the following values:
1252 - *
1253 - * - `cover`: The image fills the entire drawing area. Parts of the image
1254 - * that do not fit in the drawing area are not displayed.
1255 - * - `fit`: The entire image is displayed in the drawing area. The background
1256 - * is displayed in the unused areas to the left and right of vertical images
1257 - * and in the areas above and below horizontal images.
1258 - *
1259 - * The default value is `fit`.
1260 - */
1261 - aspectMode?: "cover" | "fit";
1262 - /**
1263 - * Background color of the image. Use a hexadecimal color code.
1264 - */
1265 - backgroundColor?: string;
1266 - /**
1267 - * Action performed when this button is tapped.
1268 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1269 - */
1270 - action?: Action;
1271 -} & Offset;
1272 -
1273 -/**
1274 - * This component draws a separator between components in the parent box.
1275 - */
1276 -export type FlexSeparator = {
1277 - type: "separator";
1278 - /**
1279 - * Minimum space between this box and the previous component in the parent
1280 - * box.
1281 - *
1282 - * - `none` does not set a space while the other values set a space whose
1283 - * size increases in the order of listing.
1284 - * - The default value is the value of the `spacing` property of the parent
1285 - * box.
1286 - * - If this box is the first component in the parent box, the `margin`
1287 - * property will be ignored.
1288 - */
1289 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1290 - /**
1291 - * Color of the separator. Use a hexadecimal color code.
1292 - */
1293 - color?: string;
1294 -};
1295 -
1296 -/**
1297 - * This is an invisible component that places a fixed-size space at the
1298 - * beginning or end of the box.
1299 - */
1300 -export type FlexSpacer = {
1301 - type: "spacer";
1302 - /**
1303 - * Size of the space.
1304 - * The size increases in the order of listing.
1305 - * The default value is `md`.
1306 - */
1307 - size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1308 -};
1309 -
1310 -export type FlexText = {
1311 - type: "text";
1312 - text: string;
1313 - /**
1314 - * Array of spans. Be sure to set either one of the `text` property or `contents` property. If you set the `contents` property, `text` is ignored.
1315 - */
1316 - contents?: FlexSpan[];
1317 - /**
1318 - * The ratio of the width or height of this box within the parent box.
1319 - *
1320 - * The default value for the horizontal parent box is `1`, and the default
1321 - * value for the vertical parent box is `0`.
1322 - *
1323 - * For more information, see
1324 - * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1325 - */
1326 - flex?: number;
1327 - /**
1328 - * Minimum space between this box and the previous component in the parent
1329 - * box.
1330 - *
1331 - * - `none` does not set a space while the other values set a space whose
1332 - * size increases in the order of listing.
1333 - * - The default value is the value of the `spacing` property of the parent
1334 - * box.
1335 - * - If this box is the first component in the parent box, the `margin`
1336 - * property will be ignored.
1337 - */
1338 - margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1339 - /**
1340 - * Font size.
1341 - * The size increases in the order of listing.
1342 - * The default value is `md`.
1343 - */
1344 - size?:
1345 - | "xxs"
1346 - | "xs"
1347 - | "sm"
1348 - | "md"
1349 - | "lg"
1350 - | "xl"
1351 - | "xxl"
1352 - | "3xl"
1353 - | "4xl"
1354 - | "5xl";
1355 - /**
1356 - * Horizontal alignment style. Specify one of the following values:
1357 - *
1358 - * - `start`: Left-aligned
1359 - * - `end`: Right-aligned
1360 - * - `center`: Center-aligned
1361 - *
1362 - * The default value is `start`.
1363 - */
1364 - align?: "start" | "end" | "center";
1365 - /**
1366 - * Vertical alignment style. Specify one of the following values:
1367 - *
1368 - * - `top`: Top-aligned
1369 - * - `bottom`: Bottom-aligned
1370 - * - `center`: Center-aligned
1371 - *
1372 - * The default value is `top`.
1373 - *
1374 - * If the `layout` property of the parent box is `baseline`, the `gravity`
1375 - * property will be ignored.
1376 - */
1377 - gravity?: "top" | "bottom" | "center";
1378 - /**
1379 - * `true` to wrap text.
1380 - *
1381 - * The default value is `false`.
1382 - *
1383 - * If set to `true`, you can use a new line character (\n) to begin on a new
1384 - * line.
1385 - */
1386 - wrap?: boolean;
1387 - /**
1388 - * Max number of lines. If the text does not fit in the specified number of
1389 - * lines, an ellipsis (…) is displayed at the end of the last line. If set to
1390 - * 0, all the text is displayed. The default value is 0.
1391 - */
1392 - maxLines?: number;
1393 - /**
1394 - * Font weight.
1395 - * Specifying `bold`makes the font bold.
1396 - * The default value is `regular`.
1397 - */
1398 - weight?: "regular" | "bold";
1399 - /**
1400 - * Font color. Use a hexadecimal color code.
1401 - */
1402 - color?: string;
1403 - /**
1404 - * Action performed when this text is tapped.
1405 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1406 - */
1407 - action?: Action;
1408 - /**
1409 - * Style of the text. Specify one of the following values:
1410 - * - `normal`: Normal
1411 - * - `italic`: Italic
1412 - *
1413 - * The default value is `normal`.
1414 - */
1415 - style?: string;
1416 - /**
1417 - * Decoration of the text. Specify one of the following values:
1418 - * `none`: No decoration
1419 - * `underline`: Underline
1420 - * `line-through`: Strikethrough
1421 - *
1422 - * The default value is `none`.
1423 - */
1424 - decoration?: string;
1425 -} & Offset;
1426 -
1427 -/**
1428 - * This component renders multiple text strings with different designs in one row. You can specify the color, size, weight, and decoration for the font. Span is set to `contents` property in [Text](https://developers.line.biz/en/reference/messaging-api/#f-text).
1429 - */
1430 -export type FlexSpan = {
1431 - type: "span";
1432 - /**
1433 - * Text. If the `wrap` property of the parent text is set to `true`, you can use a new line character (`\n`) to begin on a new line.
1434 - */
1435 - text: string;
1436 - /**
1437 - * Font color. Use a hexadecimal color code.
1438 - */
1439 - color?: string;
1440 - /**
1441 - * Font size. You can specify one of the following values: `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `xxl`, `3xl`, `4xl`, or `5xl`. The size increases in the order of listing. The default value is `md`.
1442 - */
1443 - size?: string;
1444 - /**
1445 - * Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
1446 - */
1447 - weight?: string;
1448 - /**
1449 - * Style of the text. Specify one of the following values:
1450 - * - `normal`: Normal
1451 - * - `italic`: Italic
1452 - *
1453 - * The default value is `normal`.
1454 - */
1455 - style?: string;
1456 - /**
1457 - * Decoration of the text. Specify one of the following values:
1458 - * `none`: No decoration
1459 - * `underline`: Underline
1460 - * `line-through`: Strikethrough
1461 - *
1462 - * The default value is `none`.
1463 - *
1464 - * Note: The decoration set in the `decoration` property of the [text](https://developers.line.biz/en/reference/messaging-api/#f-text) cannot be overwritten by the `decoration` property of the span.
1465 - */
1466 - decoration?: string;
1467 -};
1468 -
1469 -export type TemplateContent =
1470 - | TemplateButtons
1471 - | TemplateConfirm
1472 - | TemplateCarousel
1473 - | TemplateImageCarousel;
1474 -
1475 -/**
1476 - * Template with an image, title, text, and multiple action buttons.
1477 - *
1478 - * Because of the height limitation for buttons template messages, the lower
1479 - * part of the text display area will get cut off if the height limitation is
1480 - * exceeded. For this reason, depending on the character width, the message
1481 - * text may not be fully displayed even when it is within the character limits.
1482 - */
1483 -export type TemplateButtons = {
1484 - type: "buttons";
1485 - /**
1486 - * Image URL (Max: 1000 characters)
1487 - *
1488 - * - HTTPS
1489 - * - JPEG or PNG
1490 - * - Max width: 1024px
1491 - * - Max: 1 MB
1492 - */
1493 - thumbnailImageUrl?: string;
1494 - /**
1495 - * Aspect ratio of the image. Specify one of the following values:
1496 - *
1497 - * - `rectangle`: 1.51:1
1498 - * - `square`: 1:1
1499 - *
1500 - * The default value is `rectangle`
1501 - */
1502 - imageAspectRatio?: "rectangle" | "square";
1503 - /**
1504 - * Size of the image. Specify one of the following values:
1505 - *
1506 - * - `cover`: The image fills the entire image area. Parts of the image that
1507 - * do not fit in the area are not displayed.
1508 - * - `contain`: The entire image is displayed in the image area. A background
1509 - * is displayed in the unused areas to the left and right of vertical images
1510 - * and in the areas above and below horizontal images.
1511 - *
1512 - * The default value is `cover`.
1513 - */
1514 - imageSize?: "cover" | "contain";
1515 - /**
1516 - * Background color of image. Specify a RGB color value.
1517 - * The default value is `#FFFFFF` (white).
1518 - */
1519 - imageBackgroundColor?: string;
1520 - /**
1521 - * Title (Max: 40 characters)
1522 - */
1523 - title?: string;
1524 - /**
1525 - * Message text
1526 - *
1527 - * - Max: 160 characters (no image or title)
1528 - * - Max: 60 characters (message with an image or title)
1529 - */
1530 - text: string;
1531 - /**
1532 - * Action when tapped (Max: 4)
1533 - */
1534 - actions: Action[];
1535 -};
1536 -
1537 -/**
1538 - * Template with two action buttons.
1539 - *
1540 - * Because of the height limitation for confirm template messages, the lower
1541 - * part of the `text` display area will get cut off if the height limitation is
1542 - * exceeded. For this reason, depending on the character width, the message
1543 - * text may not be fully displayed even when it is within the character limits.
1544 - */
1545 -export type TemplateConfirm = {
1546 - type: "confirm";
1547 - /**
1548 - * Message text (Max: 240 characters)
1549 - */
1550 - text: string;
1551 - /**
1552 - * Action when tapped. Set 2 actions for the 2 buttons
1553 - */
1554 - actions: Action[];
1555 -};
1556 -
1557 -/**
1558 - * Template with multiple columns which can be cycled like a carousel.
1559 - * The columns will be shown in order by scrolling horizontally.
1560 - *
1561 - * Because of the height limitation for carousel template messages, the lower
1562 - * part of the `text` display area will get cut off if the height limitation is
1563 - * exceeded. For this reason, depending on the character width, the message
1564 - * text may not be fully displayed even when it is within the character limits.
1565 - *
1566 - * Keep the number of actions consistent for all columns. If you use an image
1567 - * or title for a column, make sure to do the same for all other columns.
1568 - */
1569 -export type TemplateCarousel = {
1570 - type: "carousel";
1571 - /**
1572 - * Array of columns (Max: 10)
1573 - */
1574 - columns: TemplateColumn[];
1575 - /**
1576 - * Aspect ratio of the image. Specify one of the following values:
1577 - *
1578 - * - `rectangle`: 1.51:1
1579 - * - `square`: 1:1
1580 - *
1581 - * Applies to all columns. The default value is `rectangle`.
1582 - */
1583 - imageAspectRatio?: "rectangle" | "square";
1584 - /**
1585 - * Size of the image. Specify one of the following values:
1586 - *
1587 - * - `cover`: The image fills the entire image area. Parts of the image that
1588 - * do not fit in the area are not displayed.
1589 - * - `contain`: The entire image is displayed in the image area. A background
1590 - * is displayed in the unused areas to the left and right of vertical images
1591 - * and in the areas above and below horizontal images.
1592 - *
1593 - * Applies to all columns. The default value is `cover`.
1594 - */
1595 - imageSize?: "cover" | "contain";
1596 -};
1597 -
1598 -export type TemplateColumn = {
1599 - /**
1600 - * Image URL (Max: 1000 characters)
1601 - *
1602 - * - HTTPS
1603 - * - JPEG or PNG
1604 - * - Aspect ratio: 1:1.51
1605 - * - Max width: 1024px
1606 - * - Max: 1 MB
1607 - */
1608 - thumbnailImageUrl?: string;
1609 - /**
1610 - * Background color of image. Specify a RGB color value.
1611 - * The default value is `#FFFFFF` (white).
1612 - */
1613 - imageBackgroundColor?: string;
1614 - /**
1615 - * Title (Max: 40 characters)
1616 - */
1617 - title?: string;
1618 - /**
1619 - * Message text
1620 - *
1621 - * - Max: 120 characters (no image or title)
1622 - * - Max: 60 characters (message with an image or title)
1623 - */
1624 - text: string;
1625 - /**
1626 - * Action when image is tapped; set for the entire image, title, and text area
1627 - */
1628 - defaultAction?: Action;
1629 - /**
1630 - * Action when tapped (Max: 3)
1631 - */
1632 - actions: Action[];
1633 -};
1634 -
1635 -/**
1636 - * Template with multiple images which can be cycled like a carousel.
1637 - * The images will be shown in order by scrolling horizontally.
1638 - */
1639 -export type TemplateImageCarousel = {
1640 - type: "image_carousel";
1641 - /**
1642 - * Array of columns (Max: 10)
1643 - */
1644 - columns: TemplateImageColumn[];
1645 -};
1646 -
1647 -export type TemplateImageColumn = {
1648 - /**
1649 - * Image URL (Max: 1000 characters)
1650 - *
1651 - * - HTTPS
1652 - * - JPEG or PNG
1653 - * - Aspect ratio: 1:1
1654 - * - Max width: 1024px
1655 - * - Max: 1 MB
1656 - */
1657 - imageUrl: string;
1658 - /**
1659 - * Action when image is tapped
1660 - */
1661 - action: Action<{ label?: string }>;
1662 -};
1663 -
1664 -/**
1665 - * These properties are used for the quick reply.
1666 - *
1667 - * For more information, see
1668 - * [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
1669 - */
1670 -export type QuickReply = {
1671 - /**
1672 - * This is a container that contains
1673 - * [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
1674 - *
1675 - * Array of objects (Max: 13)
1676 - */
1677 - items: QuickReplyItem[];
1678 -};
1679 -
1680 -/**
1681 - * This is a quick reply option that is displayed as a button.
1682 - *
1683 - * For more information, see
1684 - * [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
1685 - */
1686 -export type QuickReplyItem = {
1687 - type: "action";
1688 - /**
1689 - * URL of the icon that is displayed at the beginning of the button (Max: 1000 characters)
1690 - *
1691 - * - URL scheme: https
1692 - * - Image format: PNG
1693 - * - Aspect ratio: 1:1
1694 - * - Data size: Up to 1 MB
1695 - *
1696 - * There is no limit on the image size. If the `action` property has the
1697 - * following actions with empty `imageUrl`:
1698 - *
1699 - * - [camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1700 - * - [camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1701 - * - [location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1702 - *
1703 - * the default icon is displayed.
1704 - */
1705 - imageUrl?: string;
1706 - /**
1707 - * Action performed when this button is tapped.
1708 - *
1709 - * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1710 - *
1711 - * The following is a list of the available actions:
1712 - *
1713 - * - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
1714 - * - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
1715 - * - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
1716 - * - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1717 - * - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1718 - * - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1719 - */
1720 - action: Action;
1721 -};
1722 -
1723 -/**
1724 - * These are types of actions for your bot to take when a user taps a button or an image in a message.
1725 - *
1726 - * - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
1727 - * - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
1728 - * - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
1729 - * - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
1730 - * - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1731 - * - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1732 - * - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1733 - */
1734 -export type Action<ExtraFields = { label: string }> = (
1735 - | PostbackAction
1736 - | MessageAction
1737 - | URIAction
1738 - | DatetimePickerAction
1739 - | { type: "camera" }
1740 - | { type: "cameraRoll" }
1741 - | { type: "location" }) &
1742 - ExtraFields;
1743 -
1744 -/**
1745 - * When a control associated with this action is tapped, a postback event is
1746 - * returned via webhook with the specified string in the data property.
1747 - */
1748 -export type PostbackAction = {
1749 - type: "postback";
1750 - /**
1751 - * String returned via webhook in the `postback.data` property of the
1752 - * postback event (Max: 300 characters)
1753 - */
1754 - data: string;
1755 - /**
1756 - * Text displayed in the chat as a message sent by the user when the action
1757 - * is performed. Returned from the server through a webhook.
1758 - *
1759 - * - This property cannot be used with quick reply buttons. (Max: 300 characters)
1760 - * - The `displayText` and `text` properties cannot both be used at the same time.
1761 - * @deprecated
1762 - */
1763 - text?: string;
1764 - /**
1765 - * Text displayed in the chat as a message sent by the user when the action is performed.
1766 - *
1767 - * - Required for quick reply buttons.
1768 - * - Optional for the other message types.
1769 - *
1770 - * Max: 300 characters
1771 - *
1772 - * The `displayText` and `text` properties cannot both be used at the same time.
1773 - */
1774 - displayText?: string;
1775 -};
1776 -
1777 -/**
1778 - * When a control associated with this action is tapped, the string in the text
1779 - * property is sent as a message from the user.
1780 - */
1781 -export type MessageAction = {
1782 - type: "message";
1783 - /**
1784 - * Text sent when the action is performed (Max: 300 characters)
1785 - */
1786 - text: string;
1787 -};
1788 -
1789 -/**
1790 - * When a control associated with this action is tapped, the URI specified in
1791 - * the `uri` property is opened.
1792 - */
1793 -export type URIAction = {
1794 - type: "uri";
1795 - /**
1796 - * URI opened when the action is performed (Max: 1000 characters).
1797 - * Must start with `http`, `https`, or `tel`.
1798 - */
1799 - uri: string;
1800 - altUri?: AltURI;
1801 -};
1802 -
1803 -/**
1804 - * URI opened on LINE for macOS and Windows when the action is performed (Max: 1000 characters)
1805 - * If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.
1806 - * The available schemes are http, https, line, and tel.
1807 - * For more information about the LINE URL scheme, see Using the LINE URL scheme.
1808 - * This property is supported on the following version of LINE.
1809 - *
1810 - * LINE 5.12.0 or later for macOS and Windows
1811 - * Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.
1812 - */
1813 -export type AltURI = {
1814 - desktop: string;
1815 -};
1816 -
1817 -/**
1818 - * When a control associated with this action is tapped, a
1819 - * [postback event](https://developers.line.biz/en/reference/messaging-api/#postback-event)
1820 - * is returned via webhook with the date and time selected by the user from the
1821 - * date and time selection dialog.
1822 - *
1823 - * The datetime picker action does not support time zones.
1824 - *
1825 - * #### Date and time format
1826 - *
1827 - * The date and time formats for the `initial`, `max`, and `min` values are
1828 - * shown below. The `full-date`, `time-hour`, and `time-minute` formats follow
1829 - * the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) protocol.
1830 - *
1831 - * | Mode | Format | Example |
1832 - * | -------- | ------------------------------------------------------------ | -------------------------------- |
1833 - * | date | `full-date` (Max: 2100-12-31; Min: 1900-01-01) | 2017-06-18 |
1834 - * | time | `time-hour`:`time-minute` (Max: 23:59; Min: 00:00) | 00:0006:1523:59 |
1835 - * | datetime | `full-date`T`time-hour`:`time-minute` or `full-date`t`time-hour`:`time-minute` (Max: 2100-12-31T23:59; Min: 1900-01-01T00:00) | 2017-06-18T06:152017-06-18t06:15 |
1836 - */
1837 -export type DatetimePickerAction = {
1838 - type: "datetimepicker";
1839 - /**
1840 - * String returned via webhook in the `postback.data` property of the
1841 - * postback event (Max: 300 characters)
1842 - */
1843 - data: string;
1844 - mode: "date" | "time" | "datetime";
1845 - /**
1846 - * Initial value of date or time
1847 - */
1848 - initial?: string;
1849 - /**
1850 - * Largest date or time value that can be selected. Must be greater than the
1851 - * `min` value.
1852 - */
1853 - max?: string;
1854 - /**
1855 - * Smallest date or time value that can be selected. Must be less than the
1856 - * `max` value.
1857 - */
1858 - min?: string;
1859 -};
1860 -
1861 -export type Size = {
1862 - width: number;
1863 - height: number;
1864 -};
1865 -
1866 -/**
1867 - * Rich menus consist of either of these objects.
1868 - *
1869 - * - [Rich menu object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-object)
1870 - * without the rich menu ID. Use this object when you
1871 - * [create a rich menu](https://developers.line.biz/en/reference/messaging-api/#create-rich-menu).
1872 - * - [Rich menu response object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-response-object)
1873 - * with the rich menu ID. This object is returned when you
1874 - * [get a rich menu](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu)
1875 - * or [get a list of rich menus](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list).
1876 - *
1877 - * [Area objects](https://developers.line.biz/en/reference/messaging-api/#area-object) and
1878 - * [action objects](https://developers.line.biz/en/reference/messaging-api/#action-objects)
1879 - * are included in these objects.
1880 - */
1881 -export type RichMenu = {
1882 - /**
1883 - * [`size` object](https://developers.line.biz/en/reference/messaging-api/#size-object)
1884 - * which contains the width and height of the rich menu displayed in the chat.
1885 - * Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px.
1886 - */
1887 - size: Size;
1888 - /**
1889 - * `true` to display the rich menu by default. Otherwise, `false`.
1890 - */
1891 - selected: boolean;
1892 - /**
1893 - * Name of the rich menu.
1894 - *
1895 - * This value can be used to help manage your rich menus and is not displayed
1896 - * to users.
1897 - *
1898 - * (Max: 300 characters)
1899 - */
1900 - name: string;
1901 - /**
1902 - * Text displayed in the chat bar (Max: 14 characters)
1903 - */
1904 - chatBarText: string;
1905 - /**
1906 - * Array of [area objects](https://developers.line.biz/en/reference/messaging-api/#area-object)
1907 - * which define the coordinates and size of tappable areas
1908 - * (Max: 20 area objects)
1909 - */
1910 - areas: Array<{ bounds: Area; action: Action<{}> }>;
1911 -};
1912 -
1913 -export type RichMenuResponse = { richMenuId: string } & RichMenu;
1914 -
1915 -export type NumberOfMessagesSentResponse = InsightStatisticsResponse & {
1916 - /**
1917 - * The number of messages sent with the Messaging API on the date specified in date.
1918 - * The response has this property only when the value of status is `ready`.
1919 - */
1920 - success?: number;
1921 -};
1922 -
1923 -export type TargetLimitForAdditionalMessages = {
1924 - /**
1925 - * One of the following values to indicate whether a target limit is set or not.
1926 - * - `none`: This indicates that a target limit is not set.
1927 - * - `limited`: This indicates that a target limit is set.
1928 - */
1929 - type: "none" | "limited";
1930 - /**
1931 - * The target limit for additional messages in the current month.
1932 - * This property is returned when the `type` property has a value of `limited`.
1933 - */
1934 - value?: number;
1935 -};
1936 -
1937 -export type NumberOfMessagesSentThisMonth = {
1938 - /**
1939 - * The number of sent messages in the current month
1940 - */
1941 - totalUsage: number;
1942 -};
1943 -
1944 -export const LINE_REQUEST_ID_HTTP_HEADER_NAME = "x-line-request-id";
1945 -export type MessageAPIResponseBase = {
1946 - [LINE_REQUEST_ID_HTTP_HEADER_NAME]?: string;
1947 -};
1948 -
1949 -export type InsightStatisticsResponse = {
1950 - /**
1951 - * Calculation status. One of:
1952 - * - `ready`: Calculation has finished; the numbers are up-to-date.
1953 - * - `unready`: We haven't finished calculating the number of sent messages for the specified `date`. Calculation usually takes about a day. Please try again later.
1954 - * - `out_of_service`: The specified `date` is earlier than the date on which we first started calculating sent messages. Different APIs have different date. Check them at the [document](https://developers.line.biz/en/reference/messaging-api/).
1955 - */
1956 - status: "ready" | "unready" | "out_of_service";
1957 -};
1958 -
1959 -export type NumberOfMessageDeliveries = InsightStatisticsResponse & {
1960 - /**
1961 - * Number of push messages sent to **all** of this LINE official account's friends (broadcast messages).
1962 - */
1963 - broadcast: number;
1964 - /**
1965 - * Number of push messages sent to **some** of this LINE official account's friends, based on specific attributes (targeted/segmented messages).
1966 - */
1967 - targeting: number;
1968 - /**
1969 - * Number of auto-response messages sent.
1970 - */
1971 - autoResponse: number;
1972 - /**
1973 - * Number of greeting messages sent.
1974 - */
1975 - welcomeResponse: number;
1976 - /**
1977 - * Number of messages sent from LINE Official Account Manager [Chat screen](https://www.linebiz.com/jp-en/manual/OfficialAccountManager/chats/screens/).
1978 - */
1979 - chat: number;
1980 - /**
1981 - * Number of broadcast messages sent with the [Send broadcast message](https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message) Messaging API operation.
1982 - */
1983 - apiBroadcast: number;
1984 - /**
1985 - * Number of push messages sent with the [Send push message](https://developers.line.biz/en/reference/messaging-api/#send-push-message) Messaging API operation.
1986 - */
1987 - apiPush: number;
1988 - /**
1989 - * Number of multicast messages sent with the [Send multicast message](https://developers.line.biz/en/reference/messaging-api/#send-multicast-message) Messaging API operation.
1990 - */
1991 - apiMulticast: number;
1992 - /**
1993 - * Number of replies sent with the [Send reply message](https://developers.line.biz/en/reference/messaging-api/#send-reply-message) Messaging API operation.
1994 - */
1995 - apiReply: number;
1996 -};
1997 -
1998 -export type NumberOfFollowers = InsightStatisticsResponse & {
1999 - /**
2000 - * The number of times, as of the specified `date`, that a user added this LINE official account as a friend. The number doesn't decrease when a user blocks the account after adding it, or when they delete their own account.
2001 - */
2002 - followers: Number;
2003 - /**
2004 - * The number of users, as of the specified `date`, that the official account can reach with messages targeted by gender, age, or area. This number includes users for whom we estimated demographic attributes based on their activity in LINE and LINE-connected services.
2005 - */
2006 - targetedReaches: Number;
2007 - /**
2008 - * The number of users blocking the account as of the specified `date`. The number decreases when a user unblocks the account.
2009 - */
2010 - blocks: Number;
2011 -};
2012 -
2013 -export type NumberOfMessageDeliveriesResponse =
2014 - | InsightStatisticsResponse
2015 - | NumberOfMessageDeliveries;
2016 -
2017 -export type NumberOfFollowersResponse =
2018 - | InsightStatisticsResponse
2019 - | NumberOfFollowers;
2020 -
2021 -type PercentageAble = {
2022 - percentage: number;
2023 -};
2024 -
2025 -export type FriendDemoGraphics = {
2026 - /**
2027 - * `true` if friend demographic information is available.
2028 - */
2029 - available: boolean;
2030 - /**
2031 - * Percentage per gender
2032 - */
2033 - genders?: Array<
2034 - {
2035 - /**
2036 - * Gender
2037 - */
2038 - gender: "unknown" | "male" | "female";
2039 - } & PercentageAble
2040 - >;
2041 - /**
2042 - * Percentage per age group
2043 - */
2044 - ages?: Array<
2045 - {
2046 - /**
2047 - * Age group
2048 - */
2049 - age: string;
2050 - } & PercentageAble
2051 - >;
2052 - /**
2053 - * Percentage per area
2054 - */
2055 - areas?: Array<
2056 - {
2057 - area: string;
2058 - } & PercentageAble
2059 - >;
2060 - /**
2061 - * Percentage by OS
2062 - */
2063 - appTypes?: Array<
2064 - {
2065 - appType: "ios" | "android" | "others";
2066 - } & PercentageAble
2067 - >;
2068 - /**
2069 - * Percentage per friendship duration
2070 - */
2071 - subscriptionPeriods?: Array<
2072 - {
2073 - /**
2074 - * Friendship duration
2075 - */
2076 - subscriptionPeriod:
2077 - | "over365days"
2078 - | "within365days"
2079 - | "within180days"
2080 - | "within90days"
2081 - | "within30days"
2082 - | "within7days"
2083 - // in case for some rare cases(almost no)
2084 - | "unknown";
2085 - } & PercentageAble
2086 - >;
2087 -};
1 -import { createHmac, timingSafeEqual } from "crypto";
2 -
3 -function s2b(str: string, encoding: string): Buffer {
4 - return Buffer.from(str, encoding);
5 -}
6 -
7 -function safeCompare(a: Buffer, b: Buffer): boolean {
8 - if (a.length !== b.length) {
9 - return false;
10 - }
11 - return timingSafeEqual(a, b);
12 -}
13 -
14 -export default function validateSignature(
15 - body: string | Buffer,
16 - channelSecret: string,
17 - signature: string,
18 -): boolean {
19 - return safeCompare(
20 - createHmac("SHA256", channelSecret)
21 - .update(body)
22 - .digest(),
23 - s2b(signature, "base64"),
24 - );
25 -}
1 -{
2 - "_from": "@line/bot-sdk@^6.4.0",
3 - "_id": "@line/bot-sdk@6.8.3",
4 - "_inBundle": false,
5 - "_integrity": "sha512-nj2T4CQxw0W/juAlpj0kMTDScOh5QUK6xMCR2dZp+pN8B0vj/c+5uX3TyGB4ijz/NIsehgfKujPgzw7LhtYtJw==",
6 - "_location": "/@line/bot-sdk",
7 - "_phantomChildren": {},
8 - "_requested": {
9 - "type": "range",
10 - "registry": true,
11 - "raw": "@line/bot-sdk@^6.4.0",
12 - "name": "@line/bot-sdk",
13 - "escapedName": "@line%2fbot-sdk",
14 - "scope": "@line",
15 - "rawSpec": "^6.4.0",
16 - "saveSpec": null,
17 - "fetchSpec": "^6.4.0"
18 - },
19 - "_requiredBy": [
20 - "#USER",
21 - "/"
22 - ],
23 - "_resolved": "https://registry.npmjs.org/@line/bot-sdk/-/bot-sdk-6.8.3.tgz",
24 - "_shasum": "0a886461e8c16a8c89091fd5338f6071335636a6",
25 - "_spec": "@line/bot-sdk@^6.4.0",
26 - "_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT",
27 - "bugs": {
28 - "url": "https://github.com/line/line-bot-sdk-nodejs/issues"
29 - },
30 - "bundleDependencies": false,
31 - "dependencies": {
32 - "@types/body-parser": "^1.16.8",
33 - "@types/file-type": "^5.2.1",
34 - "@types/node": "^7.0.31",
35 - "axios": "^0.19.0",
36 - "body-parser": "^1.18.2",
37 - "file-type": "^7.2.0"
38 - },
39 - "deprecated": false,
40 - "description": "Node.js SDK for LINE Messaging API",
41 - "devDependencies": {
42 - "@types/express": "^4.0.35",
43 - "@types/finalhandler": "^1.1.0",
44 - "@types/mocha": "^2.2.41",
45 - "del-cli": "^1.1.0",
46 - "express": "^4.16.3",
47 - "finalhandler": "^1.1.2",
48 - "husky": "^0.14.3",
49 - "mocha": "^5.2.0",
50 - "nyc": "^14.1.1",
51 - "prettier": "^1.15.2",
52 - "ts-node": "^8.3.0",
53 - "typescript": "^3.1.6",
54 - "vuepress": "^0.14.10"
55 - },
56 - "engines": {
57 - "node": ">=8"
58 - },
59 - "files": [
60 - "dist",
61 - "lib"
62 - ],
63 - "homepage": "https://github.com/line/line-bot-sdk-nodejs#readme",
64 - "keywords": [
65 - "node",
66 - "line",
67 - "sdk"
68 - ],
69 - "license": "Apache-2.0",
70 - "main": "dist/index.js",
71 - "name": "@line/bot-sdk",
72 - "nyc": {
73 - "require": [
74 - "ts-node/register"
75 - ],
76 - "extension": [
77 - ".ts"
78 - ],
79 - "reporter": [
80 - "lcov",
81 - "text-summary"
82 - ],
83 - "sourceMap": true,
84 - "instrument": true
85 - },
86 - "repository": {
87 - "type": "git",
88 - "url": "git+ssh://git@github.com/line/line-bot-sdk-nodejs.git"
89 - },
90 - "scripts": {
91 - "build": "tsc",
92 - "clean": "del-cli dist",
93 - "docs": "vuepress dev docs",
94 - "docs:build": "vuepress build docs",
95 - "docs:deploy": "./deploy-docs.sh",
96 - "format": "npm run prettier -- --write",
97 - "format:check": "npm run prettier -- -l",
98 - "prebuild": "npm run format:check && npm run clean",
99 - "precommit": "npm run format:check",
100 - "prepush": "npm run format:check && npm run build && npm run test",
101 - "pretest": "npm run build",
102 - "prettier": "prettier --parser typescript --trailing-comma all \"{lib,test}/**/*.ts\"",
103 - "release": "npm run build && npm publish --access public",
104 - "test": "API_BASE_URL=http://localhost:1234/ TEST_PORT=1234 TS_NODE_CACHE=0 nyc mocha"
105 - },
106 - "types": "dist/index.d.ts",
107 - "version": "6.8.3"
108 -}
1 -# Installation
2 -> `npm install --save @types/body-parser`
3 -
4 -# Summary
5 -This package contains type definitions for body-parser (https://github.com/expressjs/body-parser).
6 -
7 -# Details
8 -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser
9 -
10 -Additional Details
11 - * Last updated: Mon, 19 Aug 2019 00:51:08 GMT
12 - * Dependencies: @types/connect, @types/node
13 - * Global values: none
14 -
15 -# Credits
16 -These definitions were written by Santi Albo <https://github.com/santialbo>, Vilic Vane <https://github.com/vilic>, Jonathan Häberle <https://github.com/dreampulse>, Gevik Babakhani <https://github.com/blendsdk>, Tomasz Łaziuk <https://github.com/tlaziuk>, and Jason Walton <https://github.com/jwalton>.
1 -// Type definitions for body-parser 1.17
2 -// Project: https://github.com/expressjs/body-parser
3 -// Definitions by: Santi Albo <https://github.com/santialbo>
4 -// Vilic Vane <https://github.com/vilic>
5 -// Jonathan Häberle <https://github.com/dreampulse>
6 -// Gevik Babakhani <https://github.com/blendsdk>
7 -// Tomasz Łaziuk <https://github.com/tlaziuk>
8 -// Jason Walton <https://github.com/jwalton>
9 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
10 -// TypeScript Version: 2.3
11 -
12 -/// <reference types="node" />
13 -
14 -import { NextHandleFunction } from 'connect';
15 -import * as http from 'http';
16 -
17 -// for docs go to https://github.com/expressjs/body-parser/tree/1.16.0#body-parser
18 -
19 -// @deprecated
20 -declare function bodyParser(options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded): NextHandleFunction;
21 -
22 -declare namespace bodyParser {
23 - interface Options {
24 - inflate?: boolean;
25 - limit?: number | string;
26 - type?: string | string[] | ((req: http.IncomingMessage) => any);
27 - verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;
28 - }
29 -
30 - interface OptionsJson extends Options {
31 - reviver?(key: string, value: any): any;
32 - strict?: boolean;
33 - }
34 -
35 - interface OptionsText extends Options {
36 - defaultCharset?: string;
37 - }
38 -
39 - interface OptionsUrlencoded extends Options {
40 - extended?: boolean;
41 - parameterLimit?: number;
42 - }
43 -
44 - function json(options?: OptionsJson): NextHandleFunction;
45 -
46 - function raw(options?: Options): NextHandleFunction;
47 -
48 - function text(options?: OptionsText): NextHandleFunction;
49 -
50 - function urlencoded(options?: OptionsUrlencoded): NextHandleFunction;
51 -}
52 -
53 -export = bodyParser;
1 -{
2 - "_from": "@types/body-parser@^1.16.8",
3 - "_id": "@types/body-parser@1.17.1",
4 - "_inBundle": false,
5 - "_integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
6 - "_location": "/@types/body-parser",
7 - "_phantomChildren": {},
8 - "_requested": {
9 - "type": "range",
10 - "registry": true,
11 - "raw": "@types/body-parser@^1.16.8",
12 - "name": "@types/body-parser",
13 - "escapedName": "@types%2fbody-parser",
14 - "scope": "@types",
15 - "rawSpec": "^1.16.8",
16 - "saveSpec": null,
17 - "fetchSpec": "^1.16.8"
18 - },
19 - "_requiredBy": [
20 - "/@line/bot-sdk"
21 - ],
22 - "_resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
23 - "_shasum": "18fcf61768fb5c30ccc508c21d6fd2e8b3bf7897",
24 - "_spec": "@types/body-parser@^1.16.8",
25 - "_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\@line\\bot-sdk",
26 - "bugs": {
27 - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28 - },
29 - "bundleDependencies": false,
30 - "contributors": [
31 - {
32 - "name": "Santi Albo",
33 - "url": "https://github.com/santialbo"
34 - },
35 - {
36 - "name": "Vilic Vane",
37 - "url": "https://github.com/vilic"
38 - },
39 - {
40 - "name": "Jonathan Häberle",
41 - "url": "https://github.com/dreampulse"
42 - },
43 - {
44 - "name": "Gevik Babakhani",
45 - "url": "https://github.com/blendsdk"
46 - },
47 - {
48 - "name": "Tomasz Łaziuk",
49 - "url": "https://github.com/tlaziuk"
50 - },
51 - {
52 - "name": "Jason Walton",
53 - "url": "https://github.com/jwalton"
54 - }
55 - ],
56 - "dependencies": {
57 - "@types/connect": "*",
58 - "@types/node": "*"
59 - },
60 - "deprecated": false,
61 - "description": "TypeScript definitions for body-parser",
62 - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
63 - "license": "MIT",
64 - "main": "",
65 - "name": "@types/body-parser",
66 - "repository": {
67 - "type": "git",
68 - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
69 - "directory": "types/body-parser"
70 - },
71 - "scripts": {},
72 - "typeScriptVersion": "2.3",
73 - "types": "index",
74 - "typesPublisherContentHash": "ada1b55777df6de5327f420d23285a5c476895faa88cacf6b80a1a791eef0f67",
75 - "version": "1.17.1"
76 -}
1 -# Installation
2 -> `npm install --save @types/node`
3 -
4 -# Summary
5 -This package contains type definitions for Node.js (http://nodejs.org/).
6 -
7 -# Details
8 -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v7
9 -
10 -Additional Details
11 - * Last updated: Wed, 30 Oct 2019 15:44:46 GMT
12 - * Dependencies: none
13 - * Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
14 -
15 -# Credits
16 -These definitions were written by Microsoft TypeScript <https://github.com/Microsoft>, DefinitelyTyped <https://github.com/DefinitelyTyped>, Parambir Singh <https://github.com/parambirs>, Christian Vaagland Tellnes <https://github.com/tellnes>, Wilco Bakker <https://github.com/WilcoBakker>, Sebastian Silbermann <https://github.com/eps1lon>, Hoàng Văn Khải <https://github.com/KSXGitHub>, Sander Koenders <https://github.com/Archcry>, and Jordi Oliveras Rovira <https://github.com/j-oliveras>.
This diff could not be displayed because it is too large.
1 -// Type definitions for Node.js 7.10
2 -// Project: http://nodejs.org/
3 -// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4 -// DefinitelyTyped <https://github.com/DefinitelyTyped>
5 -// Parambir Singh <https://github.com/parambirs>
6 -// Christian Vaagland Tellnes <https://github.com/tellnes>
7 -// Wilco Bakker <https://github.com/WilcoBakker>
8 -// Sebastian Silbermann <https://github.com/eps1lon>
9 -// Hoàng Văn Khải <https://github.com/KSXGitHub>
10 -// Sander Koenders <https://github.com/Archcry>
11 -// Jordi Oliveras Rovira <https://github.com/j-oliveras>
12 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
13 -/************************************************
14 -* *
15 -* Node.js v7.x API *
16 -* *
17 -************************************************/
18 -// NOTE: These definitions support NodeJS and TypeScript 3.1.
19 -
20 -// NOTE: TypeScript version-specific augmentations can be found in the following paths:
21 -// - ~/base.d.ts - Shared definitions common to all TypeScript versions
22 -// - ~/index.d.ts - Definitions specific to TypeScript 2.1
23 -// - ~/ts3.1/index.d.ts - Definitions specific to TypeScript 3.1
24 -
25 -// NOTE: Augmentations for TypeScript 3.1 and later should use individual files for overrides
26 -// within the respective ~/ts3.1 (or later) folder. However, this is disallowed for versions
27 -// prior to TypeScript 3.1, so the older definitions will be found here.
28 -
29 -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
30 -/// <reference path="base.d.ts" />
31 -
32 -// TypeScript 2.1-specific augmentations:
33 -
34 -// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
35 -interface MapConstructor { }
36 -interface WeakMapConstructor { }
37 -interface SetConstructor { }
38 -interface WeakSetConstructor { }
39 -interface IteratorResult<T> {}
40 -interface Iterable<T> {}
41 -interface Iterator<T> {
42 - next(value?: any): IteratorResult<T>;
43 -}
44 -interface IterableIterator<T> { }
45 -interface SymbolConstructor {
46 - readonly iterator: symbol;
47 -}
48 -declare var Symbol: SymbolConstructor;
1 -{
2 - "_from": "@types/node@^7.0.31",
3 - "_id": "@types/node@7.10.9",
4 - "_inBundle": false,
5 - "_integrity": "sha512-usSpgoUsRtO5xNV5YEPU8PPnHisFx8u0rokj1BPVn/hDF7zwUDzVLiuKZM38B7z8V2111Fj6kd4rGtQFUZpNOw==",
6 - "_location": "/@types/node",
7 - "_phantomChildren": {},
8 - "_requested": {
9 - "type": "range",
10 - "registry": true,
11 - "raw": "@types/node@^7.0.31",
12 - "name": "@types/node",
13 - "escapedName": "@types%2fnode",
14 - "scope": "@types",
15 - "rawSpec": "^7.0.31",
16 - "saveSpec": null,
17 - "fetchSpec": "^7.0.31"
18 - },
19 - "_requiredBy": [
20 - "/@line/bot-sdk",
21 - "/@types/body-parser",
22 - "/@types/connect",
23 - "/@types/file-type"
24 - ],
25 - "_resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.9.tgz",
26 - "_shasum": "4343e3b009f8cf5e1ed685e36097b74b4101e880",
27 - "_spec": "@types/node@^7.0.31",
28 - "_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\@line\\bot-sdk",
29 - "bugs": {
30 - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
31 - },
32 - "bundleDependencies": false,
33 - "contributors": [
34 - {
35 - "name": "Microsoft TypeScript",
36 - "url": "https://github.com/Microsoft"
37 - },
38 - {
39 - "name": "DefinitelyTyped",
40 - "url": "https://github.com/DefinitelyTyped"
41 - },
42 - {
43 - "name": "Parambir Singh",
44 - "url": "https://github.com/parambirs"
45 - },
46 - {
47 - "name": "Christian Vaagland Tellnes",
48 - "url": "https://github.com/tellnes"
49 - },
50 - {
51 - "name": "Wilco Bakker",
52 - "url": "https://github.com/WilcoBakker"
53 - },
54 - {
55 - "name": "Sebastian Silbermann",
56 - "url": "https://github.com/eps1lon"
57 - },
58 - {
59 - "name": "Hoàng Văn Khải",
60 - "url": "https://github.com/KSXGitHub"
61 - },
62 - {
63 - "name": "Sander Koenders",
64 - "url": "https://github.com/Archcry"
65 - },
66 - {
67 - "name": "Jordi Oliveras Rovira",
68 - "url": "https://github.com/j-oliveras"
69 - }
70 - ],
71 - "dependencies": {},
72 - "deprecated": false,
73 - "description": "TypeScript definitions for Node.js",
74 - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
75 - "license": "MIT",
76 - "main": "",
77 - "name": "@types/node",
78 - "repository": {
79 - "type": "git",
80 - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
81 - "directory": "types/node"
82 - },
83 - "scripts": {},
84 - "typeScriptVersion": "2.0",
85 - "types": "index",
86 - "typesPublisherContentHash": "0c534d9103600d73c97ec8a474420c4d9262b941ae93e66c175cb27e62683e84",
87 - "typesVersions": {
88 - ">=3.2.0-0": {
89 - "*": [
90 - "ts3.2/*"
91 - ]
92 - }
93 - },
94 - "version": "7.10.9"
95 -}
1 -// NOTE: These definitions support NodeJS and TypeScript 3.2.
2 -
3 -// NOTE: TypeScript version-specific augmentations can be found in the following paths:
4 -// - ~/base.d.ts - Shared definitions common to all TypeScript versions
5 -// - ~/index.d.ts - Definitions specific to TypeScript 2.1
6 -// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
7 -
8 -// Reference required types from the default lib:
9 -/// <reference lib="es2016" />
10 -
11 -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
12 -// tslint:disable-next-line:no-bad-reference
13 -/// <reference path="../base.d.ts" />
14 -
15 -// TypeScript 3.2-specific augmentations:
1 -# Changelog
2 -
3 -### 0.19.0 (May 30, 2019)
4 -
5 -Fixes and Functionality:
6 -
7 -- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski
8 -- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issue/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev
9 -- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama
10 -- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester
11 -- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers
12 -- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel
13 -- Consistent coding style ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez
14 -- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov
15 -- This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#`
16 -- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson
17 -- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi
18 -- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta
19 -- Fix failing SauceLabs tests by updating configuration - Emily Morehouse
20 -
21 -Documentation:
22 -
23 -- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna
24 -- Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho
25 -- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan
26 -- Add r2curl in ECOSYSTEM ([#2141](https://github.com/axios/axios/pull/2141)) - 유용우 / CX
27 -- Update README.md - Add instructions for installing with yarn ([#2036](https://github.com/axios/axios/pull/2036)) - Victor Hermes
28 -- Fixing spacing for README.md ([#2066](https://github.com/axios/axios/pull/2066)) - Josh McCarty
29 -- Update README.md. - Change `.then` to `.finally` in example code ([#2090](https://github.com/axios/axios/pull/2090)) - Omar Cai
30 -- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher
31 -- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe
32 -- It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser
33 -- Add issue templates - Emily Morehouse
34 -- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko
35 -- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan
36 -- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer
37 -
38 -### 0.19.0-beta.1 (Aug 9, 2018)
39 -
40 -**NOTE:** This is a beta version of this release. There may be functionality that is broken in
41 -certain browsers, though we suspect that builds are hanging and not erroring. See
42 -https://saucelabs.com/u/axios for the most up-to-date information.
43 -
44 -New Functionality:
45 -
46 -- Add getUri method ([#1712](https://github.com/axios/axios/issues/1712))
47 -- Add support for no_proxy env variable ([#1693](https://github.com/axios/axios/issues/1693))
48 -- Add toJSON to decorated Axios errors to faciliate serialization ([#1625](https://github.com/axios/axios/issues/1625))
49 -- Add second then on axios call ([#1623](https://github.com/axios/axios/issues/1623))
50 -- Typings: allow custom return types
51 -- Add option to specify character set in responses (with http adapter)
52 -
53 -Fixes:
54 -
55 -- Fix Keep defaults local to instance ([#385](https://github.com/axios/axios/issues/385))
56 -- Correctly catch exception in http test ([#1475](https://github.com/axios/axios/issues/1475))
57 -- Fix accept header normalization ([#1698](https://github.com/axios/axios/issues/1698))
58 -- Fix http adapter to allow HTTPS connections via HTTP ([#959](https://github.com/axios/axios/issues/959))
59 -- Fix Removes usage of deprecated Buffer constructor. ([#1555](https://github.com/axios/axios/issues/1555), [#1622](https://github.com/axios/axios/issues/1622))
60 -- Fix defaults to use httpAdapter if available ([#1285](https://github.com/axios/axios/issues/1285))
61 - - Fixing defaults to use httpAdapter if available
62 - - Use a safer, cross-platform method to detect the Node environment
63 -- Fix Reject promise if request is cancelled by the browser ([#537](https://github.com/axios/axios/issues/537))
64 -- [Typescript] Fix missing type parameters on delete/head methods
65 -- [NS]: Send `false` flag isStandardBrowserEnv for Nativescript
66 -- Fix missing type parameters on delete/head
67 -- Fix Default method for an instance always overwritten by get
68 -- Fix type error when socketPath option in AxiosRequestConfig
69 -- Capture errors on request data streams
70 -- Decorate resolve and reject to clear timeout in all cases
71 -
72 -Huge thanks to everyone who contributed to this release via code (authors listed
73 -below) or via reviews and triaging on GitHub:
74 -
75 -- Andrew Scott <ascott18@gmail.com>
76 -- Anthony Gauthier <antho325@hotmail.com>
77 -- arpit <arpit2438735@gmail.com>
78 -- ascott18
79 -- Benedikt Rötsch <axe312ger@users.noreply.github.com>
80 -- Chance Dickson <me@chancedickson.com>
81 -- Dave Stewart <info@davestewart.co.uk>
82 -- Deric Cain <deric.cain@gmail.com>
83 -- Guillaume Briday <guillaumebriday@gmail.com>
84 -- Jacob Wejendorp <jacob@wejendorp.dk>
85 -- Jim Lynch <mrdotjim@gmail.com>
86 -- johntron
87 -- Justin Beckwith <beckwith@google.com>
88 -- Justin Beckwith <justin.beckwith@gmail.com>
89 -- Khaled Garbaya <khaledgarbaya@gmail.com>
90 -- Lim Jing Rong <jjingrong@users.noreply.github.com>
91 -- Mark van den Broek <mvdnbrk@gmail.com>
92 -- Martti Laine <martti@codeclown.net>
93 -- mattridley
94 -- mattridley <matt.r@joinblink.com>
95 -- Nicolas Del Valle <nicolas.delvalle@gmail.com>
96 -- Nilegfx
97 -- pbarbiero
98 -- Rikki Gibson <rikkigibson@gmail.com>
99 -- Sako Hartounian <sakohartounian@yahoo.com>
100 -- Shane Fitzpatrick <fitzpasd@gmail.com>
101 -- Stephan Schneider <stephanschndr@gmail.com>
102 -- Steven <steven@ceriously.com>
103 -- Tim Garthwaite <tim.garthwaite@jibo.com>
104 -- Tim Johns <timjohns@yahoo.com>
105 -- Yutaro Miyazaki <yutaro@studio-rubbish.com>
106 -
107 -### 0.18.0 (Feb 19, 2018)
108 -
109 -- Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070))
110 -- Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)):
111 - - AxiosRequestConfig.proxy: allows type false
112 - - AxiosProxyConfig: added auth field
113 -- Adding function signature in AxiosInstance interface so AxiosInstance can be invoked ([#1192](https://github.com/axios/axios/pull/1192), [#1254](https://github.com/axios/axios/pull/1254))
114 -- Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287))
115 -- Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342))
116 -
117 -### 0.17.1 (Nov 11, 2017)
118 -
119 -- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))
120 -- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080))
121 -- Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131))
122 -
123 -### 0.17.0 (Oct 21, 2017)
124 -
125 -- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))
126 -- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874))
127 -- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691))
128 -- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061))
129 -
130 -### 0.16.2 (Jun 3, 2017)
131 -
132 -- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))
133 -- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830))
134 -- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930))
135 -
136 -### 0.16.1 (Apr 8, 2017)
137 -
138 -- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))
139 -- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829))
140 -- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773))
141 -
142 -### 0.16.0 (Mar 31, 2017)
143 -
144 -- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))
145 -- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461))
146 -- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654))
147 -- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731))
148 -- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581))
149 -- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561))
150 -
151 -### 0.15.3 (Nov 27, 2016)
152 -
153 -- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))
154 -- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519))
155 -- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509))
156 -- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507))
157 -- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483))
158 -- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493))
159 -- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491))
160 -
161 -### 0.15.2 (Oct 17, 2016)
162 -
163 -- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482))
164 -
165 -### 0.15.1 (Oct 14, 2016)
166 -
167 -- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
168 -
169 -### 0.15.0 (Oct 10, 2016)
170 -
171 -- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))
172 -- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437))
173 -- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440))
174 -- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445))
175 -
176 -### 0.14.0 (Aug 27, 2016)
177 -
178 -- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))
179 -- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387))
180 -- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423))
181 -- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366))
182 -- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397))
183 -- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406))
184 -
185 -### 0.13.1 (Jul 16, 2016)
186 -
187 -- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378))
188 -
189 -### 0.13.0 (Jul 13, 2016)
190 -
191 -- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))
192 -- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
193 -- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
194 -- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343))
195 -- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352))
196 -- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341))
197 -- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217))
198 -
199 -### 0.12.0 (May 31, 2016)
200 -
201 -- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))
202 -- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307))
203 -
204 -### 0.11.1 (May 17, 2016)
205 -
206 -- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))
207 -- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325))
208 -- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321))
209 -
210 -### 0.11.0 (Apr 26, 2016)
211 -
212 -- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))
213 -- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308))
214 -- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299))
215 -
216 -### 0.10.0 (Apr 20, 2016)
217 -
218 -- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))
219 -- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252))
220 -- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227))
221 -- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249))
222 -- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251))
223 -- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275))
224 -- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279))
225 -- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200))
226 -
227 -### 0.9.1 (Jan 24, 2016)
228 -
229 -- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))
230 -- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205))
231 -- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201))
232 -- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198))
233 -
234 -### 0.9.0 (Jan 18, 2016)
235 -
236 -- Adding support for custom adapters
237 -- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195))
238 -- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185))
239 -- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183))
240 -- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182))
241 -
242 -### 0.8.1 (Dec 14, 2015)
243 -
244 -- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))
245 -- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173))
246 -- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174))
247 -
248 -### 0.8.0 (Dec 11, 2015)
249 -
250 -- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))
251 -- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128))
252 -- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121))
253 -- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127))
254 -- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146))
255 -- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149))
256 -- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140))
257 -- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167))
258 -- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160))
259 -
260 -### 0.7.0 (Sep 29, 2015)
261 -
262 -- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))
263 -- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102))
264 -- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106))
265 -- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105))
266 -- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112))
267 -- Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98))
268 -- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116))
269 -
270 -### 0.6.0 (Sep 21, 2015)
271 -
272 -- Removing deprecated success/error aliases
273 -- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49))
274 -- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69))
275 -- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56))
276 -- Removing es6-promise dependency
277 -- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91))
278 -- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85))
279 -- Converting build to UMD
280 -
281 -### 0.5.4 (Apr 08, 2015)
282 -
283 -- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53))
284 -
285 -### 0.5.3 (Apr 07, 2015)
286 -
287 -- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
288 -
289 -### 0.5.2 (Mar 13, 2015)
290 -
291 -- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46))
292 -
293 -### 0.5.1 (Mar 10, 2015)
294 -
295 -- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))
296 -- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47))
297 -
298 -### 0.5.0 (Jan 23, 2015)
299 -
300 -- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))
301 -- Updating es6-promise dependency
302 -
303 -### 0.4.2 (Dec 10, 2014)
304 -
305 -- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))
306 -- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25))
307 -- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29))
308 -- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30))
309 -
310 -### 0.4.1 (Oct 15, 2014)
311 -
312 -- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18))
313 -
314 -### 0.4.0 (Oct 03, 2014)
315 -
316 -- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))
317 -- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13))
318 -- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12))
319 -- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9))
320 -- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11))
321 -- Deprecating `success`/`error` in favor of `then`/`catch`
322 -
323 -### 0.3.1 (Sep 16, 2014)
324 -
325 -- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3))
326 -
327 -### 0.3.0 (Sep 16, 2014)
328 -
329 -- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))
330 -- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6))
331 -- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7))
332 -
333 -### 0.2.2 (Sep 14, 2014)
334 -
335 -- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
336 -
337 -### 0.2.1 (Sep 12, 2014)
338 -
339 -- Fixing build problem causing ridiculous file sizes
340 -
341 -### 0.2.0 (Sep 12, 2014)
342 -
343 -- Adding support for `all` and `spread`
344 -- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1))
345 -
346 -### 0.1.0 (Aug 29, 2014)
347 -
348 -- Initial release
1 -Copyright (c) 2014-present Matt Zabriskie
2 -
3 -Permission is hereby granted, free of charge, to any person obtaining a copy
4 -of this software and associated documentation files (the "Software"), to deal
5 -in the Software without restriction, including without limitation the rights
6 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 -copies of the Software, and to permit persons to whom the Software is
8 -furnished to do so, subject to the following conditions:
9 -
10 -The above copyright notice and this permission notice shall be included in
11 -all copies or substantial portions of the Software.
12 -
13 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 -THE SOFTWARE.
1 -# axios
2 -
3 -[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
4 -[![build status](https://img.shields.io/travis/axios/axios.svg?style=flat-square)](https://travis-ci.org/axios/axios)
5 -[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
6 -[![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
7 -[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
8 -[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
9 -[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
10 -
11 -Promise based HTTP client for the browser and node.js
12 -
13 -## Features
14 -
15 -- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
16 -- Make [http](http://nodejs.org/api/http.html) requests from node.js
17 -- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
18 -- Intercept request and response
19 -- Transform request and response data
20 -- Cancel requests
21 -- Automatic transforms for JSON data
22 -- Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
23 -
24 -## Browser Support
25 -
26 -![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
27 ---- | --- | --- | --- | --- | --- |
28 -Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
29 -
30 -[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
31 -
32 -## Installing
33 -
34 -Using npm:
35 -
36 -```bash
37 -$ npm install axios
38 -```
39 -
40 -Using bower:
41 -
42 -```bash
43 -$ bower install axios
44 -```
45 -
46 -Using yarn:
47 -
48 -```bash
49 -$ yarn add axios
50 -```
51 -
52 -Using cdn:
53 -
54 -```html
55 -<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
56 -```
57 -
58 -## Example
59 -
60 -Performing a `GET` request
61 -
62 -```js
63 -const axios = require('axios');
64 -
65 -// Make a request for a user with a given ID
66 -axios.get('/user?ID=12345')
67 - .then(function (response) {
68 - // handle success
69 - console.log(response);
70 - })
71 - .catch(function (error) {
72 - // handle error
73 - console.log(error);
74 - })
75 - .finally(function () {
76 - // always executed
77 - });
78 -
79 -// Optionally the request above could also be done as
80 -axios.get('/user', {
81 - params: {
82 - ID: 12345
83 - }
84 - })
85 - .then(function (response) {
86 - console.log(response);
87 - })
88 - .catch(function (error) {
89 - console.log(error);
90 - })
91 - .then(function () {
92 - // always executed
93 - });
94 -
95 -// Want to use async/await? Add the `async` keyword to your outer function/method.
96 -async function getUser() {
97 - try {
98 - const response = await axios.get('/user?ID=12345');
99 - console.log(response);
100 - } catch (error) {
101 - console.error(error);
102 - }
103 -}
104 -```
105 -
106 -> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
107 -> Explorer and older browsers, so use with caution.
108 -
109 -Performing a `POST` request
110 -
111 -```js
112 -axios.post('/user', {
113 - firstName: 'Fred',
114 - lastName: 'Flintstone'
115 - })
116 - .then(function (response) {
117 - console.log(response);
118 - })
119 - .catch(function (error) {
120 - console.log(error);
121 - });
122 -```
123 -
124 -Performing multiple concurrent requests
125 -
126 -```js
127 -function getUserAccount() {
128 - return axios.get('/user/12345');
129 -}
130 -
131 -function getUserPermissions() {
132 - return axios.get('/user/12345/permissions');
133 -}
134 -
135 -axios.all([getUserAccount(), getUserPermissions()])
136 - .then(axios.spread(function (acct, perms) {
137 - // Both requests are now complete
138 - }));
139 -```
140 -
141 -## axios API
142 -
143 -Requests can be made by passing the relevant config to `axios`.
144 -
145 -##### axios(config)
146 -
147 -```js
148 -// Send a POST request
149 -axios({
150 - method: 'post',
151 - url: '/user/12345',
152 - data: {
153 - firstName: 'Fred',
154 - lastName: 'Flintstone'
155 - }
156 -});
157 -```
158 -
159 -```js
160 -// GET request for remote image
161 -axios({
162 - method: 'get',
163 - url: 'http://bit.ly/2mTM3nY',
164 - responseType: 'stream'
165 -})
166 - .then(function (response) {
167 - response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
168 - });
169 -```
170 -
171 -##### axios(url[, config])
172 -
173 -```js
174 -// Send a GET request (default method)
175 -axios('/user/12345');
176 -```
177 -
178 -### Request method aliases
179 -
180 -For convenience aliases have been provided for all supported request methods.
181 -
182 -##### axios.request(config)
183 -##### axios.get(url[, config])
184 -##### axios.delete(url[, config])
185 -##### axios.head(url[, config])
186 -##### axios.options(url[, config])
187 -##### axios.post(url[, data[, config]])
188 -##### axios.put(url[, data[, config]])
189 -##### axios.patch(url[, data[, config]])
190 -
191 -###### NOTE
192 -When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
193 -
194 -### Concurrency
195 -
196 -Helper functions for dealing with concurrent requests.
197 -
198 -##### axios.all(iterable)
199 -##### axios.spread(callback)
200 -
201 -### Creating an instance
202 -
203 -You can create a new instance of axios with a custom config.
204 -
205 -##### axios.create([config])
206 -
207 -```js
208 -const instance = axios.create({
209 - baseURL: 'https://some-domain.com/api/',
210 - timeout: 1000,
211 - headers: {'X-Custom-Header': 'foobar'}
212 -});
213 -```
214 -
215 -### Instance methods
216 -
217 -The available instance methods are listed below. The specified config will be merged with the instance config.
218 -
219 -##### axios#request(config)
220 -##### axios#get(url[, config])
221 -##### axios#delete(url[, config])
222 -##### axios#head(url[, config])
223 -##### axios#options(url[, config])
224 -##### axios#post(url[, data[, config]])
225 -##### axios#put(url[, data[, config]])
226 -##### axios#patch(url[, data[, config]])
227 -##### axios#getUri([config])
228 -
229 -## Request Config
230 -
231 -These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
232 -
233 -```js
234 -{
235 - // `url` is the server URL that will be used for the request
236 - url: '/user',
237 -
238 - // `method` is the request method to be used when making the request
239 - method: 'get', // default
240 -
241 - // `baseURL` will be prepended to `url` unless `url` is absolute.
242 - // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
243 - // to methods of that instance.
244 - baseURL: 'https://some-domain.com/api/',
245 -
246 - // `transformRequest` allows changes to the request data before it is sent to the server
247 - // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
248 - // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
249 - // FormData or Stream
250 - // You may modify the headers object.
251 - transformRequest: [function (data, headers) {
252 - // Do whatever you want to transform the data
253 -
254 - return data;
255 - }],
256 -
257 - // `transformResponse` allows changes to the response data to be made before
258 - // it is passed to then/catch
259 - transformResponse: [function (data) {
260 - // Do whatever you want to transform the data
261 -
262 - return data;
263 - }],
264 -
265 - // `headers` are custom headers to be sent
266 - headers: {'X-Requested-With': 'XMLHttpRequest'},
267 -
268 - // `params` are the URL parameters to be sent with the request
269 - // Must be a plain object or a URLSearchParams object
270 - params: {
271 - ID: 12345
272 - },
273 -
274 - // `paramsSerializer` is an optional function in charge of serializing `params`
275 - // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
276 - paramsSerializer: function (params) {
277 - return Qs.stringify(params, {arrayFormat: 'brackets'})
278 - },
279 -
280 - // `data` is the data to be sent as the request body
281 - // Only applicable for request methods 'PUT', 'POST', and 'PATCH'
282 - // When no `transformRequest` is set, must be of one of the following types:
283 - // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
284 - // - Browser only: FormData, File, Blob
285 - // - Node only: Stream, Buffer
286 - data: {
287 - firstName: 'Fred'
288 - },
289 -
290 - // `timeout` specifies the number of milliseconds before the request times out.
291 - // If the request takes longer than `timeout`, the request will be aborted.
292 - timeout: 1000, // default is `0` (no timeout)
293 -
294 - // `withCredentials` indicates whether or not cross-site Access-Control requests
295 - // should be made using credentials
296 - withCredentials: false, // default
297 -
298 - // `adapter` allows custom handling of requests which makes testing easier.
299 - // Return a promise and supply a valid response (see lib/adapters/README.md).
300 - adapter: function (config) {
301 - /* ... */
302 - },
303 -
304 - // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
305 - // This will set an `Authorization` header, overwriting any existing
306 - // `Authorization` custom headers you have set using `headers`.
307 - // Please note that only HTTP Basic auth is configurable through this parameter.
308 - // For Bearer tokens and such, use `Authorization` custom headers instead.
309 - auth: {
310 - username: 'janedoe',
311 - password: 's00pers3cret'
312 - },
313 -
314 - // `responseType` indicates the type of data that the server will respond with
315 - // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
316 - // browser only: 'blob'
317 - responseType: 'json', // default
318 -
319 - // `responseEncoding` indicates encoding to use for decoding responses
320 - // Note: Ignored for `responseType` of 'stream' or client-side requests
321 - responseEncoding: 'utf8', // default
322 -
323 - // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
324 - xsrfCookieName: 'XSRF-TOKEN', // default
325 -
326 - // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
327 - xsrfHeaderName: 'X-XSRF-TOKEN', // default
328 -
329 - // `onUploadProgress` allows handling of progress events for uploads
330 - onUploadProgress: function (progressEvent) {
331 - // Do whatever you want with the native progress event
332 - },
333 -
334 - // `onDownloadProgress` allows handling of progress events for downloads
335 - onDownloadProgress: function (progressEvent) {
336 - // Do whatever you want with the native progress event
337 - },
338 -
339 - // `maxContentLength` defines the max size of the http response content in bytes allowed
340 - maxContentLength: 2000,
341 -
342 - // `validateStatus` defines whether to resolve or reject the promise for a given
343 - // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
344 - // or `undefined`), the promise will be resolved; otherwise, the promise will be
345 - // rejected.
346 - validateStatus: function (status) {
347 - return status >= 200 && status < 300; // default
348 - },
349 -
350 - // `maxRedirects` defines the maximum number of redirects to follow in node.js.
351 - // If set to 0, no redirects will be followed.
352 - maxRedirects: 5, // default
353 -
354 - // `socketPath` defines a UNIX Socket to be used in node.js.
355 - // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
356 - // Only either `socketPath` or `proxy` can be specified.
357 - // If both are specified, `socketPath` is used.
358 - socketPath: null, // default
359 -
360 - // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
361 - // and https requests, respectively, in node.js. This allows options to be added like
362 - // `keepAlive` that are not enabled by default.
363 - httpAgent: new http.Agent({ keepAlive: true }),
364 - httpsAgent: new https.Agent({ keepAlive: true }),
365 -
366 - // 'proxy' defines the hostname and port of the proxy server.
367 - // You can also define your proxy using the conventional `http_proxy` and
368 - // `https_proxy` environment variables. If you are using environment variables
369 - // for your proxy configuration, you can also define a `no_proxy` environment
370 - // variable as a comma-separated list of domains that should not be proxied.
371 - // Use `false` to disable proxies, ignoring environment variables.
372 - // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
373 - // supplies credentials.
374 - // This will set an `Proxy-Authorization` header, overwriting any existing
375 - // `Proxy-Authorization` custom headers you have set using `headers`.
376 - proxy: {
377 - host: '127.0.0.1',
378 - port: 9000,
379 - auth: {
380 - username: 'mikeymike',
381 - password: 'rapunz3l'
382 - }
383 - },
384 -
385 - // `cancelToken` specifies a cancel token that can be used to cancel the request
386 - // (see Cancellation section below for details)
387 - cancelToken: new CancelToken(function (cancel) {
388 - })
389 -}
390 -```
391 -
392 -## Response Schema
393 -
394 -The response for a request contains the following information.
395 -
396 -```js
397 -{
398 - // `data` is the response that was provided by the server
399 - data: {},
400 -
401 - // `status` is the HTTP status code from the server response
402 - status: 200,
403 -
404 - // `statusText` is the HTTP status message from the server response
405 - statusText: 'OK',
406 -
407 - // `headers` the headers that the server responded with
408 - // All header names are lower cased
409 - headers: {},
410 -
411 - // `config` is the config that was provided to `axios` for the request
412 - config: {},
413 -
414 - // `request` is the request that generated this response
415 - // It is the last ClientRequest instance in node.js (in redirects)
416 - // and an XMLHttpRequest instance the browser
417 - request: {}
418 -}
419 -```
420 -
421 -When using `then`, you will receive the response as follows:
422 -
423 -```js
424 -axios.get('/user/12345')
425 - .then(function (response) {
426 - console.log(response.data);
427 - console.log(response.status);
428 - console.log(response.statusText);
429 - console.log(response.headers);
430 - console.log(response.config);
431 - });
432 -```
433 -
434 -When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
435 -
436 -## Config Defaults
437 -
438 -You can specify config defaults that will be applied to every request.
439 -
440 -### Global axios defaults
441 -
442 -```js
443 -axios.defaults.baseURL = 'https://api.example.com';
444 -axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
445 -axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
446 -```
447 -
448 -### Custom instance defaults
449 -
450 -```js
451 -// Set config defaults when creating the instance
452 -const instance = axios.create({
453 - baseURL: 'https://api.example.com'
454 -});
455 -
456 -// Alter defaults after instance has been created
457 -instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
458 -```
459 -
460 -### Config order of precedence
461 -
462 -Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
463 -
464 -```js
465 -// Create an instance using the config defaults provided by the library
466 -// At this point the timeout config value is `0` as is the default for the library
467 -const instance = axios.create();
468 -
469 -// Override timeout default for the library
470 -// Now all requests using this instance will wait 2.5 seconds before timing out
471 -instance.defaults.timeout = 2500;
472 -
473 -// Override timeout for this request as it's known to take a long time
474 -instance.get('/longRequest', {
475 - timeout: 5000
476 -});
477 -```
478 -
479 -## Interceptors
480 -
481 -You can intercept requests or responses before they are handled by `then` or `catch`.
482 -
483 -```js
484 -// Add a request interceptor
485 -axios.interceptors.request.use(function (config) {
486 - // Do something before request is sent
487 - return config;
488 - }, function (error) {
489 - // Do something with request error
490 - return Promise.reject(error);
491 - });
492 -
493 -// Add a response interceptor
494 -axios.interceptors.response.use(function (response) {
495 - // Do something with response data
496 - return response;
497 - }, function (error) {
498 - // Do something with response error
499 - return Promise.reject(error);
500 - });
501 -```
502 -
503 -If you may need to remove an interceptor later you can.
504 -
505 -```js
506 -const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
507 -axios.interceptors.request.eject(myInterceptor);
508 -```
509 -
510 -You can add interceptors to a custom instance of axios.
511 -
512 -```js
513 -const instance = axios.create();
514 -instance.interceptors.request.use(function () {/*...*/});
515 -```
516 -
517 -## Handling Errors
518 -
519 -```js
520 -axios.get('/user/12345')
521 - .catch(function (error) {
522 - if (error.response) {
523 - // The request was made and the server responded with a status code
524 - // that falls out of the range of 2xx
525 - console.log(error.response.data);
526 - console.log(error.response.status);
527 - console.log(error.response.headers);
528 - } else if (error.request) {
529 - // The request was made but no response was received
530 - // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
531 - // http.ClientRequest in node.js
532 - console.log(error.request);
533 - } else {
534 - // Something happened in setting up the request that triggered an Error
535 - console.log('Error', error.message);
536 - }
537 - console.log(error.config);
538 - });
539 -```
540 -
541 -You can define a custom HTTP status code error range using the `validateStatus` config option.
542 -
543 -```js
544 -axios.get('/user/12345', {
545 - validateStatus: function (status) {
546 - return status < 500; // Reject only if the status code is greater than or equal to 500
547 - }
548 -})
549 -```
550 -
551 -## Cancellation
552 -
553 -You can cancel a request using a *cancel token*.
554 -
555 -> The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
556 -
557 -You can create a cancel token using the `CancelToken.source` factory as shown below:
558 -
559 -```js
560 -const CancelToken = axios.CancelToken;
561 -const source = CancelToken.source();
562 -
563 -axios.get('/user/12345', {
564 - cancelToken: source.token
565 -}).catch(function (thrown) {
566 - if (axios.isCancel(thrown)) {
567 - console.log('Request canceled', thrown.message);
568 - } else {
569 - // handle error
570 - }
571 -});
572 -
573 -axios.post('/user/12345', {
574 - name: 'new name'
575 -}, {
576 - cancelToken: source.token
577 -})
578 -
579 -// cancel the request (the message parameter is optional)
580 -source.cancel('Operation canceled by the user.');
581 -```
582 -
583 -You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
584 -
585 -```js
586 -const CancelToken = axios.CancelToken;
587 -let cancel;
588 -
589 -axios.get('/user/12345', {
590 - cancelToken: new CancelToken(function executor(c) {
591 - // An executor function receives a cancel function as a parameter
592 - cancel = c;
593 - })
594 -});
595 -
596 -// cancel the request
597 -cancel();
598 -```
599 -
600 -> Note: you can cancel several requests with the same cancel token.
601 -
602 -## Using application/x-www-form-urlencoded format
603 -
604 -By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
605 -
606 -### Browser
607 -
608 -In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
609 -
610 -```js
611 -const params = new URLSearchParams();
612 -params.append('param1', 'value1');
613 -params.append('param2', 'value2');
614 -axios.post('/foo', params);
615 -```
616 -
617 -> Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
618 -
619 -Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
620 -
621 -```js
622 -const qs = require('qs');
623 -axios.post('/foo', qs.stringify({ 'bar': 123 }));
624 -```
625 -
626 -Or in another way (ES6),
627 -
628 -```js
629 -import qs from 'qs';
630 -const data = { 'bar': 123 };
631 -const options = {
632 - method: 'POST',
633 - headers: { 'content-type': 'application/x-www-form-urlencoded' },
634 - data: qs.stringify(data),
635 - url,
636 -};
637 -axios(options);
638 -```
639 -
640 -### Node.js
641 -
642 -In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
643 -
644 -```js
645 -const querystring = require('querystring');
646 -axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
647 -```
648 -
649 -You can also use the [`qs`](https://github.com/ljharb/qs) library.
650 -
651 -###### NOTE
652 -The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has known issues with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665).
653 -
654 -## Semver
655 -
656 -Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
657 -
658 -## Promises
659 -
660 -axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
661 -If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
662 -
663 -## TypeScript
664 -axios includes [TypeScript](http://typescriptlang.org) definitions.
665 -```typescript
666 -import axios from 'axios';
667 -axios.get('/user?ID=12345');
668 -```
669 -
670 -## Resources
671 -
672 -* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
673 -* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
674 -* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
675 -* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
676 -* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
677 -
678 -## Credits
679 -
680 -axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [Angular](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of Angular.
681 -
682 -## License
683 -
684 -MIT
1 -# Upgrade Guide
2 -
3 -### 0.15.x -> 0.16.0
4 -
5 -#### `Promise` Type Declarations
6 -
7 -The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
8 -
9 -### 0.13.x -> 0.14.0
10 -
11 -#### TypeScript Definitions
12 -
13 -The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
14 -
15 -Please use the following `import` statement to import axios in TypeScript:
16 -
17 -```typescript
18 -import axios from 'axios';
19 -
20 -axios.get('/foo')
21 - .then(response => console.log(response))
22 - .catch(error => console.log(error));
23 -```
24 -
25 -#### `agent` Config Option
26 -
27 -The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
28 -
29 -```js
30 -{
31 - // Define a custom agent for HTTP
32 - httpAgent: new http.Agent({ keepAlive: true }),
33 - // Define a custom agent for HTTPS
34 - httpsAgent: new https.Agent({ keepAlive: true })
35 -}
36 -```
37 -
38 -#### `progress` Config Option
39 -
40 -The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
41 -
42 -```js
43 -{
44 - // Define a handler for upload progress events
45 - onUploadProgress: function (progressEvent) {
46 - // ...
47 - },
48 -
49 - // Define a handler for download progress events
50 - onDownloadProgress: function (progressEvent) {
51 - // ...
52 - }
53 -}
54 -```
55 -
56 -### 0.12.x -> 0.13.0
57 -
58 -The `0.13.0` release contains several changes to custom adapters and error handling.
59 -
60 -#### Error Handling
61 -
62 -Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.
63 -
64 -```js
65 -axios.get('/user/12345')
66 - .catch((error) => {
67 - console.log(error.message);
68 - console.log(error.code); // Not always specified
69 - console.log(error.config); // The config that was used to make the request
70 - console.log(error.response); // Only available if response was received from the server
71 - });
72 -```
73 -
74 -#### Request Adapters
75 -
76 -This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
77 -
78 -1. Response transformer is now called outside of adapter.
79 -2. Request adapter returns a `Promise`.
80 -
81 -This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter.
82 -
83 -Previous code:
84 -
85 -```js
86 -function myAdapter(resolve, reject, config) {
87 - var response = {
88 - data: transformData(
89 - responseData,
90 - responseHeaders,
91 - config.transformResponse
92 - ),
93 - status: request.status,
94 - statusText: request.statusText,
95 - headers: responseHeaders
96 - };
97 - settle(resolve, reject, response);
98 -}
99 -```
100 -
101 -New code:
102 -
103 -```js
104 -function myAdapter(config) {
105 - return new Promise(function (resolve, reject) {
106 - var response = {
107 - data: responseData,
108 - status: request.status,
109 - statusText: request.statusText,
110 - headers: responseHeaders
111 - };
112 - settle(resolve, reject, response);
113 - });
114 -}
115 -```
116 -
117 -See the related commits for more details:
118 -- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
119 -- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
120 -
121 -### 0.5.x -> 0.6.0
122 -
123 -The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
124 -
125 -#### ES6 Promise Polyfill
126 -
127 -Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.
128 -
129 -```js
130 -require('es6-promise').polyfill();
131 -var axios = require('axios');
132 -```
133 -
134 -This will polyfill the global environment, and only needs to be done once.
135 -
136 -#### `axios.success`/`axios.error`
137 -
138 -The `success`, and `error` aliases were deprectated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
139 -
140 -```js
141 -axios.get('some/url')
142 - .then(function (res) {
143 - /* ... */
144 - })
145 - .catch(function (err) {
146 - /* ... */
147 - });
148 -```
149 -
150 -#### UMD
151 -
152 -Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
153 -
154 -```js
155 -// AMD
156 -require(['bower_components/axios/dist/axios'], function (axios) {
157 - /* ... */
158 -});
159 -
160 -// CommonJS
161 -var axios = require('axios/dist/axios');
162 -```
1 -/* axios v0.19.0 | (c) 2019 by Matt Zabriskie */
2 -(function webpackUniversalModuleDefinition(root, factory) {
3 - if(typeof exports === 'object' && typeof module === 'object')
4 - module.exports = factory();
5 - else if(typeof define === 'function' && define.amd)
6 - define([], factory);
7 - else if(typeof exports === 'object')
8 - exports["axios"] = factory();
9 - else
10 - root["axios"] = factory();
11 -})(this, function() {
12 -return /******/ (function(modules) { // webpackBootstrap
13 -/******/ // The module cache
14 -/******/ var installedModules = {};
15 -/******/
16 -/******/ // The require function
17 -/******/ function __webpack_require__(moduleId) {
18 -/******/
19 -/******/ // Check if module is in cache
20 -/******/ if(installedModules[moduleId])
21 -/******/ return installedModules[moduleId].exports;
22 -/******/
23 -/******/ // Create a new module (and put it into the cache)
24 -/******/ var module = installedModules[moduleId] = {
25 -/******/ exports: {},
26 -/******/ id: moduleId,
27 -/******/ loaded: false
28 -/******/ };
29 -/******/
30 -/******/ // Execute the module function
31 -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32 -/******/
33 -/******/ // Flag the module as loaded
34 -/******/ module.loaded = true;
35 -/******/
36 -/******/ // Return the exports of the module
37 -/******/ return module.exports;
38 -/******/ }
39 -/******/
40 -/******/
41 -/******/ // expose the modules object (__webpack_modules__)
42 -/******/ __webpack_require__.m = modules;
43 -/******/
44 -/******/ // expose the module cache
45 -/******/ __webpack_require__.c = installedModules;
46 -/******/
47 -/******/ // __webpack_public_path__
48 -/******/ __webpack_require__.p = "";
49 -/******/
50 -/******/ // Load entry module and return exports
51 -/******/ return __webpack_require__(0);
52 -/******/ })
53 -/************************************************************************/
54 -/******/ ([
55 -/* 0 */
56 -/***/ (function(module, exports, __webpack_require__) {
57 -
58 - module.exports = __webpack_require__(1);
59 -
60 -/***/ }),
61 -/* 1 */
62 -/***/ (function(module, exports, __webpack_require__) {
63 -
64 - 'use strict';
65 -
66 - var utils = __webpack_require__(2);
67 - var bind = __webpack_require__(3);
68 - var Axios = __webpack_require__(5);
69 - var mergeConfig = __webpack_require__(22);
70 - var defaults = __webpack_require__(11);
71 -
72 - /**
73 - * Create an instance of Axios
74 - *
75 - * @param {Object} defaultConfig The default config for the instance
76 - * @return {Axios} A new instance of Axios
77 - */
78 - function createInstance(defaultConfig) {
79 - var context = new Axios(defaultConfig);
80 - var instance = bind(Axios.prototype.request, context);
81 -
82 - // Copy axios.prototype to instance
83 - utils.extend(instance, Axios.prototype, context);
84 -
85 - // Copy context to instance
86 - utils.extend(instance, context);
87 -
88 - return instance;
89 - }
90 -
91 - // Create the default instance to be exported
92 - var axios = createInstance(defaults);
93 -
94 - // Expose Axios class to allow class inheritance
95 - axios.Axios = Axios;
96 -
97 - // Factory for creating new instances
98 - axios.create = function create(instanceConfig) {
99 - return createInstance(mergeConfig(axios.defaults, instanceConfig));
100 - };
101 -
102 - // Expose Cancel & CancelToken
103 - axios.Cancel = __webpack_require__(23);
104 - axios.CancelToken = __webpack_require__(24);
105 - axios.isCancel = __webpack_require__(10);
106 -
107 - // Expose all/spread
108 - axios.all = function all(promises) {
109 - return Promise.all(promises);
110 - };
111 - axios.spread = __webpack_require__(25);
112 -
113 - module.exports = axios;
114 -
115 - // Allow use of default import syntax in TypeScript
116 - module.exports.default = axios;
117 -
118 -
119 -/***/ }),
120 -/* 2 */
121 -/***/ (function(module, exports, __webpack_require__) {
122 -
123 - 'use strict';
124 -
125 - var bind = __webpack_require__(3);
126 - var isBuffer = __webpack_require__(4);
127 -
128 - /*global toString:true*/
129 -
130 - // utils is a library of generic helper functions non-specific to axios
131 -
132 - var toString = Object.prototype.toString;
133 -
134 - /**
135 - * Determine if a value is an Array
136 - *
137 - * @param {Object} val The value to test
138 - * @returns {boolean} True if value is an Array, otherwise false
139 - */
140 - function isArray(val) {
141 - return toString.call(val) === '[object Array]';
142 - }
143 -
144 - /**
145 - * Determine if a value is an ArrayBuffer
146 - *
147 - * @param {Object} val The value to test
148 - * @returns {boolean} True if value is an ArrayBuffer, otherwise false
149 - */
150 - function isArrayBuffer(val) {
151 - return toString.call(val) === '[object ArrayBuffer]';
152 - }
153 -
154 - /**
155 - * Determine if a value is a FormData
156 - *
157 - * @param {Object} val The value to test
158 - * @returns {boolean} True if value is an FormData, otherwise false
159 - */
160 - function isFormData(val) {
161 - return (typeof FormData !== 'undefined') && (val instanceof FormData);
162 - }
163 -
164 - /**
165 - * Determine if a value is a view on an ArrayBuffer
166 - *
167 - * @param {Object} val The value to test
168 - * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
169 - */
170 - function isArrayBufferView(val) {
171 - var result;
172 - if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
173 - result = ArrayBuffer.isView(val);
174 - } else {
175 - result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
176 - }
177 - return result;
178 - }
179 -
180 - /**
181 - * Determine if a value is a String
182 - *
183 - * @param {Object} val The value to test
184 - * @returns {boolean} True if value is a String, otherwise false
185 - */
186 - function isString(val) {
187 - return typeof val === 'string';
188 - }
189 -
190 - /**
191 - * Determine if a value is a Number
192 - *
193 - * @param {Object} val The value to test
194 - * @returns {boolean} True if value is a Number, otherwise false
195 - */
196 - function isNumber(val) {
197 - return typeof val === 'number';
198 - }
199 -
200 - /**
201 - * Determine if a value is undefined
202 - *
203 - * @param {Object} val The value to test
204 - * @returns {boolean} True if the value is undefined, otherwise false
205 - */
206 - function isUndefined(val) {
207 - return typeof val === 'undefined';
208 - }
209 -
210 - /**
211 - * Determine if a value is an Object
212 - *
213 - * @param {Object} val The value to test
214 - * @returns {boolean} True if value is an Object, otherwise false
215 - */
216 - function isObject(val) {
217 - return val !== null && typeof val === 'object';
218 - }
219 -
220 - /**
221 - * Determine if a value is a Date
222 - *
223 - * @param {Object} val The value to test
224 - * @returns {boolean} True if value is a Date, otherwise false
225 - */
226 - function isDate(val) {
227 - return toString.call(val) === '[object Date]';
228 - }
229 -
230 - /**
231 - * Determine if a value is a File
232 - *
233 - * @param {Object} val The value to test
234 - * @returns {boolean} True if value is a File, otherwise false
235 - */
236 - function isFile(val) {
237 - return toString.call(val) === '[object File]';
238 - }
239 -
240 - /**
241 - * Determine if a value is a Blob
242 - *
243 - * @param {Object} val The value to test
244 - * @returns {boolean} True if value is a Blob, otherwise false
245 - */
246 - function isBlob(val) {
247 - return toString.call(val) === '[object Blob]';
248 - }
249 -
250 - /**
251 - * Determine if a value is a Function
252 - *
253 - * @param {Object} val The value to test
254 - * @returns {boolean} True if value is a Function, otherwise false
255 - */
256 - function isFunction(val) {
257 - return toString.call(val) === '[object Function]';
258 - }
259 -
260 - /**
261 - * Determine if a value is a Stream
262 - *
263 - * @param {Object} val The value to test
264 - * @returns {boolean} True if value is a Stream, otherwise false
265 - */
266 - function isStream(val) {
267 - return isObject(val) && isFunction(val.pipe);
268 - }
269 -
270 - /**
271 - * Determine if a value is a URLSearchParams object
272 - *
273 - * @param {Object} val The value to test
274 - * @returns {boolean} True if value is a URLSearchParams object, otherwise false
275 - */
276 - function isURLSearchParams(val) {
277 - return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
278 - }
279 -
280 - /**
281 - * Trim excess whitespace off the beginning and end of a string
282 - *
283 - * @param {String} str The String to trim
284 - * @returns {String} The String freed of excess whitespace
285 - */
286 - function trim(str) {
287 - return str.replace(/^\s*/, '').replace(/\s*$/, '');
288 - }
289 -
290 - /**
291 - * Determine if we're running in a standard browser environment
292 - *
293 - * This allows axios to run in a web worker, and react-native.
294 - * Both environments support XMLHttpRequest, but not fully standard globals.
295 - *
296 - * web workers:
297 - * typeof window -> undefined
298 - * typeof document -> undefined
299 - *
300 - * react-native:
301 - * navigator.product -> 'ReactNative'
302 - * nativescript
303 - * navigator.product -> 'NativeScript' or 'NS'
304 - */
305 - function isStandardBrowserEnv() {
306 - if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
307 - navigator.product === 'NativeScript' ||
308 - navigator.product === 'NS')) {
309 - return false;
310 - }
311 - return (
312 - typeof window !== 'undefined' &&
313 - typeof document !== 'undefined'
314 - );
315 - }
316 -
317 - /**
318 - * Iterate over an Array or an Object invoking a function for each item.
319 - *
320 - * If `obj` is an Array callback will be called passing
321 - * the value, index, and complete array for each item.
322 - *
323 - * If 'obj' is an Object callback will be called passing
324 - * the value, key, and complete object for each property.
325 - *
326 - * @param {Object|Array} obj The object to iterate
327 - * @param {Function} fn The callback to invoke for each item
328 - */
329 - function forEach(obj, fn) {
330 - // Don't bother if no value provided
331 - if (obj === null || typeof obj === 'undefined') {
332 - return;
333 - }
334 -
335 - // Force an array if not already something iterable
336 - if (typeof obj !== 'object') {
337 - /*eslint no-param-reassign:0*/
338 - obj = [obj];
339 - }
340 -
341 - if (isArray(obj)) {
342 - // Iterate over array values
343 - for (var i = 0, l = obj.length; i < l; i++) {
344 - fn.call(null, obj[i], i, obj);
345 - }
346 - } else {
347 - // Iterate over object keys
348 - for (var key in obj) {
349 - if (Object.prototype.hasOwnProperty.call(obj, key)) {
350 - fn.call(null, obj[key], key, obj);
351 - }
352 - }
353 - }
354 - }
355 -
356 - /**
357 - * Accepts varargs expecting each argument to be an object, then
358 - * immutably merges the properties of each object and returns result.
359 - *
360 - * When multiple objects contain the same key the later object in
361 - * the arguments list will take precedence.
362 - *
363 - * Example:
364 - *
365 - * ```js
366 - * var result = merge({foo: 123}, {foo: 456});
367 - * console.log(result.foo); // outputs 456
368 - * ```
369 - *
370 - * @param {Object} obj1 Object to merge
371 - * @returns {Object} Result of all merge properties
372 - */
373 - function merge(/* obj1, obj2, obj3, ... */) {
374 - var result = {};
375 - function assignValue(val, key) {
376 - if (typeof result[key] === 'object' && typeof val === 'object') {
377 - result[key] = merge(result[key], val);
378 - } else {
379 - result[key] = val;
380 - }
381 - }
382 -
383 - for (var i = 0, l = arguments.length; i < l; i++) {
384 - forEach(arguments[i], assignValue);
385 - }
386 - return result;
387 - }
388 -
389 - /**
390 - * Function equal to merge with the difference being that no reference
391 - * to original objects is kept.
392 - *
393 - * @see merge
394 - * @param {Object} obj1 Object to merge
395 - * @returns {Object} Result of all merge properties
396 - */
397 - function deepMerge(/* obj1, obj2, obj3, ... */) {
398 - var result = {};
399 - function assignValue(val, key) {
400 - if (typeof result[key] === 'object' && typeof val === 'object') {
401 - result[key] = deepMerge(result[key], val);
402 - } else if (typeof val === 'object') {
403 - result[key] = deepMerge({}, val);
404 - } else {
405 - result[key] = val;
406 - }
407 - }
408 -
409 - for (var i = 0, l = arguments.length; i < l; i++) {
410 - forEach(arguments[i], assignValue);
411 - }
412 - return result;
413 - }
414 -
415 - /**
416 - * Extends object a by mutably adding to it the properties of object b.
417 - *
418 - * @param {Object} a The object to be extended
419 - * @param {Object} b The object to copy properties from
420 - * @param {Object} thisArg The object to bind function to
421 - * @return {Object} The resulting value of object a
422 - */
423 - function extend(a, b, thisArg) {
424 - forEach(b, function assignValue(val, key) {
425 - if (thisArg && typeof val === 'function') {
426 - a[key] = bind(val, thisArg);
427 - } else {
428 - a[key] = val;
429 - }
430 - });
431 - return a;
432 - }
433 -
434 - module.exports = {
435 - isArray: isArray,
436 - isArrayBuffer: isArrayBuffer,
437 - isBuffer: isBuffer,
438 - isFormData: isFormData,
439 - isArrayBufferView: isArrayBufferView,
440 - isString: isString,
441 - isNumber: isNumber,
442 - isObject: isObject,
443 - isUndefined: isUndefined,
444 - isDate: isDate,
445 - isFile: isFile,
446 - isBlob: isBlob,
447 - isFunction: isFunction,
448 - isStream: isStream,
449 - isURLSearchParams: isURLSearchParams,
450 - isStandardBrowserEnv: isStandardBrowserEnv,
451 - forEach: forEach,
452 - merge: merge,
453 - deepMerge: deepMerge,
454 - extend: extend,
455 - trim: trim
456 - };
457 -
458 -
459 -/***/ }),
460 -/* 3 */
461 -/***/ (function(module, exports) {
462 -
463 - 'use strict';
464 -
465 - module.exports = function bind(fn, thisArg) {
466 - return function wrap() {
467 - var args = new Array(arguments.length);
468 - for (var i = 0; i < args.length; i++) {
469 - args[i] = arguments[i];
470 - }
471 - return fn.apply(thisArg, args);
472 - };
473 - };
474 -
475 -
476 -/***/ }),
477 -/* 4 */
478 -/***/ (function(module, exports) {
479 -
480 - /*!
481 - * Determine if an object is a Buffer
482 - *
483 - * @author Feross Aboukhadijeh <https://feross.org>
484 - * @license MIT
485 - */
486 -
487 - module.exports = function isBuffer (obj) {
488 - return obj != null && obj.constructor != null &&
489 - typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
490 - }
491 -
492 -
493 -/***/ }),
494 -/* 5 */
495 -/***/ (function(module, exports, __webpack_require__) {
496 -
497 - 'use strict';
498 -
499 - var utils = __webpack_require__(2);
500 - var buildURL = __webpack_require__(6);
501 - var InterceptorManager = __webpack_require__(7);
502 - var dispatchRequest = __webpack_require__(8);
503 - var mergeConfig = __webpack_require__(22);
504 -
505 - /**
506 - * Create a new instance of Axios
507 - *
508 - * @param {Object} instanceConfig The default config for the instance
509 - */
510 - function Axios(instanceConfig) {
511 - this.defaults = instanceConfig;
512 - this.interceptors = {
513 - request: new InterceptorManager(),
514 - response: new InterceptorManager()
515 - };
516 - }
517 -
518 - /**
519 - * Dispatch a request
520 - *
521 - * @param {Object} config The config specific for this request (merged with this.defaults)
522 - */
523 - Axios.prototype.request = function request(config) {
524 - /*eslint no-param-reassign:0*/
525 - // Allow for axios('example/url'[, config]) a la fetch API
526 - if (typeof config === 'string') {
527 - config = arguments[1] || {};
528 - config.url = arguments[0];
529 - } else {
530 - config = config || {};
531 - }
532 -
533 - config = mergeConfig(this.defaults, config);
534 - config.method = config.method ? config.method.toLowerCase() : 'get';
535 -
536 - // Hook up interceptors middleware
537 - var chain = [dispatchRequest, undefined];
538 - var promise = Promise.resolve(config);
539 -
540 - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
541 - chain.unshift(interceptor.fulfilled, interceptor.rejected);
542 - });
543 -
544 - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
545 - chain.push(interceptor.fulfilled, interceptor.rejected);
546 - });
547 -
548 - while (chain.length) {
549 - promise = promise.then(chain.shift(), chain.shift());
550 - }
551 -
552 - return promise;
553 - };
554 -
555 - Axios.prototype.getUri = function getUri(config) {
556 - config = mergeConfig(this.defaults, config);
557 - return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
558 - };
559 -
560 - // Provide aliases for supported request methods
561 - utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
562 - /*eslint func-names:0*/
563 - Axios.prototype[method] = function(url, config) {
564 - return this.request(utils.merge(config || {}, {
565 - method: method,
566 - url: url
567 - }));
568 - };
569 - });
570 -
571 - utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
572 - /*eslint func-names:0*/
573 - Axios.prototype[method] = function(url, data, config) {
574 - return this.request(utils.merge(config || {}, {
575 - method: method,
576 - url: url,
577 - data: data
578 - }));
579 - };
580 - });
581 -
582 - module.exports = Axios;
583 -
584 -
585 -/***/ }),
586 -/* 6 */
587 -/***/ (function(module, exports, __webpack_require__) {
588 -
589 - 'use strict';
590 -
591 - var utils = __webpack_require__(2);
592 -
593 - function encode(val) {
594 - return encodeURIComponent(val).
595 - replace(/%40/gi, '@').
596 - replace(/%3A/gi, ':').
597 - replace(/%24/g, '$').
598 - replace(/%2C/gi, ',').
599 - replace(/%20/g, '+').
600 - replace(/%5B/gi, '[').
601 - replace(/%5D/gi, ']');
602 - }
603 -
604 - /**
605 - * Build a URL by appending params to the end
606 - *
607 - * @param {string} url The base of the url (e.g., http://www.google.com)
608 - * @param {object} [params] The params to be appended
609 - * @returns {string} The formatted url
610 - */
611 - module.exports = function buildURL(url, params, paramsSerializer) {
612 - /*eslint no-param-reassign:0*/
613 - if (!params) {
614 - return url;
615 - }
616 -
617 - var serializedParams;
618 - if (paramsSerializer) {
619 - serializedParams = paramsSerializer(params);
620 - } else if (utils.isURLSearchParams(params)) {
621 - serializedParams = params.toString();
622 - } else {
623 - var parts = [];
624 -
625 - utils.forEach(params, function serialize(val, key) {
626 - if (val === null || typeof val === 'undefined') {
627 - return;
628 - }
629 -
630 - if (utils.isArray(val)) {
631 - key = key + '[]';
632 - } else {
633 - val = [val];
634 - }
635 -
636 - utils.forEach(val, function parseValue(v) {
637 - if (utils.isDate(v)) {
638 - v = v.toISOString();
639 - } else if (utils.isObject(v)) {
640 - v = JSON.stringify(v);
641 - }
642 - parts.push(encode(key) + '=' + encode(v));
643 - });
644 - });
645 -
646 - serializedParams = parts.join('&');
647 - }
648 -
649 - if (serializedParams) {
650 - var hashmarkIndex = url.indexOf('#');
651 - if (hashmarkIndex !== -1) {
652 - url = url.slice(0, hashmarkIndex);
653 - }
654 -
655 - url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
656 - }
657 -
658 - return url;
659 - };
660 -
661 -
662 -/***/ }),
663 -/* 7 */
664 -/***/ (function(module, exports, __webpack_require__) {
665 -
666 - 'use strict';
667 -
668 - var utils = __webpack_require__(2);
669 -
670 - function InterceptorManager() {
671 - this.handlers = [];
672 - }
673 -
674 - /**
675 - * Add a new interceptor to the stack
676 - *
677 - * @param {Function} fulfilled The function to handle `then` for a `Promise`
678 - * @param {Function} rejected The function to handle `reject` for a `Promise`
679 - *
680 - * @return {Number} An ID used to remove interceptor later
681 - */
682 - InterceptorManager.prototype.use = function use(fulfilled, rejected) {
683 - this.handlers.push({
684 - fulfilled: fulfilled,
685 - rejected: rejected
686 - });
687 - return this.handlers.length - 1;
688 - };
689 -
690 - /**
691 - * Remove an interceptor from the stack
692 - *
693 - * @param {Number} id The ID that was returned by `use`
694 - */
695 - InterceptorManager.prototype.eject = function eject(id) {
696 - if (this.handlers[id]) {
697 - this.handlers[id] = null;
698 - }
699 - };
700 -
701 - /**
702 - * Iterate over all the registered interceptors
703 - *
704 - * This method is particularly useful for skipping over any
705 - * interceptors that may have become `null` calling `eject`.
706 - *
707 - * @param {Function} fn The function to call for each interceptor
708 - */
709 - InterceptorManager.prototype.forEach = function forEach(fn) {
710 - utils.forEach(this.handlers, function forEachHandler(h) {
711 - if (h !== null) {
712 - fn(h);
713 - }
714 - });
715 - };
716 -
717 - module.exports = InterceptorManager;
718 -
719 -
720 -/***/ }),
721 -/* 8 */
722 -/***/ (function(module, exports, __webpack_require__) {
723 -
724 - 'use strict';
725 -
726 - var utils = __webpack_require__(2);
727 - var transformData = __webpack_require__(9);
728 - var isCancel = __webpack_require__(10);
729 - var defaults = __webpack_require__(11);
730 - var isAbsoluteURL = __webpack_require__(20);
731 - var combineURLs = __webpack_require__(21);
732 -
733 - /**
734 - * Throws a `Cancel` if cancellation has been requested.
735 - */
736 - function throwIfCancellationRequested(config) {
737 - if (config.cancelToken) {
738 - config.cancelToken.throwIfRequested();
739 - }
740 - }
741 -
742 - /**
743 - * Dispatch a request to the server using the configured adapter.
744 - *
745 - * @param {object} config The config that is to be used for the request
746 - * @returns {Promise} The Promise to be fulfilled
747 - */
748 - module.exports = function dispatchRequest(config) {
749 - throwIfCancellationRequested(config);
750 -
751 - // Support baseURL config
752 - if (config.baseURL && !isAbsoluteURL(config.url)) {
753 - config.url = combineURLs(config.baseURL, config.url);
754 - }
755 -
756 - // Ensure headers exist
757 - config.headers = config.headers || {};
758 -
759 - // Transform request data
760 - config.data = transformData(
761 - config.data,
762 - config.headers,
763 - config.transformRequest
764 - );
765 -
766 - // Flatten headers
767 - config.headers = utils.merge(
768 - config.headers.common || {},
769 - config.headers[config.method] || {},
770 - config.headers || {}
771 - );
772 -
773 - utils.forEach(
774 - ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
775 - function cleanHeaderConfig(method) {
776 - delete config.headers[method];
777 - }
778 - );
779 -
780 - var adapter = config.adapter || defaults.adapter;
781 -
782 - return adapter(config).then(function onAdapterResolution(response) {
783 - throwIfCancellationRequested(config);
784 -
785 - // Transform response data
786 - response.data = transformData(
787 - response.data,
788 - response.headers,
789 - config.transformResponse
790 - );
791 -
792 - return response;
793 - }, function onAdapterRejection(reason) {
794 - if (!isCancel(reason)) {
795 - throwIfCancellationRequested(config);
796 -
797 - // Transform response data
798 - if (reason && reason.response) {
799 - reason.response.data = transformData(
800 - reason.response.data,
801 - reason.response.headers,
802 - config.transformResponse
803 - );
804 - }
805 - }
806 -
807 - return Promise.reject(reason);
808 - });
809 - };
810 -
811 -
812 -/***/ }),
813 -/* 9 */
814 -/***/ (function(module, exports, __webpack_require__) {
815 -
816 - 'use strict';
817 -
818 - var utils = __webpack_require__(2);
819 -
820 - /**
821 - * Transform the data for a request or a response
822 - *
823 - * @param {Object|String} data The data to be transformed
824 - * @param {Array} headers The headers for the request or response
825 - * @param {Array|Function} fns A single function or Array of functions
826 - * @returns {*} The resulting transformed data
827 - */
828 - module.exports = function transformData(data, headers, fns) {
829 - /*eslint no-param-reassign:0*/
830 - utils.forEach(fns, function transform(fn) {
831 - data = fn(data, headers);
832 - });
833 -
834 - return data;
835 - };
836 -
837 -
838 -/***/ }),
839 -/* 10 */
840 -/***/ (function(module, exports) {
841 -
842 - 'use strict';
843 -
844 - module.exports = function isCancel(value) {
845 - return !!(value && value.__CANCEL__);
846 - };
847 -
848 -
849 -/***/ }),
850 -/* 11 */
851 -/***/ (function(module, exports, __webpack_require__) {
852 -
853 - 'use strict';
854 -
855 - var utils = __webpack_require__(2);
856 - var normalizeHeaderName = __webpack_require__(12);
857 -
858 - var DEFAULT_CONTENT_TYPE = {
859 - 'Content-Type': 'application/x-www-form-urlencoded'
860 - };
861 -
862 - function setContentTypeIfUnset(headers, value) {
863 - if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
864 - headers['Content-Type'] = value;
865 - }
866 - }
867 -
868 - function getDefaultAdapter() {
869 - var adapter;
870 - // Only Node.JS has a process variable that is of [[Class]] process
871 - if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
872 - // For node use HTTP adapter
873 - adapter = __webpack_require__(13);
874 - } else if (typeof XMLHttpRequest !== 'undefined') {
875 - // For browsers use XHR adapter
876 - adapter = __webpack_require__(13);
877 - }
878 - return adapter;
879 - }
880 -
881 - var defaults = {
882 - adapter: getDefaultAdapter(),
883 -
884 - transformRequest: [function transformRequest(data, headers) {
885 - normalizeHeaderName(headers, 'Accept');
886 - normalizeHeaderName(headers, 'Content-Type');
887 - if (utils.isFormData(data) ||
888 - utils.isArrayBuffer(data) ||
889 - utils.isBuffer(data) ||
890 - utils.isStream(data) ||
891 - utils.isFile(data) ||
892 - utils.isBlob(data)
893 - ) {
894 - return data;
895 - }
896 - if (utils.isArrayBufferView(data)) {
897 - return data.buffer;
898 - }
899 - if (utils.isURLSearchParams(data)) {
900 - setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
901 - return data.toString();
902 - }
903 - if (utils.isObject(data)) {
904 - setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
905 - return JSON.stringify(data);
906 - }
907 - return data;
908 - }],
909 -
910 - transformResponse: [function transformResponse(data) {
911 - /*eslint no-param-reassign:0*/
912 - if (typeof data === 'string') {
913 - try {
914 - data = JSON.parse(data);
915 - } catch (e) { /* Ignore */ }
916 - }
917 - return data;
918 - }],
919 -
920 - /**
921 - * A timeout in milliseconds to abort a request. If set to 0 (default) a
922 - * timeout is not created.
923 - */
924 - timeout: 0,
925 -
926 - xsrfCookieName: 'XSRF-TOKEN',
927 - xsrfHeaderName: 'X-XSRF-TOKEN',
928 -
929 - maxContentLength: -1,
930 -
931 - validateStatus: function validateStatus(status) {
932 - return status >= 200 && status < 300;
933 - }
934 - };
935 -
936 - defaults.headers = {
937 - common: {
938 - 'Accept': 'application/json, text/plain, */*'
939 - }
940 - };
941 -
942 - utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
943 - defaults.headers[method] = {};
944 - });
945 -
946 - utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
947 - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
948 - });
949 -
950 - module.exports = defaults;
951 -
952 -
953 -/***/ }),
954 -/* 12 */
955 -/***/ (function(module, exports, __webpack_require__) {
956 -
957 - 'use strict';
958 -
959 - var utils = __webpack_require__(2);
960 -
961 - module.exports = function normalizeHeaderName(headers, normalizedName) {
962 - utils.forEach(headers, function processHeader(value, name) {
963 - if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
964 - headers[normalizedName] = value;
965 - delete headers[name];
966 - }
967 - });
968 - };
969 -
970 -
971 -/***/ }),
972 -/* 13 */
973 -/***/ (function(module, exports, __webpack_require__) {
974 -
975 - 'use strict';
976 -
977 - var utils = __webpack_require__(2);
978 - var settle = __webpack_require__(14);
979 - var buildURL = __webpack_require__(6);
980 - var parseHeaders = __webpack_require__(17);
981 - var isURLSameOrigin = __webpack_require__(18);
982 - var createError = __webpack_require__(15);
983 -
984 - module.exports = function xhrAdapter(config) {
985 - return new Promise(function dispatchXhrRequest(resolve, reject) {
986 - var requestData = config.data;
987 - var requestHeaders = config.headers;
988 -
989 - if (utils.isFormData(requestData)) {
990 - delete requestHeaders['Content-Type']; // Let the browser set it
991 - }
992 -
993 - var request = new XMLHttpRequest();
994 -
995 - // HTTP basic authentication
996 - if (config.auth) {
997 - var username = config.auth.username || '';
998 - var password = config.auth.password || '';
999 - requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
1000 - }
1001 -
1002 - request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
1003 -
1004 - // Set the request timeout in MS
1005 - request.timeout = config.timeout;
1006 -
1007 - // Listen for ready state
1008 - request.onreadystatechange = function handleLoad() {
1009 - if (!request || request.readyState !== 4) {
1010 - return;
1011 - }
1012 -
1013 - // The request errored out and we didn't get a response, this will be
1014 - // handled by onerror instead
1015 - // With one exception: request that using file: protocol, most browsers
1016 - // will return status as 0 even though it's a successful request
1017 - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
1018 - return;
1019 - }
1020 -
1021 - // Prepare the response
1022 - var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
1023 - var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
1024 - var response = {
1025 - data: responseData,
1026 - status: request.status,
1027 - statusText: request.statusText,
1028 - headers: responseHeaders,
1029 - config: config,
1030 - request: request
1031 - };
1032 -
1033 - settle(resolve, reject, response);
1034 -
1035 - // Clean up request
1036 - request = null;
1037 - };
1038 -
1039 - // Handle browser request cancellation (as opposed to a manual cancellation)
1040 - request.onabort = function handleAbort() {
1041 - if (!request) {
1042 - return;
1043 - }
1044 -
1045 - reject(createError('Request aborted', config, 'ECONNABORTED', request));
1046 -
1047 - // Clean up request
1048 - request = null;
1049 - };
1050 -
1051 - // Handle low level network errors
1052 - request.onerror = function handleError() {
1053 - // Real errors are hidden from us by the browser
1054 - // onerror should only fire if it's a network error
1055 - reject(createError('Network Error', config, null, request));
1056 -
1057 - // Clean up request
1058 - request = null;
1059 - };
1060 -
1061 - // Handle timeout
1062 - request.ontimeout = function handleTimeout() {
1063 - reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
1064 - request));
1065 -
1066 - // Clean up request
1067 - request = null;
1068 - };
1069 -
1070 - // Add xsrf header
1071 - // This is only done if running in a standard browser environment.
1072 - // Specifically not if we're in a web worker, or react-native.
1073 - if (utils.isStandardBrowserEnv()) {
1074 - var cookies = __webpack_require__(19);
1075 -
1076 - // Add xsrf header
1077 - var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
1078 - cookies.read(config.xsrfCookieName) :
1079 - undefined;
1080 -
1081 - if (xsrfValue) {
1082 - requestHeaders[config.xsrfHeaderName] = xsrfValue;
1083 - }
1084 - }
1085 -
1086 - // Add headers to the request
1087 - if ('setRequestHeader' in request) {
1088 - utils.forEach(requestHeaders, function setRequestHeader(val, key) {
1089 - if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
1090 - // Remove Content-Type if data is undefined
1091 - delete requestHeaders[key];
1092 - } else {
1093 - // Otherwise add header to the request
1094 - request.setRequestHeader(key, val);
1095 - }
1096 - });
1097 - }
1098 -
1099 - // Add withCredentials to request if needed
1100 - if (config.withCredentials) {
1101 - request.withCredentials = true;
1102 - }
1103 -
1104 - // Add responseType to request if needed
1105 - if (config.responseType) {
1106 - try {
1107 - request.responseType = config.responseType;
1108 - } catch (e) {
1109 - // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
1110 - // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
1111 - if (config.responseType !== 'json') {
1112 - throw e;
1113 - }
1114 - }
1115 - }
1116 -
1117 - // Handle progress if needed
1118 - if (typeof config.onDownloadProgress === 'function') {
1119 - request.addEventListener('progress', config.onDownloadProgress);
1120 - }
1121 -
1122 - // Not all browsers support upload events
1123 - if (typeof config.onUploadProgress === 'function' && request.upload) {
1124 - request.upload.addEventListener('progress', config.onUploadProgress);
1125 - }
1126 -
1127 - if (config.cancelToken) {
1128 - // Handle cancellation
1129 - config.cancelToken.promise.then(function onCanceled(cancel) {
1130 - if (!request) {
1131 - return;
1132 - }
1133 -
1134 - request.abort();
1135 - reject(cancel);
1136 - // Clean up request
1137 - request = null;
1138 - });
1139 - }
1140 -
1141 - if (requestData === undefined) {
1142 - requestData = null;
1143 - }
1144 -
1145 - // Send the request
1146 - request.send(requestData);
1147 - });
1148 - };
1149 -
1150 -
1151 -/***/ }),
1152 -/* 14 */
1153 -/***/ (function(module, exports, __webpack_require__) {
1154 -
1155 - 'use strict';
1156 -
1157 - var createError = __webpack_require__(15);
1158 -
1159 - /**
1160 - * Resolve or reject a Promise based on response status.
1161 - *
1162 - * @param {Function} resolve A function that resolves the promise.
1163 - * @param {Function} reject A function that rejects the promise.
1164 - * @param {object} response The response.
1165 - */
1166 - module.exports = function settle(resolve, reject, response) {
1167 - var validateStatus = response.config.validateStatus;
1168 - if (!validateStatus || validateStatus(response.status)) {
1169 - resolve(response);
1170 - } else {
1171 - reject(createError(
1172 - 'Request failed with status code ' + response.status,
1173 - response.config,
1174 - null,
1175 - response.request,
1176 - response
1177 - ));
1178 - }
1179 - };
1180 -
1181 -
1182 -/***/ }),
1183 -/* 15 */
1184 -/***/ (function(module, exports, __webpack_require__) {
1185 -
1186 - 'use strict';
1187 -
1188 - var enhanceError = __webpack_require__(16);
1189 -
1190 - /**
1191 - * Create an Error with the specified message, config, error code, request and response.
1192 - *
1193 - * @param {string} message The error message.
1194 - * @param {Object} config The config.
1195 - * @param {string} [code] The error code (for example, 'ECONNABORTED').
1196 - * @param {Object} [request] The request.
1197 - * @param {Object} [response] The response.
1198 - * @returns {Error} The created error.
1199 - */
1200 - module.exports = function createError(message, config, code, request, response) {
1201 - var error = new Error(message);
1202 - return enhanceError(error, config, code, request, response);
1203 - };
1204 -
1205 -
1206 -/***/ }),
1207 -/* 16 */
1208 -/***/ (function(module, exports) {
1209 -
1210 - 'use strict';
1211 -
1212 - /**
1213 - * Update an Error with the specified config, error code, and response.
1214 - *
1215 - * @param {Error} error The error to update.
1216 - * @param {Object} config The config.
1217 - * @param {string} [code] The error code (for example, 'ECONNABORTED').
1218 - * @param {Object} [request] The request.
1219 - * @param {Object} [response] The response.
1220 - * @returns {Error} The error.
1221 - */
1222 - module.exports = function enhanceError(error, config, code, request, response) {
1223 - error.config = config;
1224 - if (code) {
1225 - error.code = code;
1226 - }
1227 -
1228 - error.request = request;
1229 - error.response = response;
1230 - error.isAxiosError = true;
1231 -
1232 - error.toJSON = function() {
1233 - return {
1234 - // Standard
1235 - message: this.message,
1236 - name: this.name,
1237 - // Microsoft
1238 - description: this.description,
1239 - number: this.number,
1240 - // Mozilla
1241 - fileName: this.fileName,
1242 - lineNumber: this.lineNumber,
1243 - columnNumber: this.columnNumber,
1244 - stack: this.stack,
1245 - // Axios
1246 - config: this.config,
1247 - code: this.code
1248 - };
1249 - };
1250 - return error;
1251 - };
1252 -
1253 -
1254 -/***/ }),
1255 -/* 17 */
1256 -/***/ (function(module, exports, __webpack_require__) {
1257 -
1258 - 'use strict';
1259 -
1260 - var utils = __webpack_require__(2);
1261 -
1262 - // Headers whose duplicates are ignored by node
1263 - // c.f. https://nodejs.org/api/http.html#http_message_headers
1264 - var ignoreDuplicateOf = [
1265 - 'age', 'authorization', 'content-length', 'content-type', 'etag',
1266 - 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1267 - 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1268 - 'referer', 'retry-after', 'user-agent'
1269 - ];
1270 -
1271 - /**
1272 - * Parse headers into an object
1273 - *
1274 - * ```
1275 - * Date: Wed, 27 Aug 2014 08:58:49 GMT
1276 - * Content-Type: application/json
1277 - * Connection: keep-alive
1278 - * Transfer-Encoding: chunked
1279 - * ```
1280 - *
1281 - * @param {String} headers Headers needing to be parsed
1282 - * @returns {Object} Headers parsed into an object
1283 - */
1284 - module.exports = function parseHeaders(headers) {
1285 - var parsed = {};
1286 - var key;
1287 - var val;
1288 - var i;
1289 -
1290 - if (!headers) { return parsed; }
1291 -
1292 - utils.forEach(headers.split('\n'), function parser(line) {
1293 - i = line.indexOf(':');
1294 - key = utils.trim(line.substr(0, i)).toLowerCase();
1295 - val = utils.trim(line.substr(i + 1));
1296 -
1297 - if (key) {
1298 - if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1299 - return;
1300 - }
1301 - if (key === 'set-cookie') {
1302 - parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1303 - } else {
1304 - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1305 - }
1306 - }
1307 - });
1308 -
1309 - return parsed;
1310 - };
1311 -
1312 -
1313 -/***/ }),
1314 -/* 18 */
1315 -/***/ (function(module, exports, __webpack_require__) {
1316 -
1317 - 'use strict';
1318 -
1319 - var utils = __webpack_require__(2);
1320 -
1321 - module.exports = (
1322 - utils.isStandardBrowserEnv() ?
1323 -
1324 - // Standard browser envs have full support of the APIs needed to test
1325 - // whether the request URL is of the same origin as current location.
1326 - (function standardBrowserEnv() {
1327 - var msie = /(msie|trident)/i.test(navigator.userAgent);
1328 - var urlParsingNode = document.createElement('a');
1329 - var originURL;
1330 -
1331 - /**
1332 - * Parse a URL to discover it's components
1333 - *
1334 - * @param {String} url The URL to be parsed
1335 - * @returns {Object}
1336 - */
1337 - function resolveURL(url) {
1338 - var href = url;
1339 -
1340 - if (msie) {
1341 - // IE needs attribute set twice to normalize properties
1342 - urlParsingNode.setAttribute('href', href);
1343 - href = urlParsingNode.href;
1344 - }
1345 -
1346 - urlParsingNode.setAttribute('href', href);
1347 -
1348 - // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1349 - return {
1350 - href: urlParsingNode.href,
1351 - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1352 - host: urlParsingNode.host,
1353 - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1354 - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1355 - hostname: urlParsingNode.hostname,
1356 - port: urlParsingNode.port,
1357 - pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1358 - urlParsingNode.pathname :
1359 - '/' + urlParsingNode.pathname
1360 - };
1361 - }
1362 -
1363 - originURL = resolveURL(window.location.href);
1364 -
1365 - /**
1366 - * Determine if a URL shares the same origin as the current location
1367 - *
1368 - * @param {String} requestURL The URL to test
1369 - * @returns {boolean} True if URL shares the same origin, otherwise false
1370 - */
1371 - return function isURLSameOrigin(requestURL) {
1372 - var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1373 - return (parsed.protocol === originURL.protocol &&
1374 - parsed.host === originURL.host);
1375 - };
1376 - })() :
1377 -
1378 - // Non standard browser envs (web workers, react-native) lack needed support.
1379 - (function nonStandardBrowserEnv() {
1380 - return function isURLSameOrigin() {
1381 - return true;
1382 - };
1383 - })()
1384 - );
1385 -
1386 -
1387 -/***/ }),
1388 -/* 19 */
1389 -/***/ (function(module, exports, __webpack_require__) {
1390 -
1391 - 'use strict';
1392 -
1393 - var utils = __webpack_require__(2);
1394 -
1395 - module.exports = (
1396 - utils.isStandardBrowserEnv() ?
1397 -
1398 - // Standard browser envs support document.cookie
1399 - (function standardBrowserEnv() {
1400 - return {
1401 - write: function write(name, value, expires, path, domain, secure) {
1402 - var cookie = [];
1403 - cookie.push(name + '=' + encodeURIComponent(value));
1404 -
1405 - if (utils.isNumber(expires)) {
1406 - cookie.push('expires=' + new Date(expires).toGMTString());
1407 - }
1408 -
1409 - if (utils.isString(path)) {
1410 - cookie.push('path=' + path);
1411 - }
1412 -
1413 - if (utils.isString(domain)) {
1414 - cookie.push('domain=' + domain);
1415 - }
1416 -
1417 - if (secure === true) {
1418 - cookie.push('secure');
1419 - }
1420 -
1421 - document.cookie = cookie.join('; ');
1422 - },
1423 -
1424 - read: function read(name) {
1425 - var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1426 - return (match ? decodeURIComponent(match[3]) : null);
1427 - },
1428 -
1429 - remove: function remove(name) {
1430 - this.write(name, '', Date.now() - 86400000);
1431 - }
1432 - };
1433 - })() :
1434 -
1435 - // Non standard browser env (web workers, react-native) lack needed support.
1436 - (function nonStandardBrowserEnv() {
1437 - return {
1438 - write: function write() {},
1439 - read: function read() { return null; },
1440 - remove: function remove() {}
1441 - };
1442 - })()
1443 - );
1444 -
1445 -
1446 -/***/ }),
1447 -/* 20 */
1448 -/***/ (function(module, exports) {
1449 -
1450 - 'use strict';
1451 -
1452 - /**
1453 - * Determines whether the specified URL is absolute
1454 - *
1455 - * @param {string} url The URL to test
1456 - * @returns {boolean} True if the specified URL is absolute, otherwise false
1457 - */
1458 - module.exports = function isAbsoluteURL(url) {
1459 - // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1460 - // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1461 - // by any combination of letters, digits, plus, period, or hyphen.
1462 - return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
1463 - };
1464 -
1465 -
1466 -/***/ }),
1467 -/* 21 */
1468 -/***/ (function(module, exports) {
1469 -
1470 - 'use strict';
1471 -
1472 - /**
1473 - * Creates a new URL by combining the specified URLs
1474 - *
1475 - * @param {string} baseURL The base URL
1476 - * @param {string} relativeURL The relative URL
1477 - * @returns {string} The combined URL
1478 - */
1479 - module.exports = function combineURLs(baseURL, relativeURL) {
1480 - return relativeURL
1481 - ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1482 - : baseURL;
1483 - };
1484 -
1485 -
1486 -/***/ }),
1487 -/* 22 */
1488 -/***/ (function(module, exports, __webpack_require__) {
1489 -
1490 - 'use strict';
1491 -
1492 - var utils = __webpack_require__(2);
1493 -
1494 - /**
1495 - * Config-specific merge-function which creates a new config-object
1496 - * by merging two configuration objects together.
1497 - *
1498 - * @param {Object} config1
1499 - * @param {Object} config2
1500 - * @returns {Object} New object resulting from merging config2 to config1
1501 - */
1502 - module.exports = function mergeConfig(config1, config2) {
1503 - // eslint-disable-next-line no-param-reassign
1504 - config2 = config2 || {};
1505 - var config = {};
1506 -
1507 - utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
1508 - if (typeof config2[prop] !== 'undefined') {
1509 - config[prop] = config2[prop];
1510 - }
1511 - });
1512 -
1513 - utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
1514 - if (utils.isObject(config2[prop])) {
1515 - config[prop] = utils.deepMerge(config1[prop], config2[prop]);
1516 - } else if (typeof config2[prop] !== 'undefined') {
1517 - config[prop] = config2[prop];
1518 - } else if (utils.isObject(config1[prop])) {
1519 - config[prop] = utils.deepMerge(config1[prop]);
1520 - } else if (typeof config1[prop] !== 'undefined') {
1521 - config[prop] = config1[prop];
1522 - }
1523 - });
1524 -
1525 - utils.forEach([
1526 - 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
1527 - 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
1528 - 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
1529 - 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
1530 - 'socketPath'
1531 - ], function defaultToConfig2(prop) {
1532 - if (typeof config2[prop] !== 'undefined') {
1533 - config[prop] = config2[prop];
1534 - } else if (typeof config1[prop] !== 'undefined') {
1535 - config[prop] = config1[prop];
1536 - }
1537 - });
1538 -
1539 - return config;
1540 - };
1541 -
1542 -
1543 -/***/ }),
1544 -/* 23 */
1545 -/***/ (function(module, exports) {
1546 -
1547 - 'use strict';
1548 -
1549 - /**
1550 - * A `Cancel` is an object that is thrown when an operation is canceled.
1551 - *
1552 - * @class
1553 - * @param {string=} message The message.
1554 - */
1555 - function Cancel(message) {
1556 - this.message = message;
1557 - }
1558 -
1559 - Cancel.prototype.toString = function toString() {
1560 - return 'Cancel' + (this.message ? ': ' + this.message : '');
1561 - };
1562 -
1563 - Cancel.prototype.__CANCEL__ = true;
1564 -
1565 - module.exports = Cancel;
1566 -
1567 -
1568 -/***/ }),
1569 -/* 24 */
1570 -/***/ (function(module, exports, __webpack_require__) {
1571 -
1572 - 'use strict';
1573 -
1574 - var Cancel = __webpack_require__(23);
1575 -
1576 - /**
1577 - * A `CancelToken` is an object that can be used to request cancellation of an operation.
1578 - *
1579 - * @class
1580 - * @param {Function} executor The executor function.
1581 - */
1582 - function CancelToken(executor) {
1583 - if (typeof executor !== 'function') {
1584 - throw new TypeError('executor must be a function.');
1585 - }
1586 -
1587 - var resolvePromise;
1588 - this.promise = new Promise(function promiseExecutor(resolve) {
1589 - resolvePromise = resolve;
1590 - });
1591 -
1592 - var token = this;
1593 - executor(function cancel(message) {
1594 - if (token.reason) {
1595 - // Cancellation has already been requested
1596 - return;
1597 - }
1598 -
1599 - token.reason = new Cancel(message);
1600 - resolvePromise(token.reason);
1601 - });
1602 - }
1603 -
1604 - /**
1605 - * Throws a `Cancel` if cancellation has been requested.
1606 - */
1607 - CancelToken.prototype.throwIfRequested = function throwIfRequested() {
1608 - if (this.reason) {
1609 - throw this.reason;
1610 - }
1611 - };
1612 -
1613 - /**
1614 - * Returns an object that contains a new `CancelToken` and a function that, when called,
1615 - * cancels the `CancelToken`.
1616 - */
1617 - CancelToken.source = function source() {
1618 - var cancel;
1619 - var token = new CancelToken(function executor(c) {
1620 - cancel = c;
1621 - });
1622 - return {
1623 - token: token,
1624 - cancel: cancel
1625 - };
1626 - };
1627 -
1628 - module.exports = CancelToken;
1629 -
1630 -
1631 -/***/ }),
1632 -/* 25 */
1633 -/***/ (function(module, exports) {
1634 -
1635 - 'use strict';
1636 -
1637 - /**
1638 - * Syntactic sugar for invoking a function and expanding an array for arguments.
1639 - *
1640 - * Common use case would be to use `Function.prototype.apply`.
1641 - *
1642 - * ```js
1643 - * function f(x, y, z) {}
1644 - * var args = [1, 2, 3];
1645 - * f.apply(null, args);
1646 - * ```
1647 - *
1648 - * With `spread` this example can be re-written.
1649 - *
1650 - * ```js
1651 - * spread(function(x, y, z) {})([1, 2, 3]);
1652 - * ```
1653 - *
1654 - * @param {Function} callback
1655 - * @returns {Function}
1656 - */
1657 - module.exports = function spread(callback) {
1658 - return function wrap(arr) {
1659 - return callback.apply(null, arr);
1660 - };
1661 - };
1662 -
1663 -
1664 -/***/ })
1665 -/******/ ])
1666 -});
1667 -;
1668 -//# sourceMappingURL=axios.map
...\ No newline at end of file ...\ No newline at end of file
1 -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap ddfe8a04d3b6bbcd8d1c","webpack:///./index.js","webpack:///./lib/axios.js","webpack:///./lib/utils.js","webpack:///./lib/helpers/bind.js","webpack:///./~/is-buffer/index.js","webpack:///./lib/core/Axios.js","webpack:///./lib/helpers/buildURL.js","webpack:///./lib/core/InterceptorManager.js","webpack:///./lib/core/dispatchRequest.js","webpack:///./lib/core/transformData.js","webpack:///./lib/cancel/isCancel.js","webpack:///./lib/defaults.js","webpack:///./lib/helpers/normalizeHeaderName.js","webpack:///./lib/adapters/xhr.js","webpack:///./lib/core/settle.js","webpack:///./lib/core/createError.js","webpack:///./lib/core/enhanceError.js","webpack:///./lib/helpers/parseHeaders.js","webpack:///./lib/helpers/isURLSameOrigin.js","webpack:///./lib/helpers/cookies.js","webpack:///./lib/helpers/isAbsoluteURL.js","webpack:///./lib/helpers/combineURLs.js","webpack:///./lib/core/mergeConfig.js","webpack:///./lib/cancel/Cancel.js","webpack:///./lib/cancel/CancelToken.js","webpack:///./lib/helpers/spread.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA,yC;;;;;;ACAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;ACpDA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,aAAa;AACxB,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,SAAS,GAAG,SAAS;AAC5C,4BAA2B;AAC3B;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,iCAAgC;AAChC,MAAK;AACL;AACA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC7UA;;AAEA;AACA;AACA;AACA,oBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA,MAAK;AACL;AACA,EAAC;;AAED;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA;AACA,MAAK;AACL;AACA,EAAC;;AAED;;;;;;;ACrFA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB;AACA,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;;;;;;;ACnDA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAA+B;AAC/B,wCAAuC;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;;;;;;;ACrFA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,MAAM;AACjB,YAAW,eAAe;AAC1B,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACnBA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAwE;AACxE;AACA;AACA;AACA,wDAAuD;AACvD;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,QAAO,YAAY;AACnB;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA,EAAC;;AAED;;;;;;;ACjGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;;;;;ACXA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,6CAA4C;AAC5C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;;;;;;AC7KA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxBA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;;;;;;ACjBA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACzCA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAiB,eAAe;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACpDA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;;;;;;ACnEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2CAA0C;AAC1C,UAAS;;AAET;AACA,6DAA4D,wBAAwB;AACpF;AACA,UAAS;;AAET;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,mCAAkC;AAClC,gCAA+B,aAAa,EAAE;AAC9C;AACA;AACA,MAAK;AACL;;;;;;;ACpDA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;AClDA;;AAEA;AACA;AACA;AACA;AACA,YAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;;AClBA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxDA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,YAAW,SAAS;AACpB,cAAa;AACb;AACA;AACA;AACA;AACA;AACA","file":"axios.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"axios\"] = factory();\n\telse\n\t\troot[\"axios\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ddfe8a04d3b6bbcd8d1c","module.exports = require('./lib/axios');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/axios.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nvar bind = require('./helpers/bind');\nvar isBuffer = require('is-buffer');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/utils.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/bind.js\n// module id = 3\n// module chunks = 0","/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/is-buffer/index.js\n// module id = 4\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n config.method = config.method ? config.method.toLowerCase() : 'get';\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/Axios.js\n// module id = 5\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/buildURL.js\n// module id = 6\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/InterceptorManager.js\n// module id = 7\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\nvar isAbsoluteURL = require('./../helpers/isAbsoluteURL');\nvar combineURLs = require('./../helpers/combineURLs');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/dispatchRequest.js\n// module id = 8\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/transformData.js\n// module id = 9\n// module chunks = 0","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/isCancel.js\n// module id = 10\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n // Only Node.JS has a process variable that is of [[Class]] process\n if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 11\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/normalizeHeaderName.js\n// module id = 12\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar buildURL = require('./../helpers/buildURL');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = require('./../helpers/cookies');\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/adapters/xhr.js\n// module id = 13\n// module chunks = 0","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/settle.js\n// module id = 14\n// module chunks = 0","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/createError.js\n// module id = 15\n// module chunks = 0","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/enhanceError.js\n// module id = 16\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/parseHeaders.js\n// module id = 17\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isURLSameOrigin.js\n// module id = 18\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/cookies.js\n// module id = 19\n// module chunks = 0","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isAbsoluteURL.js\n// module id = 20\n// module chunks = 0","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/combineURLs.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach([\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',\n 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',\n 'socketPath'\n ], function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/mergeConfig.js\n// module id = 22\n// module chunks = 0","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/Cancel.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/CancelToken.js\n// module id = 24\n// module chunks = 0","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/spread.js\n// module id = 25\n// module chunks = 0"],"sourceRoot":""}
...\ No newline at end of file ...\ No newline at end of file
1 -/* axios v0.19.0 | (c) 2019 by Matt Zabriskie */
2 -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=s(i.prototype.request,t);return o.extend(n,i.prototype,t),o.extend(n,t),n}var o=n(2),s=n(3),i=n(5),a=n(22),u=n(11),c=r(u);c.Axios=i,c.create=function(e){return r(a(c.defaults,e))},c.Cancel=n(23),c.CancelToken=n(24),c.isCancel=n(10),c.all=function(e){return Promise.all(e)},c.spread=n(25),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){return"[object Array]"===j.call(e)}function o(e){return"[object ArrayBuffer]"===j.call(e)}function s(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function a(e){return"string"==typeof e}function u(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===j.call(e)}function d(e){return"[object File]"===j.call(e)}function l(e){return"[object Blob]"===j.call(e)}function h(e){return"[object Function]"===j.call(e)}function m(e){return f(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function g(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function x(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}function w(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=w(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)v(arguments[n],e);return t}function b(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=b(t[n],e):"object"==typeof e?t[n]=b({},e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)v(arguments[n],e);return t}function E(e,t,n){return v(t,function(t,r){n&&"function"==typeof t?e[r]=S(t,n):e[r]=t}),e}var S=n(3),R=n(4),j=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:o,isBuffer:R,isFormData:s,isArrayBufferView:i,isString:a,isNumber:u,isObject:f,isUndefined:c,isDate:p,isFile:d,isBlob:l,isFunction:h,isStream:m,isURLSearchParams:y,isStandardBrowserEnv:x,forEach:v,merge:w,deepMerge:b,extend:E,trim:g}},function(e,t){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t){/*!
3 - * Determine if an object is a Buffer
4 - *
5 - * @author Feross Aboukhadijeh <https://feross.org>
6 - * @license MIT
7 - */
8 -e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var o=n(2),s=n(6),i=n(7),a=n(8),u=n(22);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=u(this.defaults,e),e.method=e.method?e.method.toLowerCase():"get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},r.prototype.getUri=function(e){return e=u(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var s;if(n)s=n(t);else if(o.isURLSearchParams(t))s=t.toString();else{var i=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),i.push(r(t)+"="+r(e))}))}),s=i.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),s=n(9),i=n(10),a=n(11),u=n(20),c=n(21);e.exports=function(e){r(e),e.baseURL&&!u(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=s(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||a.adapter;return t(e).then(function(t){return r(e),t.data=s(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=s(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";function r(e,t){!s.isUndefined(e)&&s.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)?e=n(13):"undefined"!=typeof XMLHttpRequest&&(e=n(13)),e}var s=n(2),i=n(12),a={"Content-Type":"application/x-www-form-urlencoded"},u={adapter:o(),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),s.isFormData(e)||s.isArrayBuffer(e)||s.isBuffer(e)||s.isStream(e)||s.isFile(e)||s.isBlob(e)?e:s.isArrayBufferView(e)?e.buffer:s.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):s.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},s.forEach(["delete","get","head"],function(e){u.headers[e]={}}),s.forEach(["post","put","patch"],function(e){u.headers[e]=s.merge(a)}),e.exports=u},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(14),s=n(6),i=n(17),a=n(18),u=n(15);e.exports=function(e){return new Promise(function(t,c){var f=e.data,p=e.headers;r.isFormData(f)&&delete p["Content-Type"];var d=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",h=e.auth.password||"";p.Authorization="Basic "+btoa(l+":"+h)}if(d.open(e.method.toUpperCase(),s(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?i(d.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?d.response:d.responseText,s={data:r,status:d.status,statusText:d.statusText,headers:n,config:e,request:d};o(t,c,s),d=null}},d.onabort=function(){d&&(c(u("Request aborted",e,"ECONNABORTED",d)),d=null)},d.onerror=function(){c(u("Network Error",e,null,d)),d=null},d.ontimeout=function(){c(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",d)),d=null},r.isStandardBrowserEnv()){var m=n(19),y=(e.withCredentials||a(e.url))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;y&&(p[e.xsrfHeaderName]=y)}if("setRequestHeader"in d&&r.forEach(p,function(e,t){"undefined"==typeof f&&"content-type"===t.toLowerCase()?delete p[t]:d.setRequestHeader(t,e)}),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){d&&(d.abort(),c(e),d=null)}),void 0===f&&(f=null),d.send(f)})}},function(e,t,n){"use strict";var r=n(15);e.exports=function(e,t,n){var o=n.config.validateStatus;!o||o(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";var r=n(16);e.exports=function(e,t,n,o,s){var i=new Error(e);return r(i,t,n,o,s)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,s,i={};return e?(r.forEach(e.split("\n"),function(e){if(s=e.indexOf(":"),t=r.trim(e.substr(0,s)).toLowerCase(),n=r.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?i[t]=(i[t]?i[t]:[]).concat([n]):i[t]=i[t]?i[t]+", "+n:n}}),i):i}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(s)&&a.push("domain="+s),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){t=t||{};var n={};return r.forEach(["url","method","params","data"],function(e){"undefined"!=typeof t[e]&&(n[e]=t[e])}),r.forEach(["headers","auth","proxy"],function(o){r.isObject(t[o])?n[o]=r.deepMerge(e[o],t[o]):"undefined"!=typeof t[o]?n[o]=t[o]:r.isObject(e[o])?n[o]=r.deepMerge(e[o]):"undefined"!=typeof e[o]&&(n[o]=e[o])}),r.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],function(r){"undefined"!=typeof t[r]?n[r]=t[r]:"undefined"!=typeof e[r]&&(n[r]=e[r])}),n}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])});
9 -//# sourceMappingURL=axios.min.map
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
1 -export interface AxiosTransformer {
2 - (data: any, headers?: any): any;
3 -}
4 -
5 -export interface AxiosAdapter {
6 - (config: AxiosRequestConfig): AxiosPromise<any>;
7 -}
8 -
9 -export interface AxiosBasicCredentials {
10 - username: string;
11 - password: string;
12 -}
13 -
14 -export interface AxiosProxyConfig {
15 - host: string;
16 - port: number;
17 - auth?: {
18 - username: string;
19 - password:string;
20 - };
21 - protocol?: string;
22 -}
23 -
24 -export type Method =
25 - | 'get' | 'GET'
26 - | 'delete' | 'DELETE'
27 - | 'head' | 'HEAD'
28 - | 'options' | 'OPTIONS'
29 - | 'post' | 'POST'
30 - | 'put' | 'PUT'
31 - | 'patch' | 'PATCH'
32 -
33 -export type ResponseType =
34 - | 'arraybuffer'
35 - | 'blob'
36 - | 'document'
37 - | 'json'
38 - | 'text'
39 - | 'stream'
40 -
41 -export interface AxiosRequestConfig {
42 - url?: string;
43 - method?: Method;
44 - baseURL?: string;
45 - transformRequest?: AxiosTransformer | AxiosTransformer[];
46 - transformResponse?: AxiosTransformer | AxiosTransformer[];
47 - headers?: any;
48 - params?: any;
49 - paramsSerializer?: (params: any) => string;
50 - data?: any;
51 - timeout?: number;
52 - withCredentials?: boolean;
53 - adapter?: AxiosAdapter;
54 - auth?: AxiosBasicCredentials;
55 - responseType?: ResponseType;
56 - xsrfCookieName?: string;
57 - xsrfHeaderName?: string;
58 - onUploadProgress?: (progressEvent: any) => void;
59 - onDownloadProgress?: (progressEvent: any) => void;
60 - maxContentLength?: number;
61 - validateStatus?: (status: number) => boolean;
62 - maxRedirects?: number;
63 - socketPath?: string | null;
64 - httpAgent?: any;
65 - httpsAgent?: any;
66 - proxy?: AxiosProxyConfig | false;
67 - cancelToken?: CancelToken;
68 -}
69 -
70 -export interface AxiosResponse<T = any> {
71 - data: T;
72 - status: number;
73 - statusText: string;
74 - headers: any;
75 - config: AxiosRequestConfig;
76 - request?: any;
77 -}
78 -
79 -export interface AxiosError<T = any> extends Error {
80 - config: AxiosRequestConfig;
81 - code?: string;
82 - request?: any;
83 - response?: AxiosResponse<T>;
84 - isAxiosError: boolean;
85 -}
86 -
87 -export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
88 -}
89 -
90 -export interface CancelStatic {
91 - new (message?: string): Cancel;
92 -}
93 -
94 -export interface Cancel {
95 - message: string;
96 -}
97 -
98 -export interface Canceler {
99 - (message?: string): void;
100 -}
101 -
102 -export interface CancelTokenStatic {
103 - new (executor: (cancel: Canceler) => void): CancelToken;
104 - source(): CancelTokenSource;
105 -}
106 -
107 -export interface CancelToken {
108 - promise: Promise<Cancel>;
109 - reason?: Cancel;
110 - throwIfRequested(): void;
111 -}
112 -
113 -export interface CancelTokenSource {
114 - token: CancelToken;
115 - cancel: Canceler;
116 -}
117 -
118 -export interface AxiosInterceptorManager<V> {
119 - use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
120 - eject(id: number): void;
121 -}
122 -
123 -export interface AxiosInstance {
124 - (config: AxiosRequestConfig): AxiosPromise;
125 - (url: string, config?: AxiosRequestConfig): AxiosPromise;
126 - defaults: AxiosRequestConfig;
127 - interceptors: {
128 - request: AxiosInterceptorManager<AxiosRequestConfig>;
129 - response: AxiosInterceptorManager<AxiosResponse>;
130 - };
131 - getUri(config?: AxiosRequestConfig): string;
132 - request<T = any, R = AxiosResponse<T>> (config: AxiosRequestConfig): Promise<R>;
133 - get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
134 - delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
135 - head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
136 - post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
137 - put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
138 - patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
139 -}
140 -
141 -export interface AxiosStatic extends AxiosInstance {
142 - create(config?: AxiosRequestConfig): AxiosInstance;
143 - Cancel: CancelStatic;
144 - CancelToken: CancelTokenStatic;
145 - isCancel(value: any): boolean;
146 - all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
147 - spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
148 -}
149 -
150 -declare const Axios: AxiosStatic;
151 -
152 -export default Axios;
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -var settle = require('./../core/settle');
5 -var buildURL = require('./../helpers/buildURL');
6 -var http = require('http');
7 -var https = require('https');
8 -var httpFollow = require('follow-redirects').http;
9 -var httpsFollow = require('follow-redirects').https;
10 -var url = require('url');
11 -var zlib = require('zlib');
12 -var pkg = require('./../../package.json');
13 -var createError = require('../core/createError');
14 -var enhanceError = require('../core/enhanceError');
15 -
16 -var isHttps = /https:?/;
17 -
18 -/*eslint consistent-return:0*/
19 -module.exports = function httpAdapter(config) {
20 - return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
21 - var timer;
22 - var resolve = function resolve(value) {
23 - clearTimeout(timer);
24 - resolvePromise(value);
25 - };
26 - var reject = function reject(value) {
27 - clearTimeout(timer);
28 - rejectPromise(value);
29 - };
30 - var data = config.data;
31 - var headers = config.headers;
32 -
33 - // Set User-Agent (required by some servers)
34 - // Only set header if it hasn't been set in config
35 - // See https://github.com/axios/axios/issues/69
36 - if (!headers['User-Agent'] && !headers['user-agent']) {
37 - headers['User-Agent'] = 'axios/' + pkg.version;
38 - }
39 -
40 - if (data && !utils.isStream(data)) {
41 - if (Buffer.isBuffer(data)) {
42 - // Nothing to do...
43 - } else if (utils.isArrayBuffer(data)) {
44 - data = Buffer.from(new Uint8Array(data));
45 - } else if (utils.isString(data)) {
46 - data = Buffer.from(data, 'utf-8');
47 - } else {
48 - return reject(createError(
49 - 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
50 - config
51 - ));
52 - }
53 -
54 - // Add Content-Length header if data exists
55 - headers['Content-Length'] = data.length;
56 - }
57 -
58 - // HTTP basic authentication
59 - var auth = undefined;
60 - if (config.auth) {
61 - var username = config.auth.username || '';
62 - var password = config.auth.password || '';
63 - auth = username + ':' + password;
64 - }
65 -
66 - // Parse url
67 - var parsed = url.parse(config.url);
68 - var protocol = parsed.protocol || 'http:';
69 -
70 - if (!auth && parsed.auth) {
71 - var urlAuth = parsed.auth.split(':');
72 - var urlUsername = urlAuth[0] || '';
73 - var urlPassword = urlAuth[1] || '';
74 - auth = urlUsername + ':' + urlPassword;
75 - }
76 -
77 - if (auth) {
78 - delete headers.Authorization;
79 - }
80 -
81 - var isHttpsRequest = isHttps.test(protocol);
82 - var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
83 -
84 - var options = {
85 - path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
86 - method: config.method.toUpperCase(),
87 - headers: headers,
88 - agent: agent,
89 - auth: auth
90 - };
91 -
92 - if (config.socketPath) {
93 - options.socketPath = config.socketPath;
94 - } else {
95 - options.hostname = parsed.hostname;
96 - options.port = parsed.port;
97 - }
98 -
99 - var proxy = config.proxy;
100 - if (!proxy && proxy !== false) {
101 - var proxyEnv = protocol.slice(0, -1) + '_proxy';
102 - var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
103 - if (proxyUrl) {
104 - var parsedProxyUrl = url.parse(proxyUrl);
105 - var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
106 - var shouldProxy = true;
107 -
108 - if (noProxyEnv) {
109 - var noProxy = noProxyEnv.split(',').map(function trim(s) {
110 - return s.trim();
111 - });
112 -
113 - shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
114 - if (!proxyElement) {
115 - return false;
116 - }
117 - if (proxyElement === '*') {
118 - return true;
119 - }
120 - if (proxyElement[0] === '.' &&
121 - parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement &&
122 - proxyElement.match(/\./g).length === parsed.hostname.match(/\./g).length) {
123 - return true;
124 - }
125 -
126 - return parsed.hostname === proxyElement;
127 - });
128 - }
129 -
130 -
131 - if (shouldProxy) {
132 - proxy = {
133 - host: parsedProxyUrl.hostname,
134 - port: parsedProxyUrl.port
135 - };
136 -
137 - if (parsedProxyUrl.auth) {
138 - var proxyUrlAuth = parsedProxyUrl.auth.split(':');
139 - proxy.auth = {
140 - username: proxyUrlAuth[0],
141 - password: proxyUrlAuth[1]
142 - };
143 - }
144 - }
145 - }
146 - }
147 -
148 - if (proxy) {
149 - options.hostname = proxy.host;
150 - options.host = proxy.host;
151 - options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
152 - options.port = proxy.port;
153 - options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path;
154 -
155 - // Basic proxy authorization
156 - if (proxy.auth) {
157 - var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
158 - options.headers['Proxy-Authorization'] = 'Basic ' + base64;
159 - }
160 - }
161 -
162 - var transport;
163 - var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
164 - if (config.transport) {
165 - transport = config.transport;
166 - } else if (config.maxRedirects === 0) {
167 - transport = isHttpsProxy ? https : http;
168 - } else {
169 - if (config.maxRedirects) {
170 - options.maxRedirects = config.maxRedirects;
171 - }
172 - transport = isHttpsProxy ? httpsFollow : httpFollow;
173 - }
174 -
175 - if (config.maxContentLength && config.maxContentLength > -1) {
176 - options.maxBodyLength = config.maxContentLength;
177 - }
178 -
179 - // Create the request
180 - var req = transport.request(options, function handleResponse(res) {
181 - if (req.aborted) return;
182 -
183 - // uncompress the response body transparently if required
184 - var stream = res;
185 - switch (res.headers['content-encoding']) {
186 - /*eslint default-case:0*/
187 - case 'gzip':
188 - case 'compress':
189 - case 'deflate':
190 - // add the unzipper to the body stream processing pipeline
191 - stream = (res.statusCode === 204) ? stream : stream.pipe(zlib.createUnzip());
192 -
193 - // remove the content-encoding in order to not confuse downstream operations
194 - delete res.headers['content-encoding'];
195 - break;
196 - }
197 -
198 - // return the last request in case of redirects
199 - var lastRequest = res.req || req;
200 -
201 - var response = {
202 - status: res.statusCode,
203 - statusText: res.statusMessage,
204 - headers: res.headers,
205 - config: config,
206 - request: lastRequest
207 - };
208 -
209 - if (config.responseType === 'stream') {
210 - response.data = stream;
211 - settle(resolve, reject, response);
212 - } else {
213 - var responseBuffer = [];
214 - stream.on('data', function handleStreamData(chunk) {
215 - responseBuffer.push(chunk);
216 -
217 - // make sure the content length is not over the maxContentLength if specified
218 - if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
219 - stream.destroy();
220 - reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
221 - config, null, lastRequest));
222 - }
223 - });
224 -
225 - stream.on('error', function handleStreamError(err) {
226 - if (req.aborted) return;
227 - reject(enhanceError(err, config, null, lastRequest));
228 - });
229 -
230 - stream.on('end', function handleStreamEnd() {
231 - var responseData = Buffer.concat(responseBuffer);
232 - if (config.responseType !== 'arraybuffer') {
233 - responseData = responseData.toString(config.responseEncoding);
234 - }
235 -
236 - response.data = responseData;
237 - settle(resolve, reject, response);
238 - });
239 - }
240 - });
241 -
242 - // Handle errors
243 - req.on('error', function handleRequestError(err) {
244 - if (req.aborted) return;
245 - reject(enhanceError(err, config, null, req));
246 - });
247 -
248 - // Handle request timeout
249 - if (config.timeout) {
250 - timer = setTimeout(function handleRequestTimeout() {
251 - req.abort();
252 - reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
253 - }, config.timeout);
254 - }
255 -
256 - if (config.cancelToken) {
257 - // Handle cancellation
258 - config.cancelToken.promise.then(function onCanceled(cancel) {
259 - if (req.aborted) return;
260 -
261 - req.abort();
262 - reject(cancel);
263 - });
264 - }
265 -
266 - // Send the request
267 - if (utils.isStream(data)) {
268 - data.on('error', function handleStreamError(err) {
269 - reject(enhanceError(err, config, null, req));
270 - }).pipe(req);
271 - } else {
272 - req.end(data);
273 - }
274 - });
275 -};
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -var settle = require('./../core/settle');
5 -var buildURL = require('./../helpers/buildURL');
6 -var parseHeaders = require('./../helpers/parseHeaders');
7 -var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
8 -var createError = require('../core/createError');
9 -
10 -module.exports = function xhrAdapter(config) {
11 - return new Promise(function dispatchXhrRequest(resolve, reject) {
12 - var requestData = config.data;
13 - var requestHeaders = config.headers;
14 -
15 - if (utils.isFormData(requestData)) {
16 - delete requestHeaders['Content-Type']; // Let the browser set it
17 - }
18 -
19 - var request = new XMLHttpRequest();
20 -
21 - // HTTP basic authentication
22 - if (config.auth) {
23 - var username = config.auth.username || '';
24 - var password = config.auth.password || '';
25 - requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
26 - }
27 -
28 - request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
29 -
30 - // Set the request timeout in MS
31 - request.timeout = config.timeout;
32 -
33 - // Listen for ready state
34 - request.onreadystatechange = function handleLoad() {
35 - if (!request || request.readyState !== 4) {
36 - return;
37 - }
38 -
39 - // The request errored out and we didn't get a response, this will be
40 - // handled by onerror instead
41 - // With one exception: request that using file: protocol, most browsers
42 - // will return status as 0 even though it's a successful request
43 - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
44 - return;
45 - }
46 -
47 - // Prepare the response
48 - var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
49 - var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
50 - var response = {
51 - data: responseData,
52 - status: request.status,
53 - statusText: request.statusText,
54 - headers: responseHeaders,
55 - config: config,
56 - request: request
57 - };
58 -
59 - settle(resolve, reject, response);
60 -
61 - // Clean up request
62 - request = null;
63 - };
64 -
65 - // Handle browser request cancellation (as opposed to a manual cancellation)
66 - request.onabort = function handleAbort() {
67 - if (!request) {
68 - return;
69 - }
70 -
71 - reject(createError('Request aborted', config, 'ECONNABORTED', request));
72 -
73 - // Clean up request
74 - request = null;
75 - };
76 -
77 - // Handle low level network errors
78 - request.onerror = function handleError() {
79 - // Real errors are hidden from us by the browser
80 - // onerror should only fire if it's a network error
81 - reject(createError('Network Error', config, null, request));
82 -
83 - // Clean up request
84 - request = null;
85 - };
86 -
87 - // Handle timeout
88 - request.ontimeout = function handleTimeout() {
89 - reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
90 - request));
91 -
92 - // Clean up request
93 - request = null;
94 - };
95 -
96 - // Add xsrf header
97 - // This is only done if running in a standard browser environment.
98 - // Specifically not if we're in a web worker, or react-native.
99 - if (utils.isStandardBrowserEnv()) {
100 - var cookies = require('./../helpers/cookies');
101 -
102 - // Add xsrf header
103 - var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
104 - cookies.read(config.xsrfCookieName) :
105 - undefined;
106 -
107 - if (xsrfValue) {
108 - requestHeaders[config.xsrfHeaderName] = xsrfValue;
109 - }
110 - }
111 -
112 - // Add headers to the request
113 - if ('setRequestHeader' in request) {
114 - utils.forEach(requestHeaders, function setRequestHeader(val, key) {
115 - if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
116 - // Remove Content-Type if data is undefined
117 - delete requestHeaders[key];
118 - } else {
119 - // Otherwise add header to the request
120 - request.setRequestHeader(key, val);
121 - }
122 - });
123 - }
124 -
125 - // Add withCredentials to request if needed
126 - if (config.withCredentials) {
127 - request.withCredentials = true;
128 - }
129 -
130 - // Add responseType to request if needed
131 - if (config.responseType) {
132 - try {
133 - request.responseType = config.responseType;
134 - } catch (e) {
135 - // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
136 - // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
137 - if (config.responseType !== 'json') {
138 - throw e;
139 - }
140 - }
141 - }
142 -
143 - // Handle progress if needed
144 - if (typeof config.onDownloadProgress === 'function') {
145 - request.addEventListener('progress', config.onDownloadProgress);
146 - }
147 -
148 - // Not all browsers support upload events
149 - if (typeof config.onUploadProgress === 'function' && request.upload) {
150 - request.upload.addEventListener('progress', config.onUploadProgress);
151 - }
152 -
153 - if (config.cancelToken) {
154 - // Handle cancellation
155 - config.cancelToken.promise.then(function onCanceled(cancel) {
156 - if (!request) {
157 - return;
158 - }
159 -
160 - request.abort();
161 - reject(cancel);
162 - // Clean up request
163 - request = null;
164 - });
165 - }
166 -
167 - if (requestData === undefined) {
168 - requestData = null;
169 - }
170 -
171 - // Send the request
172 - request.send(requestData);
173 - });
174 -};
1 -'use strict';
2 -
3 -var utils = require('./utils');
4 -var bind = require('./helpers/bind');
5 -var Axios = require('./core/Axios');
6 -var mergeConfig = require('./core/mergeConfig');
7 -var defaults = require('./defaults');
8 -
9 -/**
10 - * Create an instance of Axios
11 - *
12 - * @param {Object} defaultConfig The default config for the instance
13 - * @return {Axios} A new instance of Axios
14 - */
15 -function createInstance(defaultConfig) {
16 - var context = new Axios(defaultConfig);
17 - var instance = bind(Axios.prototype.request, context);
18 -
19 - // Copy axios.prototype to instance
20 - utils.extend(instance, Axios.prototype, context);
21 -
22 - // Copy context to instance
23 - utils.extend(instance, context);
24 -
25 - return instance;
26 -}
27 -
28 -// Create the default instance to be exported
29 -var axios = createInstance(defaults);
30 -
31 -// Expose Axios class to allow class inheritance
32 -axios.Axios = Axios;
33 -
34 -// Factory for creating new instances
35 -axios.create = function create(instanceConfig) {
36 - return createInstance(mergeConfig(axios.defaults, instanceConfig));
37 -};
38 -
39 -// Expose Cancel & CancelToken
40 -axios.Cancel = require('./cancel/Cancel');
41 -axios.CancelToken = require('./cancel/CancelToken');
42 -axios.isCancel = require('./cancel/isCancel');
43 -
44 -// Expose all/spread
45 -axios.all = function all(promises) {
46 - return Promise.all(promises);
47 -};
48 -axios.spread = require('./helpers/spread');
49 -
50 -module.exports = axios;
51 -
52 -// Allow use of default import syntax in TypeScript
53 -module.exports.default = axios;
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -var buildURL = require('../helpers/buildURL');
5 -var InterceptorManager = require('./InterceptorManager');
6 -var dispatchRequest = require('./dispatchRequest');
7 -var mergeConfig = require('./mergeConfig');
8 -
9 -/**
10 - * Create a new instance of Axios
11 - *
12 - * @param {Object} instanceConfig The default config for the instance
13 - */
14 -function Axios(instanceConfig) {
15 - this.defaults = instanceConfig;
16 - this.interceptors = {
17 - request: new InterceptorManager(),
18 - response: new InterceptorManager()
19 - };
20 -}
21 -
22 -/**
23 - * Dispatch a request
24 - *
25 - * @param {Object} config The config specific for this request (merged with this.defaults)
26 - */
27 -Axios.prototype.request = function request(config) {
28 - /*eslint no-param-reassign:0*/
29 - // Allow for axios('example/url'[, config]) a la fetch API
30 - if (typeof config === 'string') {
31 - config = arguments[1] || {};
32 - config.url = arguments[0];
33 - } else {
34 - config = config || {};
35 - }
36 -
37 - config = mergeConfig(this.defaults, config);
38 - config.method = config.method ? config.method.toLowerCase() : 'get';
39 -
40 - // Hook up interceptors middleware
41 - var chain = [dispatchRequest, undefined];
42 - var promise = Promise.resolve(config);
43 -
44 - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
45 - chain.unshift(interceptor.fulfilled, interceptor.rejected);
46 - });
47 -
48 - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
49 - chain.push(interceptor.fulfilled, interceptor.rejected);
50 - });
51 -
52 - while (chain.length) {
53 - promise = promise.then(chain.shift(), chain.shift());
54 - }
55 -
56 - return promise;
57 -};
58 -
59 -Axios.prototype.getUri = function getUri(config) {
60 - config = mergeConfig(this.defaults, config);
61 - return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
62 -};
63 -
64 -// Provide aliases for supported request methods
65 -utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
66 - /*eslint func-names:0*/
67 - Axios.prototype[method] = function(url, config) {
68 - return this.request(utils.merge(config || {}, {
69 - method: method,
70 - url: url
71 - }));
72 - };
73 -});
74 -
75 -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
76 - /*eslint func-names:0*/
77 - Axios.prototype[method] = function(url, data, config) {
78 - return this.request(utils.merge(config || {}, {
79 - method: method,
80 - url: url,
81 - data: data
82 - }));
83 - };
84 -});
85 -
86 -module.exports = Axios;
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -var transformData = require('./transformData');
5 -var isCancel = require('../cancel/isCancel');
6 -var defaults = require('../defaults');
7 -var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
8 -var combineURLs = require('./../helpers/combineURLs');
9 -
10 -/**
11 - * Throws a `Cancel` if cancellation has been requested.
12 - */
13 -function throwIfCancellationRequested(config) {
14 - if (config.cancelToken) {
15 - config.cancelToken.throwIfRequested();
16 - }
17 -}
18 -
19 -/**
20 - * Dispatch a request to the server using the configured adapter.
21 - *
22 - * @param {object} config The config that is to be used for the request
23 - * @returns {Promise} The Promise to be fulfilled
24 - */
25 -module.exports = function dispatchRequest(config) {
26 - throwIfCancellationRequested(config);
27 -
28 - // Support baseURL config
29 - if (config.baseURL && !isAbsoluteURL(config.url)) {
30 - config.url = combineURLs(config.baseURL, config.url);
31 - }
32 -
33 - // Ensure headers exist
34 - config.headers = config.headers || {};
35 -
36 - // Transform request data
37 - config.data = transformData(
38 - config.data,
39 - config.headers,
40 - config.transformRequest
41 - );
42 -
43 - // Flatten headers
44 - config.headers = utils.merge(
45 - config.headers.common || {},
46 - config.headers[config.method] || {},
47 - config.headers || {}
48 - );
49 -
50 - utils.forEach(
51 - ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
52 - function cleanHeaderConfig(method) {
53 - delete config.headers[method];
54 - }
55 - );
56 -
57 - var adapter = config.adapter || defaults.adapter;
58 -
59 - return adapter(config).then(function onAdapterResolution(response) {
60 - throwIfCancellationRequested(config);
61 -
62 - // Transform response data
63 - response.data = transformData(
64 - response.data,
65 - response.headers,
66 - config.transformResponse
67 - );
68 -
69 - return response;
70 - }, function onAdapterRejection(reason) {
71 - if (!isCancel(reason)) {
72 - throwIfCancellationRequested(config);
73 -
74 - // Transform response data
75 - if (reason && reason.response) {
76 - reason.response.data = transformData(
77 - reason.response.data,
78 - reason.response.headers,
79 - config.transformResponse
80 - );
81 - }
82 - }
83 -
84 - return Promise.reject(reason);
85 - });
86 -};
1 -'use strict';
2 -
3 -/**
4 - * Update an Error with the specified config, error code, and response.
5 - *
6 - * @param {Error} error The error to update.
7 - * @param {Object} config The config.
8 - * @param {string} [code] The error code (for example, 'ECONNABORTED').
9 - * @param {Object} [request] The request.
10 - * @param {Object} [response] The response.
11 - * @returns {Error} The error.
12 - */
13 -module.exports = function enhanceError(error, config, code, request, response) {
14 - error.config = config;
15 - if (code) {
16 - error.code = code;
17 - }
18 -
19 - error.request = request;
20 - error.response = response;
21 - error.isAxiosError = true;
22 -
23 - error.toJSON = function() {
24 - return {
25 - // Standard
26 - message: this.message,
27 - name: this.name,
28 - // Microsoft
29 - description: this.description,
30 - number: this.number,
31 - // Mozilla
32 - fileName: this.fileName,
33 - lineNumber: this.lineNumber,
34 - columnNumber: this.columnNumber,
35 - stack: this.stack,
36 - // Axios
37 - config: this.config,
38 - code: this.code
39 - };
40 - };
41 - return error;
42 -};
1 -'use strict';
2 -
3 -var utils = require('../utils');
4 -
5 -/**
6 - * Config-specific merge-function which creates a new config-object
7 - * by merging two configuration objects together.
8 - *
9 - * @param {Object} config1
10 - * @param {Object} config2
11 - * @returns {Object} New object resulting from merging config2 to config1
12 - */
13 -module.exports = function mergeConfig(config1, config2) {
14 - // eslint-disable-next-line no-param-reassign
15 - config2 = config2 || {};
16 - var config = {};
17 -
18 - utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
19 - if (typeof config2[prop] !== 'undefined') {
20 - config[prop] = config2[prop];
21 - }
22 - });
23 -
24 - utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
25 - if (utils.isObject(config2[prop])) {
26 - config[prop] = utils.deepMerge(config1[prop], config2[prop]);
27 - } else if (typeof config2[prop] !== 'undefined') {
28 - config[prop] = config2[prop];
29 - } else if (utils.isObject(config1[prop])) {
30 - config[prop] = utils.deepMerge(config1[prop]);
31 - } else if (typeof config1[prop] !== 'undefined') {
32 - config[prop] = config1[prop];
33 - }
34 - });
35 -
36 - utils.forEach([
37 - 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
38 - 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
39 - 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
40 - 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
41 - 'socketPath'
42 - ], function defaultToConfig2(prop) {
43 - if (typeof config2[prop] !== 'undefined') {
44 - config[prop] = config2[prop];
45 - } else if (typeof config1[prop] !== 'undefined') {
46 - config[prop] = config1[prop];
47 - }
48 - });
49 -
50 - return config;
51 -};
1 -'use strict';
2 -
3 -var createError = require('./createError');
4 -
5 -/**
6 - * Resolve or reject a Promise based on response status.
7 - *
8 - * @param {Function} resolve A function that resolves the promise.
9 - * @param {Function} reject A function that rejects the promise.
10 - * @param {object} response The response.
11 - */
12 -module.exports = function settle(resolve, reject, response) {
13 - var validateStatus = response.config.validateStatus;
14 - if (!validateStatus || validateStatus(response.status)) {
15 - resolve(response);
16 - } else {
17 - reject(createError(
18 - 'Request failed with status code ' + response.status,
19 - response.config,
20 - null,
21 - response.request,
22 - response
23 - ));
24 - }
25 -};
1 -'use strict';
2 -
3 -var utils = require('./utils');
4 -var normalizeHeaderName = require('./helpers/normalizeHeaderName');
5 -
6 -var DEFAULT_CONTENT_TYPE = {
7 - 'Content-Type': 'application/x-www-form-urlencoded'
8 -};
9 -
10 -function setContentTypeIfUnset(headers, value) {
11 - if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
12 - headers['Content-Type'] = value;
13 - }
14 -}
15 -
16 -function getDefaultAdapter() {
17 - var adapter;
18 - // Only Node.JS has a process variable that is of [[Class]] process
19 - if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
20 - // For node use HTTP adapter
21 - adapter = require('./adapters/http');
22 - } else if (typeof XMLHttpRequest !== 'undefined') {
23 - // For browsers use XHR adapter
24 - adapter = require('./adapters/xhr');
25 - }
26 - return adapter;
27 -}
28 -
29 -var defaults = {
30 - adapter: getDefaultAdapter(),
31 -
32 - transformRequest: [function transformRequest(data, headers) {
33 - normalizeHeaderName(headers, 'Accept');
34 - normalizeHeaderName(headers, 'Content-Type');
35 - if (utils.isFormData(data) ||
36 - utils.isArrayBuffer(data) ||
37 - utils.isBuffer(data) ||
38 - utils.isStream(data) ||
39 - utils.isFile(data) ||
40 - utils.isBlob(data)
41 - ) {
42 - return data;
43 - }
44 - if (utils.isArrayBufferView(data)) {
45 - return data.buffer;
46 - }
47 - if (utils.isURLSearchParams(data)) {
48 - setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
49 - return data.toString();
50 - }
51 - if (utils.isObject(data)) {
52 - setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
53 - return JSON.stringify(data);
54 - }
55 - return data;
56 - }],
57 -
58 - transformResponse: [function transformResponse(data) {
59 - /*eslint no-param-reassign:0*/
60 - if (typeof data === 'string') {
61 - try {
62 - data = JSON.parse(data);
63 - } catch (e) { /* Ignore */ }
64 - }
65 - return data;
66 - }],
67 -
68 - /**
69 - * A timeout in milliseconds to abort a request. If set to 0 (default) a
70 - * timeout is not created.
71 - */
72 - timeout: 0,
73 -
74 - xsrfCookieName: 'XSRF-TOKEN',
75 - xsrfHeaderName: 'X-XSRF-TOKEN',
76 -
77 - maxContentLength: -1,
78 -
79 - validateStatus: function validateStatus(status) {
80 - return status >= 200 && status < 300;
81 - }
82 -};
83 -
84 -defaults.headers = {
85 - common: {
86 - 'Accept': 'application/json, text/plain, */*'
87 - }
88 -};
89 -
90 -utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
91 - defaults.headers[method] = {};
92 -});
93 -
94 -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
95 - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
96 -});
97 -
98 -module.exports = defaults;
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -
5 -function encode(val) {
6 - return encodeURIComponent(val).
7 - replace(/%40/gi, '@').
8 - replace(/%3A/gi, ':').
9 - replace(/%24/g, '$').
10 - replace(/%2C/gi, ',').
11 - replace(/%20/g, '+').
12 - replace(/%5B/gi, '[').
13 - replace(/%5D/gi, ']');
14 -}
15 -
16 -/**
17 - * Build a URL by appending params to the end
18 - *
19 - * @param {string} url The base of the url (e.g., http://www.google.com)
20 - * @param {object} [params] The params to be appended
21 - * @returns {string} The formatted url
22 - */
23 -module.exports = function buildURL(url, params, paramsSerializer) {
24 - /*eslint no-param-reassign:0*/
25 - if (!params) {
26 - return url;
27 - }
28 -
29 - var serializedParams;
30 - if (paramsSerializer) {
31 - serializedParams = paramsSerializer(params);
32 - } else if (utils.isURLSearchParams(params)) {
33 - serializedParams = params.toString();
34 - } else {
35 - var parts = [];
36 -
37 - utils.forEach(params, function serialize(val, key) {
38 - if (val === null || typeof val === 'undefined') {
39 - return;
40 - }
41 -
42 - if (utils.isArray(val)) {
43 - key = key + '[]';
44 - } else {
45 - val = [val];
46 - }
47 -
48 - utils.forEach(val, function parseValue(v) {
49 - if (utils.isDate(v)) {
50 - v = v.toISOString();
51 - } else if (utils.isObject(v)) {
52 - v = JSON.stringify(v);
53 - }
54 - parts.push(encode(key) + '=' + encode(v));
55 - });
56 - });
57 -
58 - serializedParams = parts.join('&');
59 - }
60 -
61 - if (serializedParams) {
62 - var hashmarkIndex = url.indexOf('#');
63 - if (hashmarkIndex !== -1) {
64 - url = url.slice(0, hashmarkIndex);
65 - }
66 -
67 - url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
68 - }
69 -
70 - return url;
71 -};
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -
5 -module.exports = (
6 - utils.isStandardBrowserEnv() ?
7 -
8 - // Standard browser envs support document.cookie
9 - (function standardBrowserEnv() {
10 - return {
11 - write: function write(name, value, expires, path, domain, secure) {
12 - var cookie = [];
13 - cookie.push(name + '=' + encodeURIComponent(value));
14 -
15 - if (utils.isNumber(expires)) {
16 - cookie.push('expires=' + new Date(expires).toGMTString());
17 - }
18 -
19 - if (utils.isString(path)) {
20 - cookie.push('path=' + path);
21 - }
22 -
23 - if (utils.isString(domain)) {
24 - cookie.push('domain=' + domain);
25 - }
26 -
27 - if (secure === true) {
28 - cookie.push('secure');
29 - }
30 -
31 - document.cookie = cookie.join('; ');
32 - },
33 -
34 - read: function read(name) {
35 - var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
36 - return (match ? decodeURIComponent(match[3]) : null);
37 - },
38 -
39 - remove: function remove(name) {
40 - this.write(name, '', Date.now() - 86400000);
41 - }
42 - };
43 - })() :
44 -
45 - // Non standard browser env (web workers, react-native) lack needed support.
46 - (function nonStandardBrowserEnv() {
47 - return {
48 - write: function write() {},
49 - read: function read() { return null; },
50 - remove: function remove() {}
51 - };
52 - })()
53 -);
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -
5 -module.exports = (
6 - utils.isStandardBrowserEnv() ?
7 -
8 - // Standard browser envs have full support of the APIs needed to test
9 - // whether the request URL is of the same origin as current location.
10 - (function standardBrowserEnv() {
11 - var msie = /(msie|trident)/i.test(navigator.userAgent);
12 - var urlParsingNode = document.createElement('a');
13 - var originURL;
14 -
15 - /**
16 - * Parse a URL to discover it's components
17 - *
18 - * @param {String} url The URL to be parsed
19 - * @returns {Object}
20 - */
21 - function resolveURL(url) {
22 - var href = url;
23 -
24 - if (msie) {
25 - // IE needs attribute set twice to normalize properties
26 - urlParsingNode.setAttribute('href', href);
27 - href = urlParsingNode.href;
28 - }
29 -
30 - urlParsingNode.setAttribute('href', href);
31 -
32 - // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
33 - return {
34 - href: urlParsingNode.href,
35 - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
36 - host: urlParsingNode.host,
37 - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
38 - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
39 - hostname: urlParsingNode.hostname,
40 - port: urlParsingNode.port,
41 - pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
42 - urlParsingNode.pathname :
43 - '/' + urlParsingNode.pathname
44 - };
45 - }
46 -
47 - originURL = resolveURL(window.location.href);
48 -
49 - /**
50 - * Determine if a URL shares the same origin as the current location
51 - *
52 - * @param {String} requestURL The URL to test
53 - * @returns {boolean} True if URL shares the same origin, otherwise false
54 - */
55 - return function isURLSameOrigin(requestURL) {
56 - var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
57 - return (parsed.protocol === originURL.protocol &&
58 - parsed.host === originURL.host);
59 - };
60 - })() :
61 -
62 - // Non standard browser envs (web workers, react-native) lack needed support.
63 - (function nonStandardBrowserEnv() {
64 - return function isURLSameOrigin() {
65 - return true;
66 - };
67 - })()
68 -);
1 -'use strict';
2 -
3 -var utils = require('./../utils');
4 -
5 -// Headers whose duplicates are ignored by node
6 -// c.f. https://nodejs.org/api/http.html#http_message_headers
7 -var ignoreDuplicateOf = [
8 - 'age', 'authorization', 'content-length', 'content-type', 'etag',
9 - 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
10 - 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
11 - 'referer', 'retry-after', 'user-agent'
12 -];
13 -
14 -/**
15 - * Parse headers into an object
16 - *
17 - * ```
18 - * Date: Wed, 27 Aug 2014 08:58:49 GMT
19 - * Content-Type: application/json
20 - * Connection: keep-alive
21 - * Transfer-Encoding: chunked
22 - * ```
23 - *
24 - * @param {String} headers Headers needing to be parsed
25 - * @returns {Object} Headers parsed into an object
26 - */
27 -module.exports = function parseHeaders(headers) {
28 - var parsed = {};
29 - var key;
30 - var val;
31 - var i;
32 -
33 - if (!headers) { return parsed; }
34 -
35 - utils.forEach(headers.split('\n'), function parser(line) {
36 - i = line.indexOf(':');
37 - key = utils.trim(line.substr(0, i)).toLowerCase();
38 - val = utils.trim(line.substr(i + 1));
39 -
40 - if (key) {
41 - if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
42 - return;
43 - }
44 - if (key === 'set-cookie') {
45 - parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
46 - } else {
47 - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
48 - }
49 - }
50 - });
51 -
52 - return parsed;
53 -};
1 -'use strict';
2 -
3 -var bind = require('./helpers/bind');
4 -var isBuffer = require('is-buffer');
5 -
6 -/*global toString:true*/
7 -
8 -// utils is a library of generic helper functions non-specific to axios
9 -
10 -var toString = Object.prototype.toString;
11 -
12 -/**
13 - * Determine if a value is an Array
14 - *
15 - * @param {Object} val The value to test
16 - * @returns {boolean} True if value is an Array, otherwise false
17 - */
18 -function isArray(val) {
19 - return toString.call(val) === '[object Array]';
20 -}
21 -
22 -/**
23 - * Determine if a value is an ArrayBuffer
24 - *
25 - * @param {Object} val The value to test
26 - * @returns {boolean} True if value is an ArrayBuffer, otherwise false
27 - */
28 -function isArrayBuffer(val) {
29 - return toString.call(val) === '[object ArrayBuffer]';
30 -}
31 -
32 -/**
33 - * Determine if a value is a FormData
34 - *
35 - * @param {Object} val The value to test
36 - * @returns {boolean} True if value is an FormData, otherwise false
37 - */
38 -function isFormData(val) {
39 - return (typeof FormData !== 'undefined') && (val instanceof FormData);
40 -}
41 -
42 -/**
43 - * Determine if a value is a view on an ArrayBuffer
44 - *
45 - * @param {Object} val The value to test
46 - * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
47 - */
48 -function isArrayBufferView(val) {
49 - var result;
50 - if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
51 - result = ArrayBuffer.isView(val);
52 - } else {
53 - result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
54 - }
55 - return result;
56 -}
57 -
58 -/**
59 - * Determine if a value is a String
60 - *
61 - * @param {Object} val The value to test
62 - * @returns {boolean} True if value is a String, otherwise false
63 - */
64 -function isString(val) {
65 - return typeof val === 'string';
66 -}
67 -
68 -/**
69 - * Determine if a value is a Number
70 - *
71 - * @param {Object} val The value to test
72 - * @returns {boolean} True if value is a Number, otherwise false
73 - */
74 -function isNumber(val) {
75 - return typeof val === 'number';
76 -}
77 -
78 -/**
79 - * Determine if a value is undefined
80 - *
81 - * @param {Object} val The value to test
82 - * @returns {boolean} True if the value is undefined, otherwise false
83 - */
84 -function isUndefined(val) {
85 - return typeof val === 'undefined';
86 -}
87 -
88 -/**
89 - * Determine if a value is an Object
90 - *
91 - * @param {Object} val The value to test
92 - * @returns {boolean} True if value is an Object, otherwise false
93 - */
94 -function isObject(val) {
95 - return val !== null && typeof val === 'object';
96 -}
97 -
98 -/**
99 - * Determine if a value is a Date
100 - *
101 - * @param {Object} val The value to test
102 - * @returns {boolean} True if value is a Date, otherwise false
103 - */
104 -function isDate(val) {
105 - return toString.call(val) === '[object Date]';
106 -}
107 -
108 -/**
109 - * Determine if a value is a File
110 - *
111 - * @param {Object} val The value to test
112 - * @returns {boolean} True if value is a File, otherwise false
113 - */
114 -function isFile(val) {
115 - return toString.call(val) === '[object File]';
116 -}
117 -
118 -/**
119 - * Determine if a value is a Blob
120 - *
121 - * @param {Object} val The value to test
122 - * @returns {boolean} True if value is a Blob, otherwise false
123 - */
124 -function isBlob(val) {
125 - return toString.call(val) === '[object Blob]';
126 -}
127 -
128 -/**
129 - * Determine if a value is a Function
130 - *
131 - * @param {Object} val The value to test
132 - * @returns {boolean} True if value is a Function, otherwise false
133 - */
134 -function isFunction(val) {
135 - return toString.call(val) === '[object Function]';
136 -}
137 -
138 -/**
139 - * Determine if a value is a Stream
140 - *
141 - * @param {Object} val The value to test
142 - * @returns {boolean} True if value is a Stream, otherwise false
143 - */
144 -function isStream(val) {
145 - return isObject(val) && isFunction(val.pipe);
146 -}
147 -
148 -/**
149 - * Determine if a value is a URLSearchParams object
150 - *
151 - * @param {Object} val The value to test
152 - * @returns {boolean} True if value is a URLSearchParams object, otherwise false
153 - */
154 -function isURLSearchParams(val) {
155 - return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
156 -}
157 -
158 -/**
159 - * Trim excess whitespace off the beginning and end of a string
160 - *
161 - * @param {String} str The String to trim
162 - * @returns {String} The String freed of excess whitespace
163 - */
164 -function trim(str) {
165 - return str.replace(/^\s*/, '').replace(/\s*$/, '');
166 -}
167 -
168 -/**
169 - * Determine if we're running in a standard browser environment
170 - *
171 - * This allows axios to run in a web worker, and react-native.
172 - * Both environments support XMLHttpRequest, but not fully standard globals.
173 - *
174 - * web workers:
175 - * typeof window -> undefined
176 - * typeof document -> undefined
177 - *
178 - * react-native:
179 - * navigator.product -> 'ReactNative'
180 - * nativescript
181 - * navigator.product -> 'NativeScript' or 'NS'
182 - */
183 -function isStandardBrowserEnv() {
184 - if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
185 - navigator.product === 'NativeScript' ||
186 - navigator.product === 'NS')) {
187 - return false;
188 - }
189 - return (
190 - typeof window !== 'undefined' &&
191 - typeof document !== 'undefined'
192 - );
193 -}
194 -
195 -/**
196 - * Iterate over an Array or an Object invoking a function for each item.
197 - *
198 - * If `obj` is an Array callback will be called passing
199 - * the value, index, and complete array for each item.
200 - *
201 - * If 'obj' is an Object callback will be called passing
202 - * the value, key, and complete object for each property.
203 - *
204 - * @param {Object|Array} obj The object to iterate
205 - * @param {Function} fn The callback to invoke for each item
206 - */
207 -function forEach(obj, fn) {
208 - // Don't bother if no value provided
209 - if (obj === null || typeof obj === 'undefined') {
210 - return;
211 - }
212 -
213 - // Force an array if not already something iterable
214 - if (typeof obj !== 'object') {
215 - /*eslint no-param-reassign:0*/
216 - obj = [obj];
217 - }
218 -
219 - if (isArray(obj)) {
220 - // Iterate over array values
221 - for (var i = 0, l = obj.length; i < l; i++) {
222 - fn.call(null, obj[i], i, obj);
223 - }
224 - } else {
225 - // Iterate over object keys
226 - for (var key in obj) {
227 - if (Object.prototype.hasOwnProperty.call(obj, key)) {
228 - fn.call(null, obj[key], key, obj);
229 - }
230 - }
231 - }
232 -}
233 -
234 -/**
235 - * Accepts varargs expecting each argument to be an object, then
236 - * immutably merges the properties of each object and returns result.
237 - *
238 - * When multiple objects contain the same key the later object in
239 - * the arguments list will take precedence.
240 - *
241 - * Example:
242 - *
243 - * ```js
244 - * var result = merge({foo: 123}, {foo: 456});
245 - * console.log(result.foo); // outputs 456
246 - * ```
247 - *
248 - * @param {Object} obj1 Object to merge
249 - * @returns {Object} Result of all merge properties
250 - */
251 -function merge(/* obj1, obj2, obj3, ... */) {
252 - var result = {};
253 - function assignValue(val, key) {
254 - if (typeof result[key] === 'object' && typeof val === 'object') {
255 - result[key] = merge(result[key], val);
256 - } else {
257 - result[key] = val;
258 - }
259 - }
260 -
261 - for (var i = 0, l = arguments.length; i < l; i++) {
262 - forEach(arguments[i], assignValue);
263 - }
264 - return result;
265 -}
266 -
267 -/**
268 - * Function equal to merge with the difference being that no reference
269 - * to original objects is kept.
270 - *
271 - * @see merge
272 - * @param {Object} obj1 Object to merge
273 - * @returns {Object} Result of all merge properties
274 - */
275 -function deepMerge(/* obj1, obj2, obj3, ... */) {
276 - var result = {};
277 - function assignValue(val, key) {
278 - if (typeof result[key] === 'object' && typeof val === 'object') {
279 - result[key] = deepMerge(result[key], val);
280 - } else if (typeof val === 'object') {
281 - result[key] = deepMerge({}, val);
282 - } else {
283 - result[key] = val;
284 - }
285 - }
286 -
287 - for (var i = 0, l = arguments.length; i < l; i++) {
288 - forEach(arguments[i], assignValue);
289 - }
290 - return result;
291 -}
292 -
293 -/**
294 - * Extends object a by mutably adding to it the properties of object b.
295 - *
296 - * @param {Object} a The object to be extended
297 - * @param {Object} b The object to copy properties from
298 - * @param {Object} thisArg The object to bind function to
299 - * @return {Object} The resulting value of object a
300 - */
301 -function extend(a, b, thisArg) {
302 - forEach(b, function assignValue(val, key) {
303 - if (thisArg && typeof val === 'function') {
304 - a[key] = bind(val, thisArg);
305 - } else {
306 - a[key] = val;
307 - }
308 - });
309 - return a;
310 -}
311 -
312 -module.exports = {
313 - isArray: isArray,
314 - isArrayBuffer: isArrayBuffer,
315 - isBuffer: isBuffer,
316 - isFormData: isFormData,
317 - isArrayBufferView: isArrayBufferView,
318 - isString: isString,
319 - isNumber: isNumber,
320 - isObject: isObject,
321 - isUndefined: isUndefined,
322 - isDate: isDate,
323 - isFile: isFile,
324 - isBlob: isBlob,
325 - isFunction: isFunction,
326 - isStream: isStream,
327 - isURLSearchParams: isURLSearchParams,
328 - isStandardBrowserEnv: isStandardBrowserEnv,
329 - forEach: forEach,
330 - merge: merge,
331 - deepMerge: deepMerge,
332 - extend: extend,
333 - trim: trim
334 -};
1 -{
2 - "_from": "axios@^0.19.0",
3 - "_id": "axios@0.19.0",
4 - "_inBundle": false,
5 - "_integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
6 - "_location": "/axios",
7 - "_phantomChildren": {},
8 - "_requested": {
9 - "type": "range",
10 - "registry": true,
11 - "raw": "axios@^0.19.0",
12 - "name": "axios",
13 - "escapedName": "axios",
14 - "rawSpec": "^0.19.0",
15 - "saveSpec": null,
16 - "fetchSpec": "^0.19.0"
17 - },
18 - "_requiredBy": [
19 - "/@line/bot-sdk"
20 - ],
21 - "_resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
22 - "_shasum": "8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8",
23 - "_spec": "axios@^0.19.0",
24 - "_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\@line\\bot-sdk",
25 - "author": {
26 - "name": "Matt Zabriskie"
27 - },
28 - "browser": {
29 - "./lib/adapters/http.js": "./lib/adapters/xhr.js"
30 - },
31 - "bugs": {
32 - "url": "https://github.com/axios/axios/issues"
33 - },
34 - "bundleDependencies": false,
35 - "bundlesize": [
36 - {
37 - "path": "./dist/axios.min.js",
38 - "threshold": "5kB"
39 - }
40 - ],
41 - "dependencies": {
42 - "follow-redirects": "1.5.10",
43 - "is-buffer": "^2.0.2"
44 - },
45 - "deprecated": false,
46 - "description": "Promise based HTTP client for the browser and node.js",
47 - "devDependencies": {
48 - "bundlesize": "^0.17.0",
49 - "coveralls": "^3.0.0",
50 - "es6-promise": "^4.2.4",
51 - "grunt": "^1.0.2",
52 - "grunt-banner": "^0.6.0",
53 - "grunt-cli": "^1.2.0",
54 - "grunt-contrib-clean": "^1.1.0",
55 - "grunt-contrib-watch": "^1.0.0",
56 - "grunt-eslint": "^20.1.0",
57 - "grunt-karma": "^2.0.0",
58 - "grunt-mocha-test": "^0.13.3",
59 - "grunt-ts": "^6.0.0-beta.19",
60 - "grunt-webpack": "^1.0.18",
61 - "istanbul-instrumenter-loader": "^1.0.0",
62 - "jasmine-core": "^2.4.1",
63 - "karma": "^1.3.0",
64 - "karma-chrome-launcher": "^2.2.0",
65 - "karma-coverage": "^1.1.1",
66 - "karma-firefox-launcher": "^1.1.0",
67 - "karma-jasmine": "^1.1.1",
68 - "karma-jasmine-ajax": "^0.1.13",
69 - "karma-opera-launcher": "^1.0.0",
70 - "karma-safari-launcher": "^1.0.0",
71 - "karma-sauce-launcher": "^1.2.0",
72 - "karma-sinon": "^1.0.5",
73 - "karma-sourcemap-loader": "^0.3.7",
74 - "karma-webpack": "^1.7.0",
75 - "load-grunt-tasks": "^3.5.2",
76 - "minimist": "^1.2.0",
77 - "mocha": "^5.2.0",
78 - "sinon": "^4.5.0",
79 - "typescript": "^2.8.1",
80 - "url-search-params": "^0.10.0",
81 - "webpack": "^1.13.1",
82 - "webpack-dev-server": "^1.14.1"
83 - },
84 - "homepage": "https://github.com/axios/axios",
85 - "keywords": [
86 - "xhr",
87 - "http",
88 - "ajax",
89 - "promise",
90 - "node"
91 - ],
92 - "license": "MIT",
93 - "main": "index.js",
94 - "name": "axios",
95 - "repository": {
96 - "type": "git",
97 - "url": "git+https://github.com/axios/axios.git"
98 - },
99 - "scripts": {
100 - "build": "NODE_ENV=production grunt build",
101 - "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
102 - "examples": "node ./examples/server.js",
103 - "fix": "eslint --fix lib/**/*.js",
104 - "postversion": "git push && git push --tags",
105 - "preversion": "npm test",
106 - "start": "node ./sandbox/server.js",
107 - "test": "grunt test && bundlesize",
108 - "version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
109 - },
110 - "typings": "./index.d.ts",
111 - "version": "0.19.0"
112 -}
1 -# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
2 -
3 -[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg
4 -[travis-url]: https://travis-ci.org/feross/is-buffer
5 -[npm-image]: https://img.shields.io/npm/v/is-buffer.svg
6 -[npm-url]: https://npmjs.org/package/is-buffer
7 -[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg
8 -[downloads-url]: https://npmjs.org/package/is-buffer
9 -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
10 -[standard-url]: https://standardjs.com
11 -
12 -#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer))
13 -
14 -[![saucelabs][saucelabs-image]][saucelabs-url]
15 -
16 -[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg
17 -[saucelabs-url]: https://saucelabs.com/u/is-buffer
18 -
19 -## Why not use `Buffer.isBuffer`?
20 -
21 -This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)).
22 -
23 -It's future-proof and works in node too!
24 -
25 -## install
26 -
27 -```bash
28 -npm install is-buffer
29 -```
30 -
31 -[Get supported is-buffer with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-is-buffer?utm_source=npm-is-buffer&utm_medium=referral&utm_campaign=readme)
32 -
33 -## usage
34 -
35 -```js
36 -var isBuffer = require('is-buffer')
37 -
38 -isBuffer(new Buffer(4)) // true
39 -isBuffer(Buffer.alloc(4)) //true
40 -
41 -isBuffer(undefined) // false
42 -isBuffer(null) // false
43 -isBuffer('') // false
44 -isBuffer(true) // false
45 -isBuffer(false) // false
46 -isBuffer(0) // false
47 -isBuffer(1) // false
48 -isBuffer(1.0) // false
49 -isBuffer('string') // false
50 -isBuffer({}) // false
51 -isBuffer(function foo () {}) // false
52 -```
53 -
54 -## license
55 -
56 -MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org).
1 -declare function isBuffer(obj: any): boolean
2 -export = isBuffer
1 -/*!
2 - * Determine if an object is a Buffer
3 - *
4 - * @author Feross Aboukhadijeh <https://feross.org>
5 - * @license MIT
6 - */
7 -
8 -module.exports = function isBuffer (obj) {
9 - return obj != null && obj.constructor != null &&
10 - typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
11 -}
1 -{
2 - "_from": "is-buffer@^2.0.2",
3 - "_id": "is-buffer@2.0.4",
4 - "_inBundle": false,
5 - "_integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==",
6 - "_location": "/is-buffer",
7 - "_phantomChildren": {},
8 - "_requested": {
9 - "type": "range",
10 - "registry": true,
11 - "raw": "is-buffer@^2.0.2",
12 - "name": "is-buffer",
13 - "escapedName": "is-buffer",
14 - "rawSpec": "^2.0.2",
15 - "saveSpec": null,
16 - "fetchSpec": "^2.0.2"
17 - },
18 - "_requiredBy": [
19 - "/axios"
20 - ],
21 - "_resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
22 - "_shasum": "3e572f23c8411a5cfd9557c849e3665e0b290623",
23 - "_spec": "is-buffer@^2.0.2",
24 - "_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\axios",
25 - "author": {
26 - "name": "Feross Aboukhadijeh",
27 - "email": "feross@feross.org",
28 - "url": "https://feross.org"
29 - },
30 - "bugs": {
31 - "url": "https://github.com/feross/is-buffer/issues"
32 - },
33 - "bundleDependencies": false,
34 - "dependencies": {},
35 - "deprecated": false,
36 - "description": "Determine if an object is a Buffer",
37 - "devDependencies": {
38 - "airtap": "^2.0.3",
39 - "standard": "*",
40 - "tape": "^4.11.0"
41 - },
42 - "engines": {
43 - "node": ">=4"
44 - },
45 - "homepage": "https://github.com/feross/is-buffer#readme",
46 - "keywords": [
47 - "arraybuffer",
48 - "browser",
49 - "browser buffer",
50 - "browserify",
51 - "buffer",
52 - "buffers",
53 - "core buffer",
54 - "dataview",
55 - "float32array",
56 - "float64array",
57 - "int16array",
58 - "int32array",
59 - "type",
60 - "typed array",
61 - "uint32array"
62 - ],
63 - "license": "MIT",
64 - "main": "index.js",
65 - "name": "is-buffer",
66 - "repository": {
67 - "type": "git",
68 - "url": "git://github.com/feross/is-buffer.git"
69 - },
70 - "scripts": {
71 - "test": "standard && npm run test-node && npm run test-browser",
72 - "test-browser": "airtap -- test/*.js",
73 - "test-browser-local": "airtap --local -- test/*.js",
74 - "test-node": "tape test/*.js"
75 - },
76 - "version": "2.0.4"
77 -}
1 -{
2 - "name": "linebot",
3 - "version": "1.0.0",
4 - "lockfileVersion": 1,
5 - "requires": true,
6 - "dependencies": {
7 - "@line/bot-sdk": {
8 - "version": "6.8.3",
9 - "resolved": "https://registry.npmjs.org/@line/bot-sdk/-/bot-sdk-6.8.3.tgz",
10 - "integrity": "sha512-nj2T4CQxw0W/juAlpj0kMTDScOh5QUK6xMCR2dZp+pN8B0vj/c+5uX3TyGB4ijz/NIsehgfKujPgzw7LhtYtJw==",
11 - "requires": {
12 - "@types/body-parser": "^1.16.8",
13 - "@types/file-type": "^5.2.1",
14 - "@types/node": "^7.0.31",
15 - "axios": "^0.19.0",
16 - "body-parser": "^1.18.2",
17 - "file-type": "^7.2.0"
18 - }
19 - },
20 - "@types/body-parser": {
21 - "version": "1.17.1",
22 - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
23 - "integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
24 - "requires": {
25 - "@types/connect": "*",
26 - "@types/node": "*"
27 - }
28 - },
29 - "@types/connect": {
30 - "version": "3.4.32",
31 - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz",
32 - "integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==",
33 - "requires": {
34 - "@types/node": "*"
35 - }
36 - },
37 - "@types/file-type": {
38 - "version": "5.2.2",
39 - "resolved": "https://registry.npmjs.org/@types/file-type/-/file-type-5.2.2.tgz",
40 - "integrity": "sha512-GWtM4fyqfb+bec4ocpo51/y4x0b83Je+iA6eV131LT9wL0//G+1UgwbkMg7w61ceOwR+KkZXK00z44jrrNljWg==",
41 - "requires": {
42 - "@types/node": "*"
43 - }
44 - },
45 - "@types/node": {
46 - "version": "7.10.9",
47 - "resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.9.tgz",
48 - "integrity": "sha512-usSpgoUsRtO5xNV5YEPU8PPnHisFx8u0rokj1BPVn/hDF7zwUDzVLiuKZM38B7z8V2111Fj6kd4rGtQFUZpNOw=="
49 - },
50 - "accepts": {
51 - "version": "1.3.5",
52 - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
53 - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
54 - "requires": {
55 - "mime-types": "~2.1.18",
56 - "negotiator": "0.6.1"
57 - }
58 - },
59 - "array-flatten": {
60 - "version": "1.1.1",
61 - "resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
62 - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
63 - },
64 - "axios": {
65 - "version": "0.19.0",
66 - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
67 - "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
68 - "requires": {
69 - "follow-redirects": "1.5.10",
70 - "is-buffer": "^2.0.2"
71 - }
72 - },
73 - "body-parser": {
74 - "version": "1.18.3",
75 - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
76 - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
77 - "requires": {
78 - "bytes": "3.0.0",
79 - "content-type": "~1.0.4",
80 - "debug": "2.6.9",
81 - "depd": "~1.1.2",
82 - "http-errors": "~1.6.3",
83 - "iconv-lite": "0.4.23",
84 - "on-finished": "~2.3.0",
85 - "qs": "6.5.2",
86 - "raw-body": "2.3.3",
87 - "type-is": "~1.6.16"
88 - }
89 - },
90 - "bytes": {
91 - "version": "3.0.0",
92 - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
93 - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
94 - },
95 - "content-disposition": {
96 - "version": "0.5.2",
97 - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
98 - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
99 - },
100 - "content-type": {
101 - "version": "1.0.4",
102 - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
103 - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
104 - },
105 - "cookie": {
106 - "version": "0.3.1",
107 - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
108 - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
109 - },
110 - "cookie-signature": {
111 - "version": "1.0.6",
112 - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
113 - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
114 - },
115 - "debug": {
116 - "version": "2.6.9",
117 - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
118 - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
119 - "requires": {
120 - "ms": "2.0.0"
121 - }
122 - },
123 - "depd": {
124 - "version": "1.1.2",
125 - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
126 - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
127 - },
128 - "destroy": {
129 - "version": "1.0.4",
130 - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
131 - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
132 - },
133 - "ee-first": {
134 - "version": "1.1.1",
135 - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
136 - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
137 - },
138 - "encodeurl": {
139 - "version": "1.0.2",
140 - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
141 - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
142 - },
143 - "escape-html": {
144 - "version": "1.0.3",
145 - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
146 - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
147 - },
148 - "etag": {
149 - "version": "1.8.1",
150 - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
151 - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
152 - },
153 - "express": {
154 - "version": "4.16.4",
155 - "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz",
156 - "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==",
157 - "requires": {
158 - "accepts": "~1.3.5",
159 - "array-flatten": "1.1.1",
160 - "body-parser": "1.18.3",
161 - "content-disposition": "0.5.2",
162 - "content-type": "~1.0.4",
163 - "cookie": "0.3.1",
164 - "cookie-signature": "1.0.6",
165 - "debug": "2.6.9",
166 - "depd": "~1.1.2",
167 - "encodeurl": "~1.0.2",
168 - "escape-html": "~1.0.3",
169 - "etag": "~1.8.1",
170 - "finalhandler": "1.1.1",
171 - "fresh": "0.5.2",
172 - "merge-descriptors": "1.0.1",
173 - "methods": "~1.1.2",
174 - "on-finished": "~2.3.0",
175 - "parseurl": "~1.3.2",
176 - "path-to-regexp": "0.1.7",
177 - "proxy-addr": "~2.0.4",
178 - "qs": "6.5.2",
179 - "range-parser": "~1.2.0",
180 - "safe-buffer": "5.1.2",
181 - "send": "0.16.2",
182 - "serve-static": "1.13.2",
183 - "setprototypeof": "1.1.0",
184 - "statuses": "~1.4.0",
185 - "type-is": "~1.6.16",
186 - "utils-merge": "1.0.1",
187 - "vary": "~1.1.2"
188 - }
189 - },
190 - "file-type": {
191 - "version": "7.7.1",
192 - "resolved": "https://registry.npmjs.org/file-type/-/file-type-7.7.1.tgz",
193 - "integrity": "sha512-bTrKkzzZI6wH+NXhyD3SOXtb2zXTw2SbwI2RxUlRcXVsnN7jNL5hJzVQLYv7FOQhxFkK4XWdAflEaWFpaLLWpQ=="
194 - },
195 - "finalhandler": {
196 - "version": "1.1.1",
197 - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
198 - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
199 - "requires": {
200 - "debug": "2.6.9",
201 - "encodeurl": "~1.0.2",
202 - "escape-html": "~1.0.3",
203 - "on-finished": "~2.3.0",
204 - "parseurl": "~1.3.2",
205 - "statuses": "~1.4.0",
206 - "unpipe": "~1.0.0"
207 - }
208 - },
209 - "follow-redirects": {
210 - "version": "1.5.10",
211 - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
212 - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
213 - "requires": {
214 - "debug": "=3.1.0"
215 - },
216 - "dependencies": {
217 - "debug": {
218 - "version": "3.1.0",
219 - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
220 - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
221 - "requires": {
222 - "ms": "2.0.0"
223 - }
224 - }
225 - }
226 - },
227 - "forwarded": {
228 - "version": "0.1.2",
229 - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
230 - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
231 - },
232 - "fresh": {
233 - "version": "0.5.2",
234 - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
235 - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
236 - },
237 - "http-errors": {
238 - "version": "1.6.3",
239 - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
240 - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
241 - "requires": {
242 - "depd": "~1.1.2",
243 - "inherits": "2.0.3",
244 - "setprototypeof": "1.1.0",
245 - "statuses": ">= 1.4.0 < 2"
246 - }
247 - },
248 - "iconv-lite": {
249 - "version": "0.4.23",
250 - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
251 - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
252 - "requires": {
253 - "safer-buffer": ">= 2.1.2 < 3"
254 - }
255 - },
256 - "inherits": {
257 - "version": "2.0.3",
258 - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
259 - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
260 - },
261 - "ipaddr.js": {
262 - "version": "1.8.0",
263 - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
264 - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4="
265 - },
266 - "is-buffer": {
267 - "version": "2.0.4",
268 - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
269 - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
270 - },
271 - "media-typer": {
272 - "version": "0.3.0",
273 - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
274 - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
275 - },
276 - "merge-descriptors": {
277 - "version": "1.0.1",
278 - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
279 - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
280 - },
281 - "methods": {
282 - "version": "1.1.2",
283 - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
284 - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
285 - },
286 - "mime": {
287 - "version": "1.4.1",
288 - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
289 - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
290 - },
291 - "mime-db": {
292 - "version": "1.37.0",
293 - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
294 - "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg=="
295 - },
296 - "mime-types": {
297 - "version": "2.1.21",
298 - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
299 - "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
300 - "requires": {
301 - "mime-db": "~1.37.0"
302 - }
303 - },
304 - "ms": {
305 - "version": "2.0.0",
306 - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
307 - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
308 - },
309 - "negotiator": {
310 - "version": "0.6.1",
311 - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
312 - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
313 - },
314 - "on-finished": {
315 - "version": "2.3.0",
316 - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
317 - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
318 - "requires": {
319 - "ee-first": "1.1.1"
320 - }
321 - },
322 - "parseurl": {
323 - "version": "1.3.2",
324 - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
325 - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
326 - },
327 - "path-to-regexp": {
328 - "version": "0.1.7",
329 - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
330 - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
331 - },
332 - "proxy-addr": {
333 - "version": "2.0.4",
334 - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
335 - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==",
336 - "requires": {
337 - "forwarded": "~0.1.2",
338 - "ipaddr.js": "1.8.0"
339 - }
340 - },
341 - "qs": {
342 - "version": "6.5.2",
343 - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
344 - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
345 - },
346 - "range-parser": {
347 - "version": "1.2.0",
348 - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
349 - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
350 - },
351 - "raw-body": {
352 - "version": "2.3.3",
353 - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
354 - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
355 - "requires": {
356 - "bytes": "3.0.0",
357 - "http-errors": "1.6.3",
358 - "iconv-lite": "0.4.23",
359 - "unpipe": "1.0.0"
360 - }
361 - },
362 - "safe-buffer": {
363 - "version": "5.1.2",
364 - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
365 - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
366 - },
367 - "safer-buffer": {
368 - "version": "2.1.2",
369 - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
370 - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
371 - },
372 - "send": {
373 - "version": "0.16.2",
374 - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
375 - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
376 - "requires": {
377 - "debug": "2.6.9",
378 - "depd": "~1.1.2",
379 - "destroy": "~1.0.4",
380 - "encodeurl": "~1.0.2",
381 - "escape-html": "~1.0.3",
382 - "etag": "~1.8.1",
383 - "fresh": "0.5.2",
384 - "http-errors": "~1.6.2",
385 - "mime": "1.4.1",
386 - "ms": "2.0.0",
387 - "on-finished": "~2.3.0",
388 - "range-parser": "~1.2.0",
389 - "statuses": "~1.4.0"
390 - }
391 - },
392 - "serve-static": {
393 - "version": "1.13.2",
394 - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
395 - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
396 - "requires": {
397 - "encodeurl": "~1.0.2",
398 - "escape-html": "~1.0.3",
399 - "parseurl": "~1.3.2",
400 - "send": "0.16.2"
401 - }
402 - },
403 - "setprototypeof": {
404 - "version": "1.1.0",
405 - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
406 - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
407 - },
408 - "statuses": {
409 - "version": "1.4.0",
410 - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
411 - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
412 - },
413 - "type-is": {
414 - "version": "1.6.16",
415 - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
416 - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
417 - "requires": {
418 - "media-typer": "0.3.0",
419 - "mime-types": "~2.1.18"
420 - }
421 - },
422 - "unpipe": {
423 - "version": "1.0.0",
424 - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
425 - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
426 - },
427 - "utils-merge": {
428 - "version": "1.0.1",
429 - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
430 - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
431 - },
432 - "vary": {
433 - "version": "1.1.2",
434 - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
435 - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
436 - }
437 - }
438 -}
1 -{
2 - "name": "linebot",
3 - "version": "1.0.0",
4 - "description": "",
5 - "main": "app.js",
6 - "scripts": {
7 - "test": "echo \"Error: no test specified\" && exit 1",
8 - "start": "node server.js"
9 - },
10 - "author": "강수인",
11 - "license": "MIT",
12 - "dependencies": {
13 - "@line/bot-sdk": "^6.8.3",
14 - "express": "^4.16.4"
15 - }
16 -}