최한솔

modify files

Showing 59 changed files with 0 additions and 11462 deletions
const express = require('express');
const line = require('@line/bot-sdk');
const config = {
channelAccessToken: 'L+RJ15lZgeSoWgeHf9BqgEhm8lYh11qALzPlDV85VGXHfmiKqj3CX1V9DvqakFeJqwWgfQRejsUIWqf/kJuTLQcRC5ws2pyJJbr0VFEXptoYicgiRDzuA51W91dTcFL6/olvLNS1zAf1xO2wxpTGvQdB04t89/1O/w1cDnyilFU=',
channelSecret: 'e8e139b4cf31d22ed234d62a9b336e74'
};
const app = express();
<<<<<<< HEAD
app.post('/webhook', line.middleware(config), (req, res) => {
Promise
.all(req.body.events.map(handleEvent))
.then((result) => res.json(result));
});
const client = new line.Client(config);
function handleEvent(event) {
if (event.type !== 'message' || event.message.type !== 'text') {
return Promise.resolve(null);
}
return client.replyMessage(event.replyToken, {
type: 'text',
text: event.message.text
});
}
app.listen(3000);
/*
var express = require('express');
var app = express();
const line = require('@line/bot-sdk');
const config = {
channelAccessToken: 'L+RJ15lZgeSoWgeHf9BqgEhm8lYh11qALzPlDV85VGXHfmiKqj3CX1V9DvqakFeJqwWgfQRejsUIWqf/kJuTLQcRC5ws2pyJJbr0VFEXptoYicgiRDzuA51W91dTcFL6/olvLNS1zAf1xO2wxpTGvQdB04t89/1O/w1cDnyilFU=',
channelSecret: 'e8e139b4cf31d22ed234d62a9b336e74',
};
<<<<<<< HEAD
const app = express();
=======
>>>>>>> 5c3493c34733e95cc8b593c61c6fbeefcc069682
app.post('https://bots.dialogflow.com/line/d1584d25-0e52-48da-b6cc-20e021dc5e70/webhook', line.middleware(config), (req,res)=>{
promise
.all(req.body.events.map(handleEvent))
.then((result)=>res.json(result));
});
const clinet = new line.Client(config);
function handleEvent(event){
if(event.type !== 'message' || event.message.type != 'text'){
return Promise.resolve(null);
}
return client.replyMessage(event.replyToken,{
type:'text',
text: event.message.text
});
}
<<<<<<< HEAD
=======
// create LINE SDK client
const client = new line.Client(config);
// create Express app
// about Express itself: https://expressjs.com/
// register a webhook handler with middleware
// about the middleware, please refer to doc
app.post('https://mylinebottest1.herokuapp.com/callback', line.middleware(config), (req, res) => {
Promise
.all(req.body.events.map(handleEvent))
.then((result) => res.json(result))
.catch((err) => { //error handling
console.error(err);
res.status(200).end();
});
});
// event handler
function handleEvent(event) {
if (event.type !== 'message' || event.message.type !== 'text') {
// ignore non-text-message event
return Promise.resolve(null);
}
return new Promise(function (resolve, reject) {
//내가 짠 것
function getup(shour, smin, ampm) {//몇시에 자려고 할 때 언제 일어나면 좋을지
if (shour != '(hour)' && smin != '(minute)') {
//; //탈출
var setTime = new Date();
if (shour == 12) {
shour = 0;
}
if (ampm == "AM") {
setTime.setHours(shour);
}
else if (ampm == "PM") {
setTime.setHours(shour + 12);
}
setTime.setMinutes(smin);
var gres1 = new Date(setTime.getTime() - 270 * 60000);
var gres2 = new Date(res1.getTime() - 90 * 60000);
var gres3 = new Date(res2.getTime() - 90 * 60000);
var gres4 = new Date(res3.getTime() - 90 * 60000);
function retDate(dateObj) {
var formatted = '';
var pm = false;
if (dateObj.getHours() > 12) {
formatted = dateObj.getHours() - 12;
pm = true;
}
else if (dateObj.getHours() < 12 && dateObj.getHours() != 0) {
formatted = dateObj.getHours();
}
else if (dateObj.getHours() == 0) {
formatted = "12";
}
else if (dateObj.getHours() == 12) {
formatted = "12";
pm = true;
}
if (dateObj.getMinutes() < 10) {
formatted = formatted + ":0" + dateObj.getMinutes();
}
else {
formatted = formatted + ":" + dateObj.getMinutes();
}
if (pm == true) {
formatted = formatted + " PM";
}
else {
formatted = formatted + " AM";
}
return formatted;
}
console.log(String(retDate(gres1)));
console.log(String(retDate(gres2)));
console.log(String(retDate(gres3)));
console.log(String(retDate(gres4)));
$('#results').fadeIn();
$('#feedback').fadeIn();
$('#ad').fadeIn();
} // end hour/minute check if
else {
alert("Please select an hour and a minute before trying to calculate!");
} // end not-filled check
};// end calculate
})};
function sleep(ghour, gmin, ampm) { //몇시에 일어나려고 할 때 언제 자면 좋을지
//$('#start').hide();
var zDate = new Date();
var sres1 = new Date(zDate.getTime() + 104*60000);
var sres2 = new Date(res1.getTime() + 90*60000);
var sres3 = new Date(res2.getTime() + 90*60000);
var sres4 = new Date(res3.getTime() + 90*60000);
var sres5 = new Date(res4.getTime() + 90*60000);
var sres6 = new Date(res5.getTime() + 90*60000);
function retDate(dateObj) {
var formatted = '';
var pm = false;
if(dateObj.getHours() > 12) {
formatted = dateObj.getHours() - 12;
pm = true;
} else if(dateObj.getHours() < 12 && dateObj.getHours() != 0) {
formatted = dateObj.getHours();
} else if(dateObj.getHours() == 0) {
formatted = "12";
} else if(dateObj.getHours() == 12) {
formatted = "12";
pm = true;
}
if(dateObj.getMinutes() < 10) {
formatted = formatted + ":0" + dateObj.getMinutes();
} else {
formatted = formatted + ":" + dateObj.getMinutes();
}
if(pm == true) {
formatted = formatted + " PM";
} else {
formatted = formatted + " AM";
}
return formatted;
}
console.log(String(retDate(sres1)));
console.log(String(retDate(sres2)));
console.log(String(retDate(sres3)));
console.log(String(retDate(sres4)));
console.log(String(retDate(sres5)));
console.log(String(retDate(sres6)));
$('#resultsNow').fadeIn();
$('#feedback').fadeIn();
$('#ad').fadeIn();
};
*/
/*
//sleep 함수
console.log("You should try to fall asleep at one of the following times: ");
"sres1" title="Six Cycles: Nine Hours of Sleep"
or
"sres2" title="Five Cycles: Seven and a half Hours of Sleep"
or
"sres3" title="Four Cycles: Six Hours of Sleep"
or
"sres4" title="Three Cycles: Four and a half Hours of Sleep">
console.log("Please keep in mind that you should be falling asleep at these times.");
console.log("The average human takes fourteen minutes to fall asleep, so plan accordingly!");
console.log("꿀잠봇 works by counting backwards in sleep cycles.");
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!");
console.log("A good night's sleep consists of 5-6 complete sleep cycles.");
//getup 함수
console.log("If you head to bed right now, you should try to wake up at one of the following times:");
"gres1" title="One Cycle: One and a half Hours of Sleep"
or
"gres2" title="Two Cycles: Three Hours of Sleep"
or
"gres3" title="Three Cycles: Four and a half Hours of Sleep"
or
"gres4" title="Four Cycles: Six Hours of Sleep"
or
"gres5" title="Five Cycles: Seven and a half Hours of Sleep"
or
"gres6" title="Six Cycles: Nine Hours of Sleep"
console.log("Please keep in mind that you should try to wake up at one of these times.");
console.log("The average human takes fourteen minutes to fall asleep, so plan accordingly!");
console.log("꿀잠봇 works by counting backwards in sleep cycles.");
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!");
console.log("A good night's sleep consists of 5-6 complete sleep cycles.");
*/
/*
//언어 감지 option
var detect_options = {
url : languagedetect_api_url,
form : {'query': event.message.text},
headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret}
};
//papago 언어 감지
request.post(detect_options,function(error,response,body){
console.log(response.statusCode);
if(!error && response.statusCode == 200){
var detect_body = JSON.parse(response.body);
var source = '';
var target = '';
var result = { type: 'text', text:''};
//언어 감지가 제대로 됐는지 확인
console.log(detect_body.langCode);
//번역은 한국어->영어 / 영어->한국어만 지원
if(detect_body.langCode == 'ko'||detect_body.langCode == 'en'){
source = detect_body.langCode == 'ko' ? 'ko':'en';
target = source == 'ko' ? 'en':'ko';
//papago 번역 option
var options = {
url: translate_api_url,
// 한국어(source : ko), 영어(target: en), 카톡에서 받는 메시지(text)
form: {'source':source, 'target':target, 'text':event.message.text},
headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret}
};
// Naver Post API
request.post(options, function(error, response, body){
// Translate API Sucess
if(!error && response.statusCode == 200){
// JSON
var objBody = JSON.parse(response.body);
// Message 잘 찍히는지 확인
result.text = objBody.message.result.translatedText;
console.log(result.text);
//번역된 문장 보내기
client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
}
});
}
// 메시지의 언어가 영어 또는 한국어가 아닐 경우
else{
result.text = '언어를 감지할 수 없습니다. \n 번역 언어는 한글 또는 영어만 가능합니다.';
client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
}
}
});
*/
>>>>>>> heroku
=======
>>>>>>> 5c3493c34733e95cc8b593c61c6fbeefcc069682
app.listen(3000, function () {
console.log('Linebot listening on port 3000!');
});
## 6.8.3 (05 Nov 2019)
### Bug fix
* Add exception handler in middleware (#153)
### Feature
* Flex Message Update 1 (#173)
* Support friend statistics API (#161)
### Misc
* Update dependencies (#174)
## 6.8.2 (08 Aug 2019)
### Bug fix
* Fix LINEThings Scenario Execution Event Types (#158)
## 6.8.1 (29 Jul 2019)
### Bug fix
* Fix a type wrong in Template Message (#163)
### Feature
* Get `X-LINE-Request-Id` by using `responseData['x-line-request-id']` (#151 #157)
## 6.8.0 (25 Jun 2019)
### Feature
* Add new parameter in push/reply/multicast/broadcast API to catch up the newest bot API (#147)
* Add new APIs in bot API (#147)
- Get the target limit for additional messages
- Get number of messages sent this month
- Get number of sent broadcast messages
- Send broadcast message
### Breaking changes
* Deprecate Node 6 and start to support Node 12 (#139)
* Remove polyfills for Node 6 (#149)
### Type
* Add LINE Things Event (#150)
### Misc
* Update axios and other dependencies by running `npm audit fix` to fix vulnerabilities. (#148 #154)
## 6.7.0 (18 Apr 2019)
### Feature
* Add alt URL field to URI action (#135)
* Implement (un)linkRichMenuToMultipleUsers (#135)
### Type
* Fix typo in a type (#124)
## 6.6.0 (4 Mar 2019)
### Feature
* Add DeviceLinkEvent / DeviceUnlinkEvent (#123)
### Type
* Fix FlexSpacer to have optional 'size' property (#122)
### Misc
* Run `npm audit fix` to fix minor dependency vulnerability.
## 6.5.0 (16 Feb 2019)
### Feature
* Add APIs to get number of sent messages (#116)
* Add account link event (#117)
### Misc
* Fix a typo in doc (#119)
## 6.4.0 (19 Nov 2018)
### Feature
* Add `getLinkToken` API (#96)
* Handle `req.rawBody` in Google Cloud Functions (#101)
* [Kitchensink] Add ngrok functionality (#99)
### Type
* Add types for video in imagemap message (#100)
* Add `contentProvider` fields to content messages (#103)
* Add `destination` field to webhook request body (#102)
* Add `MemberJoinEvent` and `MemberLeaveEvent` types (#107)
### Misc
* Don't include doc in released source
* Upgrade TypeScript to 3.1.6 (#94)
* Refactoring (#94, #98, #99)
* Remove webhook-tester tool
## 6.3.0 (21 Sep 2018)
### Feature
* Add default rich menu APIs (#87)
### Type
* Add missing `defaultAction` field to `TemplateColumn`
### Misc
* Use VuePress as documentation engine (#85)
* Upgrade minimum supported Node.js version to 6
## 6.2.1 (16 Aug 2018)
### Misc
* Remove gitbook-cli from dev dependencies
## 6.2.0 (15 Aug 2018)
#### Type
* Add QuickReply types (#83)
* Format type comments
#### Misc
* Upgrade TypeScript to 3
## 6.1.1 (14 Aug 2018)
#### Type
* Update FlexMessage types (#81)
#### Misc
* Add test coverage (#78)
* Add JSDoc comments (#80)
## 6.1.0 (19 June 2018)
#### Type
* Add types for flex message (#74)
* Simplify type definition for `Action`
## 6.0.3 (18 June 2018)
#### Misc
* Move get-audio-duration dep to proper package.json (#73)
* Vulnerability fix with `npm audit fix`
## 6.0.2 (21 May 2018)
#### Type
* Add missing `displayText` field to postback action (#63)
* Add missing `FileEventMessage` to `EventMessage` (#71)
#### Misc
* Add audio duration lib to kitchensink example (#68)
## 6.0.1 (13 Mar 2018)
#### Type
* Fix misimplemented 'AudioMessage' type (#61)
## 6.0.0 (27 Feb 2018)
#### Major
* Fix misimplemented 'unlinkRichMenuFromUser' API
#### Type
* Fix TemplateColumn type definition (#48)
#### Misc
* Update GitHub issue template (#43)
* Add Code of Conduct (#50)
* Catch errors properly in examples (#52)
## 5.2.0 (11 Dec 2017)
#### Minor
* Set Content-Length manually for postBinary (#42)
## 5.1.0 (7 Dec 2017)
#### Minor
* Add new fields (#39)
#### Misc
* Fix Windows build (#38)
* Add start scripts and webhook info to examples
## 5.0.1 (14 Nov 2017)
#### Minor
* Fix typo in `ImageMapMessage` type
* Add kitchensink example (#36)
## 5.0.0 (2 Nov 2017)
#### Major
* Implement rich menu API (#34)
#### Type
* Rename `ImageMapArea` and `TemplateAction`s into general ones
#### Misc
* Do not enforce `checkJSON` for some APIs where it means nothing
* Change how to check request object in test cases
## 4.0.0 (25 Oct 2017)
#### Major
* Make index script export exceptions and types (#31)
#### Type
* Simplify config types for client and middleware (#31)
#### Misc
* Fix information and links in doc
* Use Prettier instead of TSLint (#30)
* Install git hooks for precommit and prepush (#30)
## 3.1.1 (19 Sep 2017)
#### Type
* Fix type of postback.params
## 3.1.0 (19 Sep 2017)
#### Major
* Make middleware return `SignatureValidationFailed` for no signature (#26)
#### Type
* Add `FileEventMessage` type
## 3.0.0 (8 Sep 2017)
#### Major
* Implement "Get group/room member profile" API (#15)
* Implement "Get group/room member IDs" API (#23)
* `getMessageContent` now returns `Promise<ReadableStream>` (#20)
#### Type
* Add "datetimepicker" support (#21)
* Fix typo in `TemplateURIAction` type (#21)
#### Misc
* Package updates and corresponding fixes
* Use npm 5 instead of Yarn in dev
* Fix `clean` script to work in Windows
* Use "axios" for internal HTTP client instead of "got" (#20)
## 2.0.0 (12 June 2017)
#### Type
* Use literal types for 'type' fields
#### Misc
* Update yarn.lock with the latest Yarn
## 1.1.0 (31 May 2017)
* Handle pre-parsed body (string and buffer only)
#### Type
* Separate config type into client and middleware types
* Add `userId` to group and room event sources
#### Misc
* Create issue template (#4)
## 1.0.0 (11 May 2017)
* Initial release
# LINE Messaging API SDK for nodejs
[![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs)
[![npmjs](https://badge.fury.io/js/%40line%2Fbot-sdk.svg)](https://www.npmjs.com/package/@line/bot-sdk)
## Introduction
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.
## Documentation
See the official API documentation for more information
- English: https://developers.line.biz/en/docs/messaging-api/overview/
- Japanese: https://developers.line.biz/ja/docs/messaging-api/overview/
line-bot-sdk-nodejs documentation: https://line.github.io/line-bot-sdk-nodejs/#getting-started
## Requirements
* **Node.js** 8 or higher
## Installation
Using [npm](https://www.npmjs.com/):
``` bash
$ npm install @line/bot-sdk --save
```
## Help and media
FAQ: https://developers.line.biz/en/faq/
Community Q&A: https://www.line-community.me/questions
News: https://developers.line.biz/en/news/
Twitter: @LINE_DEV
## Versioning
This project respects semantic versioning
See http://semver.org/
## Contributing
Please check [CONTRIBUTING](CONTRIBUTING.md) before making a contribution.
## License
```
Copyright (C) 2016 LINE Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
/// <reference types="node" />
import { Readable } from "stream";
import * as Types from "./types";
export default class Client {
config: Types.ClientConfig;
private http;
constructor(config: Types.ClientConfig);
private parseHTTPResponse;
pushMessage(to: string, messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
replyMessage(replyToken: string, messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
multicast(to: string[], messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
broadcast(messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
getProfile(userId: string): Promise<Types.Profile>;
private getChatMemberProfile;
getGroupMemberProfile(groupId: string, userId: string): Promise<Types.Profile>;
getRoomMemberProfile(roomId: string, userId: string): Promise<Types.Profile>;
private getChatMemberIds;
getGroupMemberIds(groupId: string): Promise<string[]>;
getRoomMemberIds(roomId: string): Promise<string[]>;
getMessageContent(messageId: string): Promise<Readable>;
private leaveChat;
leaveGroup(groupId: string): Promise<any>;
leaveRoom(roomId: string): Promise<any>;
getRichMenu(richMenuId: string): Promise<Types.RichMenuResponse>;
createRichMenu(richMenu: Types.RichMenu): Promise<string>;
deleteRichMenu(richMenuId: string): Promise<any>;
getRichMenuIdOfUser(userId: string): Promise<string>;
linkRichMenuToUser(userId: string, richMenuId: string): Promise<any>;
unlinkRichMenuFromUser(userId: string): Promise<any>;
linkRichMenuToMultipleUsers(richMenuId: string, userIds: string[]): Promise<any>;
unlinkRichMenusFromMultipleUsers(userIds: string[]): Promise<any>;
getRichMenuImage(richMenuId: string): Promise<Readable>;
setRichMenuImage(richMenuId: string, data: Buffer | Readable, contentType?: string): Promise<any>;
getRichMenuList(): Promise<Array<Types.RichMenuResponse>>;
setDefaultRichMenu(richMenuId: string): Promise<{}>;
getDefaultRichMenuId(): Promise<string>;
deleteDefaultRichMenu(): Promise<{}>;
getLinkToken(userId: string): Promise<string>;
getNumberOfSentReplyMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
getNumberOfSentPushMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
getNumberOfSentMulticastMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
getTargetLimitForAdditionalMessages(): Promise<Types.TargetLimitForAdditionalMessages>;
getNumberOfMessagesSentThisMonth(): Promise<Types.NumberOfMessagesSentThisMonth>;
getNumberOfSentBroadcastMessages(date: string): Promise<Types.NumberOfMessagesSentResponse>;
getNumberOfMessageDeliveries(date: string): Promise<Types.NumberOfMessageDeliveriesResponse>;
getNumberOfFollowers(date: string): Promise<Types.NumberOfFollowersResponse>;
getFriendDemographics(): Promise<Types.FriendDemoGraphics>;
}
export declare class OAuth {
private http;
constructor();
issueAccessToken(client_id: string, client_secret: string): Promise<{
access_token: string;
expires_in: number;
token_type: "Bearer";
}>;
revokeAccessToken(access_token: string): Promise<{}>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http_1 = require("./http");
const Types = require("./types");
const exceptions_1 = require("./exceptions");
function toArray(maybeArr) {
return Array.isArray(maybeArr) ? maybeArr : [maybeArr];
}
function ensureJSON(raw) {
if (typeof raw === "object") {
return raw;
}
else {
throw new exceptions_1.JSONParseError("Failed to parse response body as JSON", raw);
}
}
const API_HOST = process.env.API_BASE_URL || "https://api.line.me/v2/";
const BOT_BASE_URL = process.env.API_BASE_URL || `${API_HOST}bot/`;
const OAUTH_BASE_URL = `${API_HOST}oauth/`;
class Client {
constructor(config) {
if (!config.channelAccessToken) {
throw new Error("no channel access token");
}
this.config = config;
this.http = new http_1.default({
baseURL: BOT_BASE_URL,
defaultHeaders: {
Authorization: "Bearer " + this.config.channelAccessToken,
},
responseParser: this.parseHTTPResponse.bind(this),
});
}
parseHTTPResponse(response) {
const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types;
let resBody = Object.assign({}, response.data);
if (response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME]) {
resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] =
response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME];
}
return resBody;
}
pushMessage(to, messages, notificationDisabled = false) {
return this.http.post("/message/push", {
messages: toArray(messages),
to,
notificationDisabled,
});
}
replyMessage(replyToken, messages, notificationDisabled = false) {
return this.http.post("/message/reply", {
messages: toArray(messages),
replyToken,
notificationDisabled,
});
}
async multicast(to, messages, notificationDisabled = false) {
return this.http.post("/message/multicast", {
messages: toArray(messages),
to,
notificationDisabled,
});
}
async broadcast(messages, notificationDisabled = false) {
return this.http.post("/message/broadcast", {
messages: toArray(messages),
notificationDisabled,
});
}
async getProfile(userId) {
const profile = await this.http.get(`/profile/${userId}`);
return ensureJSON(profile);
}
async getChatMemberProfile(chatType, chatId, userId) {
const profile = await this.http.get(`/${chatType}/${chatId}/member/${userId}`);
return ensureJSON(profile);
}
async getGroupMemberProfile(groupId, userId) {
return this.getChatMemberProfile("group", groupId, userId);
}
async getRoomMemberProfile(roomId, userId) {
return this.getChatMemberProfile("room", roomId, userId);
}
async getChatMemberIds(chatType, chatId) {
let memberIds = [];
let start;
do {
const res = await this.http.get(`/${chatType}/${chatId}/members/ids`, start ? { start } : null);
ensureJSON(res);
memberIds = memberIds.concat(res.memberIds);
start = res.next;
} while (start);
return memberIds;
}
async getGroupMemberIds(groupId) {
return this.getChatMemberIds("group", groupId);
}
async getRoomMemberIds(roomId) {
return this.getChatMemberIds("room", roomId);
}
async getMessageContent(messageId) {
return this.http.getStream(`/message/${messageId}/content`);
}
leaveChat(chatType, chatId) {
return this.http.post(`/${chatType}/${chatId}/leave`);
}
async leaveGroup(groupId) {
return this.leaveChat("group", groupId);
}
async leaveRoom(roomId) {
return this.leaveChat("room", roomId);
}
async getRichMenu(richMenuId) {
const res = await this.http.get(`/richmenu/${richMenuId}`);
return ensureJSON(res);
}
async createRichMenu(richMenu) {
const res = await this.http.post("/richmenu", richMenu);
return ensureJSON(res).richMenuId;
}
async deleteRichMenu(richMenuId) {
return this.http.delete(`/richmenu/${richMenuId}`);
}
async getRichMenuIdOfUser(userId) {
const res = await this.http.get(`/user/${userId}/richmenu`);
return ensureJSON(res).richMenuId;
}
async linkRichMenuToUser(userId, richMenuId) {
return this.http.post(`/user/${userId}/richmenu/${richMenuId}`);
}
async unlinkRichMenuFromUser(userId) {
return this.http.delete(`/user/${userId}/richmenu`);
}
async linkRichMenuToMultipleUsers(richMenuId, userIds) {
return this.http.post("/richmenu/bulk/link", {
richMenuId,
userIds,
});
}
async unlinkRichMenusFromMultipleUsers(userIds) {
return this.http.post("/richmenu/bulk/unlink", {
userIds,
});
}
async getRichMenuImage(richMenuId) {
return this.http.getStream(`/richmenu/${richMenuId}/content`);
}
async setRichMenuImage(richMenuId, data, contentType) {
return this.http.postBinary(`/richmenu/${richMenuId}/content`, data, contentType);
}
async getRichMenuList() {
const res = await this.http.get(`/richmenu/list`);
return ensureJSON(res).richmenus;
}
async setDefaultRichMenu(richMenuId) {
return this.http.post(`/user/all/richmenu/${richMenuId}`);
}
async getDefaultRichMenuId() {
const res = await this.http.get("/user/all/richmenu");
return ensureJSON(res).richMenuId;
}
async deleteDefaultRichMenu() {
return this.http.delete("/user/all/richmenu");
}
async getLinkToken(userId) {
const res = await this.http.post(`/user/${userId}/linkToken`);
return ensureJSON(res).linkToken;
}
async getNumberOfSentReplyMessages(date) {
const res = await this.http.get(`/message/delivery/reply?date=${date}`);
return ensureJSON(res);
}
async getNumberOfSentPushMessages(date) {
const res = await this.http.get(`/message/delivery/push?date=${date}`);
return ensureJSON(res);
}
async getNumberOfSentMulticastMessages(date) {
const res = await this.http.get(`/message/delivery/multicast?date=${date}`);
return ensureJSON(res);
}
async getTargetLimitForAdditionalMessages() {
const res = await this.http.get("/message/quota");
return ensureJSON(res);
}
async getNumberOfMessagesSentThisMonth() {
const res = await this.http.get("/message/quota/consumption");
return ensureJSON(res);
}
async getNumberOfSentBroadcastMessages(date) {
const res = await this.http.get(`/message/delivery/broadcast?date=${date}`);
return ensureJSON(res);
}
async getNumberOfMessageDeliveries(date) {
const res = await this.http.get(`/insight/message/delivery?date=${date}`);
return ensureJSON(res);
}
async getNumberOfFollowers(date) {
const res = await this.http.get(`/insight/followers?date=${date}`);
return ensureJSON(res);
}
async getFriendDemographics() {
const res = await this.http.get(`/insight/demographic`);
return ensureJSON(res);
}
}
exports.default = Client;
class OAuth {
constructor() {
this.http = new http_1.default({
baseURL: OAUTH_BASE_URL,
});
}
issueAccessToken(client_id, client_secret) {
return this.http.postForm("/accessToken", {
grant_type: "client_credentials",
client_id,
client_secret,
});
}
revokeAccessToken(access_token) {
return this.http.postForm("/revoke", { access_token });
}
}
exports.OAuth = OAuth;
/// <reference types="node" />
import { AxiosResponse } from "axios";
import { Readable } from "stream";
declare type httpClientConfig = {
baseURL?: string;
defaultHeaders?: any;
responseParser?: <T>(res: AxiosResponse) => T;
};
export default class HTTPClient {
private instance;
private config;
constructor(config?: httpClientConfig);
get<T>(url: string, params?: any): Promise<T>;
getStream(url: string, params?: any): Promise<Readable>;
post<T>(url: string, body?: any): Promise<T>;
postForm<T>(url: string, body?: any): Promise<T>;
postBinary<T>(url: string, data: Buffer | Readable, contentType?: string): Promise<T>;
delete<T>(url: string, params?: any): Promise<T>;
private wrapError;
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = require("axios");
const stream_1 = require("stream");
const exceptions_1 = require("./exceptions");
const fileType = require("file-type");
const qs = require("querystring");
const pkg = require("../package.json");
class HTTPClient {
constructor(config = {}) {
this.config = config;
const { baseURL, defaultHeaders } = config;
this.instance = axios_1.default.create({
baseURL,
headers: Object.assign({}, defaultHeaders, {
"User-Agent": `${pkg.name}/${pkg.version}`,
}),
});
this.instance.interceptors.response.use(res => res, err => Promise.reject(this.wrapError(err)));
}
async get(url, params) {
const res = await this.instance.get(url, { params });
return res.data;
}
async getStream(url, params) {
const res = await this.instance.get(url, {
params,
responseType: "stream",
});
return res.data;
}
async post(url, body) {
const res = await this.instance.post(url, body, {
headers: { "Content-Type": "application/json" },
});
const { responseParser } = this.config;
if (responseParser)
return responseParser(res);
else
return res.data;
}
async postForm(url, body) {
const res = await this.instance.post(url, qs.stringify(body), {
headers: { "Content-Type": "application/x-www-form-urlencoded" },
});
return res.data;
}
async postBinary(url, data, contentType) {
const buffer = await (async () => {
if (Buffer.isBuffer(data)) {
return data;
}
else if (data instanceof stream_1.Readable) {
return new Promise((resolve, reject) => {
const buffers = [];
let size = 0;
data.on("data", (chunk) => {
buffers.push(chunk);
size += chunk.length;
});
data.on("end", () => resolve(Buffer.concat(buffers, size)));
data.on("error", reject);
});
}
else {
throw new Error("invalid data type for postBinary");
}
})();
const res = await this.instance.post(url, buffer, {
headers: {
"Content-Type": contentType || fileType(buffer).mime,
"Content-Length": buffer.length,
},
});
return res.data;
}
async delete(url, params) {
const res = await this.instance.delete(url, { params });
return res.data;
}
wrapError(err) {
if (err.response) {
return new exceptions_1.HTTPError(err.message, err.response.status, err.response.statusText, err);
}
else if (err.code) {
return new exceptions_1.RequestError(err.message, err.code, err);
}
else if (err.config) {
// unknown, but from axios
return new exceptions_1.ReadError(err);
}
// otherwise, just rethrow
return err;
}
}
exports.default = HTTPClient;
import Client, { OAuth } from "./client";
import middleware from "./middleware";
import validateSignature from "./validate-signature";
export { Client, middleware, validateSignature, OAuth };
export * from "./exceptions";
export * from "./types";
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
const client_1 = require("./client");
exports.Client = client_1.default;
exports.OAuth = client_1.OAuth;
const middleware_1 = require("./middleware");
exports.middleware = middleware_1.default;
const validate_signature_1 = require("./validate-signature");
exports.validateSignature = validate_signature_1.default;
// re-export exceptions and types
__export(require("./exceptions"));
__export(require("./types"));
/// <reference types="node" />
import * as http from "http";
import * as Types from "./types";
export declare type Request = http.IncomingMessage & {
body: any;
};
export declare type Response = http.ServerResponse;
export declare type NextCallback = (err?: Error) => void;
export declare type Middleware = (req: Request, res: Response, next: NextCallback) => void | Promise<void>;
export default function middleware(config: Types.MiddlewareConfig): Middleware;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const body_parser_1 = require("body-parser");
const exceptions_1 = require("./exceptions");
const validate_signature_1 = require("./validate-signature");
function isValidBody(body) {
return (body && typeof body === "string") || Buffer.isBuffer(body);
}
function middleware(config) {
if (!config.channelSecret) {
throw new Error("no channel secret");
}
const secret = config.channelSecret;
const _middleware = async (req, res, next) => {
// header names are lower-cased
// https://nodejs.org/api/http.html#http_message_headers
const signature = req.headers["x-line-signature"];
if (!signature) {
next(new exceptions_1.SignatureValidationFailed("no signature"));
return;
}
const body = await (async () => {
if (isValidBody(req.rawBody)) {
// rawBody is provided in Google Cloud Functions and others
return req.rawBody;
}
else if (isValidBody(req.body)) {
return req.body;
}
else {
// body may not be parsed yet, parse it to a buffer
return new Promise((resolve, reject) => body_parser_1.raw({ type: "*/*" })(req, res, (error) => error ? reject(error) : resolve(req.body)));
}
})();
if (!validate_signature_1.default(body, secret, signature)) {
next(new exceptions_1.SignatureValidationFailed("signature validation failed", signature));
return;
}
const strBody = Buffer.isBuffer(body) ? body.toString() : body;
try {
req.body = JSON.parse(strBody);
next();
}
catch (err) {
next(new exceptions_1.JSONParseError(err.message, strBody));
}
};
return (req, res, next) => {
_middleware(req, res, next).catch(next);
};
}
exports.default = middleware;
export interface Config {
channelAccessToken?: string;
channelSecret?: string;
}
export interface ClientConfig extends Config {
channelAccessToken: string;
}
export interface MiddlewareConfig extends Config {
channelSecret: string;
}
export declare type Profile = {
displayName: string;
userId: string;
pictureUrl: string;
statusMessage: string;
};
/**
* Request body which is sent by webhook.
*
* @see [Request body](https://developers.line.biz/en/reference/messaging-api/#request-body)
*/
export declare type WebhookRequestBody = {
/**
* 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}.
*/
destination: string;
/**
* Information about the event
*/
events: Array<WebhookEvent>;
};
/**
* JSON objects which contain events generated on the LINE Platform.
*
* @see [Webhook event objects](https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects)
*/
export declare type WebhookEvent = MessageEvent | FollowEvent | UnfollowEvent | JoinEvent | LeaveEvent | MemberJoinEvent | MemberLeaveEvent | PostbackEvent | BeaconEvent | AccountLinkEvent | DeviceLinkEvent | DeviceUnlinkEvent | LINEThingsScenarioExecutionEvent;
export declare type EventBase = {
/**
* Time of the event in milliseconds
*/
timestamp: number;
/**
* Source user, group, or room object with information about the source of the event.
*/
source: EventSource;
};
export declare type EventSource = User | Group | Room;
export declare type User = {
type: "user";
userId: string;
};
export declare type Group = {
type: "group";
groupId: string;
/**
* ID of the source user.
*
* Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
* Not included if the user has not agreed to the
* [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
*/
userId?: string;
};
export declare type Room = {
type: "room";
roomId: string;
/**
* ID of the source user.
*
* Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
* Not included if the user has not agreed to the
* [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
*/
userId?: string;
};
export declare type ReplyableEvent = EventBase & {
replyToken: string;
};
/**
* Webhook event object which contains the sent message.
*
* The `message` property contains a message object which corresponds with the
* message type. You can reply to message events.
*
* @see [Message event](https://developers.line.biz/en/reference/messaging-api/#message-event)
*/
export declare type MessageEvent = {
type: "message";
message: EventMessage;
} & ReplyableEvent;
/**
* Event object for when your account is added as a friend (or unblocked).
*/
export declare type FollowEvent = {
type: "follow";
} & ReplyableEvent;
/**
* Event object for when your account is blocked.
*/
export declare type UnfollowEvent = {
type: "unfollow";
} & EventBase;
/**
* Event object for when your bot joins a group or room. You can reply to join events.
*
* A join event is triggered at different times for groups and rooms.
*
* - For groups: A join event is sent when a user invites your bot.
* - For rooms: A join event is sent when the first event (for example when a
* user sends a message or is added to the room) occurs after your bot is
* added.
*/
export declare type JoinEvent = {
type: "join";
} & ReplyableEvent;
/**
* Event object for when a user removes your bot from a group or a room.
*/
export declare type LeaveEvent = {
type: "leave";
} & EventBase;
/**
* Event object for when a user joins a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
* or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
*/
export declare type MemberJoinEvent = {
type: "memberJoined";
/**
* User ID of users who joined
* Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
*/
joined: {
members: Array<User>;
};
} & ReplyableEvent;
/**
* Event object for when a user leaves a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
* or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
*/
export declare type MemberLeaveEvent = {
type: "memberLeft";
/**
* User ID of users who left
* Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
*/
left: {
members: Array<User>;
};
} & EventBase;
/**
* Event object for when a user performs an action on a
* [template message](https://developers.line.biz/en/reference/messaging-api/#template-messages).
*/
export declare type PostbackEvent = {
type: "postback";
postback: Postback;
} & ReplyableEvent;
/**
* Event object for when a user enters or leaves the range of a
* [LINE Beacon](https://developers.line.biz/en/docs/messaging-api/using-beacons/).
*/
export declare type BeaconEvent = ReplyableEvent & {
type: "beacon";
beacon: {
type: "enter" | "leave" | "banner";
/**
* Hardware ID of the beacon that was detected
*/
hwid: string;
/**
* Device message of beacon that was detected.
*
* This message consists of data generated by the beacon to send notifications to bots.
* Only included in webhooks from devices that support the "device message" property.
* For more information, see the
* [LINE Simple Beacon specification](https://github.com/line/line-simple-beacon/blob/master/README.en.md/#line-simple-beacon-frame).
*/
dm?: string;
};
};
/**
* Event object for when a user has linked his/her LINE account with a provider's service account.
*/
export declare type AccountLinkEvent = ReplyableEvent & {
type: "accountLink";
link: {
result: "ok" | "failed";
/**
* Specified nonce when verifying the user ID
*/
nonce: string;
};
};
/**
* Indicates that a LINE Things-compatible device has been linked with LINE by a user operation.
* For more information, see [Receiving device link events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#link-event).
*/
export declare type DeviceLinkEvent = ReplyableEvent & {
type: "things";
things: {
/**
* Device ID of the LINE Things-compatible device that was linked with LINE
*/
deviceId: string;
type: "link";
};
};
/**
* Indicates that a LINE Things-compatible device has been unlinked from LINE by a user operation.
* For more information, see [Receiving device unlink events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#unlink-event).
*/
export declare type DeviceUnlinkEvent = ReplyableEvent & {
type: "things";
things: {
/**
* Device ID of the LINE Things-compatible device that was unlinked with LINE
*/
deviceId: string;
type: "unlink";
};
};
export declare type LINEThingsScenarioExecutionEvent = ReplyableEvent & {
type: "things";
things: {
type: "scenarioResult";
/**
* Device ID of the device that executed the scenario
*/
deviceId: string;
result: {
/**
* Scenario ID executed
*/
scenarioId: string;
/**
* Revision number of the scenario set containing the executed scenario
*/
revision: number;
/**
* Timestamp for when execution of scenario action started (milliseconds, LINE app time)
*/
startTime: number;
/**
* Timestamp for when execution of scenario was completed (milliseconds, LINE app time)
*/
endtime: number;
/**
* Scenario execution completion status
* See also [things.resultCode definitions](https://developers.line.biz/en/reference/messaging-api/#things-resultcode).
*/
resultCode: "success" | "gatt_error" | "runtime_error";
/**
* Execution result of individual operations specified in action
* Note that an array of actions specified in a scenario has the following characteristics
* - The actions defined in a scenario are performed sequentially, from top to bottom.
* - Each action produces some result when executed.
* Even actions that do not generate data, such as `SLEEP`, return an execution result of type `void`.
* The number of items in an action array may be 0.
*
* Therefore, things.actionResults has the following properties:
* - The number of items in the array matches the number of actions defined in the scenario.
* - The order of execution results matches the order in which actions are performed.
* That is, in a scenario set with multiple `GATT_READ` actions,
* the results are returned in the order in which each individual `GATT_READ` action was performed.
* - If 0 actions are defined in the scenario, the number of items in things.actionResults will be 0.
*/
actionResults: Array<LINEThingsActionResult>;
/**
* Data contained in notification
* The value is Base64-encoded binary data.
* Only included for scenarios where `trigger.type = BLE_NOTIFICATION`.
*/
bleNotificationPayload?: string;
/**
* Error reason
*/
errorReason?: string;
};
};
};
export declare type LINEThingsActionResult = {
/**
* `void`, `binary`
* Depends on `type` of the executed action.
* This property is always included if `things.actionResults` is not empty.
*/
type: "void" | "binary";
/**
* Base64-encoded binary data
* This property is always included when `things.actionResults[].type` is `binary`.
*/
data?: string;
};
export declare type EventMessage = TextEventMessage | ImageEventMessage | VideoEventMessage | AudioEventMessage | LocationEventMessage | FileEventMessage | StickerEventMessage;
export declare type EventMessageBase = {
id: string;
};
/**
* Message object which contains the text sent from the source.
*/
export declare type TextEventMessage = {
type: "text";
text: string;
} & EventMessageBase;
export declare type ContentProvider<WithPreview extends boolean = true> = {
/**
* The content is provided by LINE.
*
* The data itself can be retrieved from the content API.
*/
type: "line";
} | {
/**
* The content is provided by a provider other than LINE
*/
type: "external";
/**
* URL of the content. Only included when contentProvider.type is external.
*/
originalContentUrl: string;
/**
* URL of the content preview. Only included when contentProvider.type is external.
*
* For contents without preview (e.g. audio), it's undefined.
*/
previewImageUrl: WithPreview extends true ? string : undefined;
};
/**
* Message object which contains the image content sent from the source.
* The binary image data can be retrieved using Client#getMessageContent.
*/
export declare type ImageEventMessage = {
type: "image";
contentProvider: ContentProvider;
} & EventMessageBase;
/**
* Message object which contains the video content sent from the source.
* The binary video data can be retrieved using Client#getMessageContent.
*/
export declare type VideoEventMessage = {
type: "video";
contentProvider: ContentProvider;
} & EventMessageBase;
/**
* Message object which contains the audio content sent from the source.
* The binary audio data can be retrieved using Client#getMessageContent.
*/
export declare type AudioEventMessage = {
type: "audio";
duration: number;
contentProvider: ContentProvider<false>;
} & EventMessageBase;
/**
* Message object which contains the file sent from the source.
* The binary data can be retrieved using Client#getMessageContent.
*/
export declare type FileEventMessage = {
type: "file";
fileName: string;
fileSize: string;
} & EventMessageBase;
/**
* Message object which contains the location data sent from the source.
*/
export declare type LocationEventMessage = {
type: "location";
title: string;
address: string;
latitude: number;
longitude: number;
} & EventMessageBase;
/**
* Message object which contains the sticker data sent from the source.
* For a list of basic LINE stickers and sticker IDs, see
* [sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
*/
export declare type StickerEventMessage = {
type: "sticker";
packageId: string;
stickerId: string;
} & EventMessageBase;
export declare type Postback = {
data: string;
/**
* Object with the date and time selected by a user through a
* [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
* Only returned for postback actions via a
* [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
* The `full-date`, `time-hour`, and `time-minute` formats follow the
* [RFC3339 protocol](https://www.ietf.org/rfc/rfc3339.txt).
*/
params?: {
/**
* Date selected by user. Only included in the `date` mode.
*/
date?: string;
/**
* Time selected by the user. Only included in the `time` mode.
*/
time?: string;
/**
* Date and time selected by the user. Only included in the `datetime` mode.
*/
datetime?: string;
};
};
/**
* JSON object which contains the contents of the message you send.
*
* @see [Message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects)
*/
export declare type Message = TextMessage | ImageMessage | VideoMessage | AudioMessage | LocationMessage | StickerMessage | ImageMapMessage | TemplateMessage | FlexMessage;
/**
* @see [Common properties for messages](https://developers.line.biz/en/reference/messaging-api/#common-properties-for-messages)
*/
export declare type MessageCommon = {
/**
* For the quick reply feature.
* For more information, see [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
*
* If the user receives multiple
* [message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects),
* the quickReply property of the last message object is displayed.
*/
quickReply?: QuickReply;
};
/**
* @see [Text message](https://developers.line.biz/en/reference/messaging-api/#text-message)
*/
export declare type TextMessage = MessageCommon & {
type: "text";
/**
* Message text. You can include the following emoji:
*
* - Unicode emoji
* - LINE original emoji
* ([Unicode codepoint table for LINE original emoji](https://developers.line.biz/media/messaging-api/emoji-list.pdf))
*
* Max: 2000 characters
*/
text: string;
};
/**
* @see [Image message](https://developers.line.biz/en/reference/messaging-api/#image-message)
*/
export declare type ImageMessage = MessageCommon & {
type: "image";
/**
* Image URL (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 1024 x 1024
* - Max: 1 MB
*/
originalContentUrl: string;
/**
* Preview image URL (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 240 x 240
* - Max: 1 MB
*/
previewImageUrl: string;
};
/**
* @see [Video message](https://developers.line.biz/en/reference/messaging-api/#video-message)
*/
export declare type VideoMessage = MessageCommon & {
type: "video";
/**
* URL of video file (Max: 1000 characters)
*
* - **HTTPS**
* - mp4
* - Max: 1 minute
* - Max: 10 MB
*
* A very wide or tall video may be cropped when played in some environments.
*/
originalContentUrl: string;
/**
* URL of preview image (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 240 x 240
* - Max: 1 MB
*/
previewImageUrl: string;
};
/**
* @see [Audio message](https://developers.line.biz/en/reference/messaging-api/#audio-message)
*/
export declare type AudioMessage = MessageCommon & {
type: "audio";
/**
* URL of audio file (Max: 1000 characters)
*
* - **HTTPS**
* - m4a
* - Max: 1 minute
* - Max: 10 MB
*/
originalContentUrl: string;
/**
* Length of audio file (milliseconds)
*/
duration: number;
};
/**
* @see [Location message](https://developers.line.biz/en/reference/messaging-api/#location-message)
*/
export declare type LocationMessage = MessageCommon & {
type: "location";
/**
* Title (Max: 100 characters)
*/
title: string;
/**
* Address (Max: 100 characters)
*/
address: string;
latitude: number;
longitude: number;
};
/**
* @see [Sticker message](https://developers.line.biz/en/reference/messaging-api/#sticker-message)
*/
export declare type StickerMessage = MessageCommon & {
type: "sticker";
/**
* Package ID for a set of stickers.
* For information on package IDs, see the
* [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
*/
packageId: string;
/**
* Sticker ID.
* For a list of sticker IDs for stickers that can be sent with the Messaging
* API, see the
* [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
*/
stickerId: string;
};
/**
* @see [Imagemap message](https://developers.line.biz/en/reference/messaging-api/#imagemap-message)
*/
export declare type ImageMapMessage = MessageCommon & {
type: "imagemap";
/**
* [Base URL](https://developers.line.biz/en/reference/messaging-api/#base-url) of image
* (Max: 1000 characters, **HTTPS**)
*/
baseUrl: string;
/**
* Alternative text (Max: 400 characters)
*/
altText: string;
baseSize: Size;
/**
* Video to play inside a image map messages
*/
video?: {
/**
* URL of video file (Max: 1000 characters)
*
* - **HTTPS**
* - mp4
* - Max: 1 minute
* - Max: 10 MB
*
* A very wide or tall video may be cropped when played in some environments.
*/
originalContentUrl: string;
/**
* URL of preview image (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 240 x 240
* - Max: 1 MB
*/
previewImageUrl: string;
area: Area;
/**
* External link to be displayed after a video is played
* This property is required if you set a video to play and a label to display after the video on the imagemap
*/
externalLink?: {
linkUri: string;
label: string;
};
};
/**
* Action when tapped (Max: 50)
*/
actions: ImageMapAction[];
};
/**
* Template messages are messages with predefined layouts which you can
* customize. For more information, see
* [template messages](https://developers.line.biz/en/docs/messaging-api/message-types/#template-messages).
*
* The following template types are available:
*
* - [Buttons](https://developers.line.biz/en/reference/messaging-api/#buttons)
* - [Confirm](https://developers.line.biz/en/reference/messaging-api/#confirm)
* - [Carousel](https://developers.line.biz/en/reference/messaging-api/#carousel)
* - [Image carousel](https://developers.line.biz/en/reference/messaging-api/#image-carousel)
*
* @see [Template messages](https://developers.line.biz/en/reference/messaging-api/#template-messages)
*/
export declare type TemplateMessage = MessageCommon & {
type: "template";
/**
* Alternative text (Max: 400 characters)
*/
altText: string;
/**
* Carousel template content
*/
template: TemplateContent;
};
/**
* Flex Messages are messages with a customizable layout.
* You can customize the layout freely by combining multiple elements.
* For more information, see
* [Using Flex Messages](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/).
*
* @see [Flex messages](https://developers.line.biz/en/reference/messaging-api/#flex-message)
*/
export declare type FlexMessage = MessageCommon & {
type: "flex";
altText: string;
contents: FlexContainer;
};
/**
* Object which specifies the actions and tappable regions of an imagemap.
*
* When a region is tapped, the user is redirected to the URI specified in
* `uri` and the message specified in `message` is sent.
*
* @see [Imagemap action objects](https://developers.line.biz/en/reference/messaging-api/#imagemap-action-objects)
*/
export declare type ImageMapAction = ImageMapURIAction | ImageMapMessageAction;
export declare type ImageMapActionBase = {
/** Defined tappable area */
area: Area;
};
export declare type ImageMapURIAction = {
type: "uri";
/**
* Webpage URL (Max: 1000 characters)
*/
linkUri: string;
} & ImageMapActionBase;
export declare type ImageMapMessageAction = {
type: "message";
/**
* Message to send (Max: 400 characters)
*/
text: string;
} & ImageMapActionBase;
export declare type Area = {
/**
* Horizontal position relative to the top-left corner of the area
*/
x: number;
/**
* Vertical position relative to the top-left corner of the area
*/
y: number;
/**
* Width of the tappable area
*/
width: number;
/**
* Height of the tappable area
*/
height: number;
};
/**
* A container is the top-level structure of a Flex Message. Here are the types of containers available.
*
* - [Bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
* - [Carousel](https://developers.line.biz/en/reference/messaging-api/#f-carousel)
*
* See [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
* for the containers' JSON data samples and usage.
*/
export declare type FlexContainer = FlexBubble | FlexCarousel;
/**
* This is a container that contains one message bubble. It can contain four
* blocks: header, hero, body, and footer.
*
* For more information about using each block, see
* [Block](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/#block).
*/
export declare type FlexBubble = {
type: "bubble";
size?: "nano" | "micro" | "kilo" | "mega" | "giga";
/**
* Text directionality and the order of components in horizontal boxes in the
* container. Specify one of the following values:
*
* - `ltr`: Left to right
* - `rtl`: Right to left
*
* The default value is `ltr`.
*/
direction?: "ltr" | "rtl";
header?: FlexBox;
hero?: FlexBox | FlexImage;
body?: FlexBox;
footer?: FlexBox;
styles?: FlexBubbleStyle;
action?: Action;
};
export declare type FlexBubbleStyle = {
header?: FlexBlockStyle;
hero?: FlexBlockStyle;
body?: FlexBlockStyle;
footer?: FlexBlockStyle;
};
export declare type FlexBlockStyle = {
/**
* Background color of the block. Use a hexadecimal color code.
*/
backgroundColor?: string;
/**
* - `true` to place a separator above the block.
* - `true` will be ignored for the first block in a container because you
* cannot place a separator above the first block.
* - The default value is `false`.
*/
separator?: boolean;
/**
* Color of the separator. Use a hexadecimal color code.
*/
separatorColor?: string;
};
export declare type FlexCarousel = {
type: "carousel";
/**
* (Max: 10 bubbles)
*/
contents: FlexBubble[];
};
/**
* Components are objects that compose a Flex Message container. Here are the
* types of components available:
*
* - [Box](https://developers.line.biz/en/reference/messaging-api/#box)
* - [Button](https://developers.line.biz/en/reference/messaging-api/#button)
* - [Image](https://developers.line.biz/en/reference/messaging-api/#f-image)
* - [Icon](https://developers.line.biz/en/reference/messaging-api/#icon)
* - [Text](https://developers.line.biz/en/reference/messaging-api/#f-text)
* - [Span](https://developers.line.biz/en/reference/messaging-api/#span)
* - [Separator](https://developers.line.biz/en/reference/messaging-api/#separator)
* - [Filler](https://developers.line.biz/en/reference/messaging-api/#filler)
* - [Spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
*
* See the followings for the components' JSON data samples and usage.
*
* - [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
* - [Flex Message layout](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/)
*/
export declare type FlexComponent = FlexBox | FlexButton | FlexImage | FlexIcon | FlexText | FlexSpan | FlexSeparator | FlexFiller | FlexSpacer;
/**
* This is a component that defines the layout of child components.
* You can also include a box in a box.
*/
export declare type FlexBox = {
type: "box";
/**
* The placement style of components in this box. Specify one of the following values:
*
* - `horizontal`: Components are placed horizontally. The `direction`
* property of the [bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
* container specifies the order.
* - `vertical`: Components are placed vertically from top to bottom.
* - `baseline`: Components are placed in the same way as `horizontal` is
* specified except the baselines of the components are aligned.
*
* For more information, see
* [Types of box layouts](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-layout-types).
*/
layout: "horizontal" | "vertical" | "baseline";
/**
* Components in this box. Here are the types of components available:
*
* - When the `layout` property is `horizontal` or `vertical`:
* + [Box](https://developers.line.biz/en/reference/messaging-api/#box)
* + [button](https://developers.line.biz/en/reference/messaging-api/#button)
* + [image](https://developers.line.biz/en/reference/messaging-api/#f-image)
* + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
* + [separator](https://developers.line.biz/en/reference/messaging-api/#separator)
* + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
* + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
* - When the `layout` property is `baseline`:
* + [icon](https://developers.line.biz/en/reference/messaging-api/#icon)
* + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
* + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
* + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
*/
contents: FlexComponent[];
/**
* Background color of the block. In addition to the RGB color, an alpha
* channel (transparency) can also be set. Use a hexadecimal color code.
* (Example:#RRGGBBAA) The default value is `#00000000`.
*/
backgroundColor?: string;
/**
* Color of box border. Use a hexadecimal color code.
*/
borderColor?: string;
/**
* Width of box border. You can specify a value in pixels or any one of none,
* light, normal, medium, semi-bold, or bold. none does not render a border
* while the others become wider in the order of listing.
*/
borderWidth?: string | "none" | "light" | "normal" | "medium" | "semi-bold" | "bold";
/**
* Radius at the time of rounding the corners of the border. You can specify a
* value in pixels or any one of `none`, `xs`, `sm`, `md`, `lg`, `xl`, or `xxl`. none does not
* round the corner while the others increase in radius in the order of listing. The default value is none.
*/
cornerRadius?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* 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.
*/
width?: string;
/**
* 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.
*/
height?: string;
/**
* The ratio of the width or height of this box within the parent box. The
* default value for the horizontal parent box is `1`, and the default value
* for the vertical parent box is `0`.
*
* For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between components in this box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is `none`.
* - To override this setting for a specific component, set the `margin`
* property of that component.
*/
spacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Minimum space between this box and the previous component in the parent box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Free space between the borders of this box and the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingAll?: string;
/**
* Free space between the border at the upper end of this box and the upper end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingTop?: string;
/**
* Free space between the border at the lower end of this box and the lower end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingBottom?: string;
/**
* Free space between the border at the left end of this box and the left end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingStart?: string;
/**
* Free space between the border at the right end of this box and the right end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingEnd?: string;
/**
* Action performed when this button is tapped.
*
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
} & Offset;
export declare type Offset = {
/**
* Reference position for placing this box. Specify one of the following values:
* - `relative`: Use the previous box as reference.
* - `absolute`: Use the top left of parent element as reference.
*
* The default value is relative.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
position?: "relative" | "absolute";
/**
* The top offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetTop?: string;
/**
* The bottom offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetBottom?: string;
/**
* The left offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetStart?: string;
/**
* The right offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetEnd?: string;
};
/**
* This component draws a button.
*
* When the user taps a button, a specified action is performed.
*/
export declare type FlexButton = {
type: "button";
/**
* Action performed when this button is tapped.
*
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action: Action;
/**
* The ratio of the width or height of this box within the parent box.
*
* The default value for the horizontal parent box is `1`, and the default
* value for the vertical parent box is `0`.
*
* For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between this box and the previous component in the parent box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Height of the button. The default value is `md`.
*/
height?: "sm" | "md";
/**
* Style of the button. Specify one of the following values:
*
* - `link`: HTML link style
* - `primary`: Style for dark color buttons
* - `secondary`: Style for light color buttons
*
* The default value is `link`.
*/
style?: "link" | "primary" | "secondary";
/**
* Use a hexadecimal color code.
*
* - Character color when the `style` property is `link`.
* - Background color when the `style` property is `primary` or `secondary`.
*/
color?: string;
/**
* Vertical alignment style. Specify one of the following values:
*
* - `top`: Top-aligned
* - `bottom`: Bottom-aligned
* - `center`: Center-aligned
*
* The default value is `top`.
*
* If the `layout` property of the parent box is `baseline`, the `gravity`
* property will be ignored.
*/
gravity?: "top" | "bottom" | "center";
} & Offset;
/**
* This is an invisible component to fill extra space between components.
*
* - The filler's `flex` property is fixed to 1.
* - The `spacing` property of the parent box will be ignored for fillers.
*/
export declare type FlexFiller = {
type: "filler";
/**
* 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).
*/
flex?: number;
};
/**
* This component draws an icon.
*/
export declare type FlexIcon = {
type: "icon";
/**
* Image URL
*
* Protocol: HTTPS
* Image format: JPEG or PNG
* Maximum image size: 240×240 pixels
* Maximum data size: 1 MB
*/
url: string;
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Maximum size of the icon width.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
/**
* Aspect ratio of the icon. The default value is `1:1`.
*/
aspectRatio?: "1:1" | "2:1" | "3:1";
} & Offset;
/**
* This component draws an image.
*/
export declare type FlexImage = {
type: "image";
/**
* Image URL
*
* - Protocol: HTTPS
* - Image format: JPEG or PNG
* - Maximum image size: 1024×1024 pixels
* - Maximum data size: 1 MB
*/
url: string;
/**
* The ratio of the width or height of this box within the parent box.
*
* The default value for the horizontal parent box is `1`, and the default
* value for the vertical parent box is `0`.
*
* - For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Horizontal alignment style. Specify one of the following values:
*
* - `start`: Left-aligned
* - `end`: Right-aligned
* - `center`: Center-aligned
*
* The default value is `center`.
*/
align?: "start" | "end" | "center";
/**
* Vertical alignment style. Specify one of the following values:
*
* - `top`: Top-aligned
* - `bottom`: Bottom-aligned
* - `center`: Center-aligned
*
* The default value is `top`.
*
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored.
*/
gravity?: "top" | "bottom" | "center";
/**
* Maximum size of the image width.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" | "full";
/**
* Aspect ratio of the image.
* The default value is `1:1`.
*/
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";
/**
* Style of the image. Specify one of the following values:
*
* - `cover`: The image fills the entire drawing area. Parts of the image
* that do not fit in the drawing area are not displayed.
* - `fit`: The entire image is displayed in the drawing area. The background
* is displayed in the unused areas to the left and right of vertical images
* and in the areas above and below horizontal images.
*
* The default value is `fit`.
*/
aspectMode?: "cover" | "fit";
/**
* Background color of the image. Use a hexadecimal color code.
*/
backgroundColor?: string;
/**
* Action performed when this button is tapped.
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
} & Offset;
/**
* This component draws a separator between components in the parent box.
*/
export declare type FlexSeparator = {
type: "separator";
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Color of the separator. Use a hexadecimal color code.
*/
color?: string;
};
/**
* This is an invisible component that places a fixed-size space at the
* beginning or end of the box.
*/
export declare type FlexSpacer = {
type: "spacer";
/**
* Size of the space.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
};
export declare type FlexText = {
type: "text";
text: string;
/**
* 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.
*/
contents?: FlexSpan[];
/**
* The ratio of the width or height of this box within the parent box.
*
* The default value for the horizontal parent box is `1`, and the default
* value for the vertical parent box is `0`.
*
* For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Font size.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
/**
* Horizontal alignment style. Specify one of the following values:
*
* - `start`: Left-aligned
* - `end`: Right-aligned
* - `center`: Center-aligned
*
* The default value is `start`.
*/
align?: "start" | "end" | "center";
/**
* Vertical alignment style. Specify one of the following values:
*
* - `top`: Top-aligned
* - `bottom`: Bottom-aligned
* - `center`: Center-aligned
*
* The default value is `top`.
*
* If the `layout` property of the parent box is `baseline`, the `gravity`
* property will be ignored.
*/
gravity?: "top" | "bottom" | "center";
/**
* `true` to wrap text.
*
* The default value is `false`.
*
* If set to `true`, you can use a new line character (\n) to begin on a new
* line.
*/
wrap?: boolean;
/**
* Max number of lines. If the text does not fit in the specified number of
* lines, an ellipsis (…) is displayed at the end of the last line. If set to
* 0, all the text is displayed. The default value is 0.
*/
maxLines?: number;
/**
* Font weight.
* Specifying `bold`makes the font bold.
* The default value is `regular`.
*/
weight?: "regular" | "bold";
/**
* Font color. Use a hexadecimal color code.
*/
color?: string;
/**
* Action performed when this text is tapped.
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
/**
* Style of the text. Specify one of the following values:
* - `normal`: Normal
* - `italic`: Italic
*
* The default value is `normal`.
*/
style?: string;
/**
* Decoration of the text. Specify one of the following values:
* `none`: No decoration
* `underline`: Underline
* `line-through`: Strikethrough
*
* The default value is `none`.
*/
decoration?: string;
} & Offset;
/**
* 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).
*/
export declare type FlexSpan = {
type: "span";
/**
* 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.
*/
text: string;
/**
* Font color. Use a hexadecimal color code.
*/
color?: string;
/**
* 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`.
*/
size?: string;
/**
* Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
*/
weight?: string;
/**
* Style of the text. Specify one of the following values:
* - `normal`: Normal
* - `italic`: Italic
*
* The default value is `normal`.
*/
style?: string;
/**
* Decoration of the text. Specify one of the following values:
* `none`: No decoration
* `underline`: Underline
* `line-through`: Strikethrough
*
* The default value is `none`.
*
* 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.
*/
decoration?: string;
};
export declare type TemplateContent = TemplateButtons | TemplateConfirm | TemplateCarousel | TemplateImageCarousel;
/**
* Template with an image, title, text, and multiple action buttons.
*
* Because of the height limitation for buttons template messages, the lower
* part of the text display area will get cut off if the height limitation is
* exceeded. For this reason, depending on the character width, the message
* text may not be fully displayed even when it is within the character limits.
*/
export declare type TemplateButtons = {
type: "buttons";
/**
* Image URL (Max: 1000 characters)
*
* - HTTPS
* - JPEG or PNG
* - Max width: 1024px
* - Max: 1 MB
*/
thumbnailImageUrl?: string;
/**
* Aspect ratio of the image. Specify one of the following values:
*
* - `rectangle`: 1.51:1
* - `square`: 1:1
*
* The default value is `rectangle`
*/
imageAspectRatio?: "rectangle" | "square";
/**
* Size of the image. Specify one of the following values:
*
* - `cover`: The image fills the entire image area. Parts of the image that
* do not fit in the area are not displayed.
* - `contain`: The entire image is displayed in the image area. A background
* is displayed in the unused areas to the left and right of vertical images
* and in the areas above and below horizontal images.
*
* The default value is `cover`.
*/
imageSize?: "cover" | "contain";
/**
* Background color of image. Specify a RGB color value.
* The default value is `#FFFFFF` (white).
*/
imageBackgroundColor?: string;
/**
* Title (Max: 40 characters)
*/
title?: string;
/**
* Message text
*
* - Max: 160 characters (no image or title)
* - Max: 60 characters (message with an image or title)
*/
text: string;
/**
* Action when tapped (Max: 4)
*/
actions: Action[];
};
/**
* Template with two action buttons.
*
* Because of the height limitation for confirm template messages, the lower
* part of the `text` display area will get cut off if the height limitation is
* exceeded. For this reason, depending on the character width, the message
* text may not be fully displayed even when it is within the character limits.
*/
export declare type TemplateConfirm = {
type: "confirm";
/**
* Message text (Max: 240 characters)
*/
text: string;
/**
* Action when tapped. Set 2 actions for the 2 buttons
*/
actions: Action[];
};
/**
* Template with multiple columns which can be cycled like a carousel.
* The columns will be shown in order by scrolling horizontally.
*
* Because of the height limitation for carousel template messages, the lower
* part of the `text` display area will get cut off if the height limitation is
* exceeded. For this reason, depending on the character width, the message
* text may not be fully displayed even when it is within the character limits.
*
* Keep the number of actions consistent for all columns. If you use an image
* or title for a column, make sure to do the same for all other columns.
*/
export declare type TemplateCarousel = {
type: "carousel";
/**
* Array of columns (Max: 10)
*/
columns: TemplateColumn[];
/**
* Aspect ratio of the image. Specify one of the following values:
*
* - `rectangle`: 1.51:1
* - `square`: 1:1
*
* Applies to all columns. The default value is `rectangle`.
*/
imageAspectRatio?: "rectangle" | "square";
/**
* Size of the image. Specify one of the following values:
*
* - `cover`: The image fills the entire image area. Parts of the image that
* do not fit in the area are not displayed.
* - `contain`: The entire image is displayed in the image area. A background
* is displayed in the unused areas to the left and right of vertical images
* and in the areas above and below horizontal images.
*
* Applies to all columns. The default value is `cover`.
*/
imageSize?: "cover" | "contain";
};
export declare type TemplateColumn = {
/**
* Image URL (Max: 1000 characters)
*
* - HTTPS
* - JPEG or PNG
* - Aspect ratio: 1:1.51
* - Max width: 1024px
* - Max: 1 MB
*/
thumbnailImageUrl?: string;
/**
* Background color of image. Specify a RGB color value.
* The default value is `#FFFFFF` (white).
*/
imageBackgroundColor?: string;
/**
* Title (Max: 40 characters)
*/
title?: string;
/**
* Message text
*
* - Max: 120 characters (no image or title)
* - Max: 60 characters (message with an image or title)
*/
text: string;
/**
* Action when image is tapped; set for the entire image, title, and text area
*/
defaultAction?: Action;
/**
* Action when tapped (Max: 3)
*/
actions: Action[];
};
/**
* Template with multiple images which can be cycled like a carousel.
* The images will be shown in order by scrolling horizontally.
*/
export declare type TemplateImageCarousel = {
type: "image_carousel";
/**
* Array of columns (Max: 10)
*/
columns: TemplateImageColumn[];
};
export declare type TemplateImageColumn = {
/**
* Image URL (Max: 1000 characters)
*
* - HTTPS
* - JPEG or PNG
* - Aspect ratio: 1:1
* - Max width: 1024px
* - Max: 1 MB
*/
imageUrl: string;
/**
* Action when image is tapped
*/
action: Action<{
label?: string;
}>;
};
/**
* These properties are used for the quick reply.
*
* For more information, see
* [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
*/
export declare type QuickReply = {
/**
* This is a container that contains
* [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
*
* Array of objects (Max: 13)
*/
items: QuickReplyItem[];
};
/**
* This is a quick reply option that is displayed as a button.
*
* For more information, see
* [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
*/
export declare type QuickReplyItem = {
type: "action";
/**
* URL of the icon that is displayed at the beginning of the button (Max: 1000 characters)
*
* - URL scheme: https
* - Image format: PNG
* - Aspect ratio: 1:1
* - Data size: Up to 1 MB
*
* There is no limit on the image size. If the `action` property has the
* following actions with empty `imageUrl`:
*
* - [camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
*
* the default icon is displayed.
*/
imageUrl?: string;
/**
* Action performed when this button is tapped.
*
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*
* The following is a list of the available actions:
*
* - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
* - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
* - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
* - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
*/
action: Action;
};
/**
* These are types of actions for your bot to take when a user taps a button or an image in a message.
*
* - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
* - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
* - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
* - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
* - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
*/
export declare type Action<ExtraFields = {
label: string;
}> = (PostbackAction | MessageAction | URIAction | DatetimePickerAction | {
type: "camera";
} | {
type: "cameraRoll";
} | {
type: "location";
}) & ExtraFields;
/**
* When a control associated with this action is tapped, a postback event is
* returned via webhook with the specified string in the data property.
*/
export declare type PostbackAction = {
type: "postback";
/**
* String returned via webhook in the `postback.data` property of the
* postback event (Max: 300 characters)
*/
data: string;
/**
* Text displayed in the chat as a message sent by the user when the action
* is performed. Returned from the server through a webhook.
*
* - This property cannot be used with quick reply buttons. (Max: 300 characters)
* - The `displayText` and `text` properties cannot both be used at the same time.
* @deprecated
*/
text?: string;
/**
* Text displayed in the chat as a message sent by the user when the action is performed.
*
* - Required for quick reply buttons.
* - Optional for the other message types.
*
* Max: 300 characters
*
* The `displayText` and `text` properties cannot both be used at the same time.
*/
displayText?: string;
};
/**
* When a control associated with this action is tapped, the string in the text
* property is sent as a message from the user.
*/
export declare type MessageAction = {
type: "message";
/**
* Text sent when the action is performed (Max: 300 characters)
*/
text: string;
};
/**
* When a control associated with this action is tapped, the URI specified in
* the `uri` property is opened.
*/
export declare type URIAction = {
type: "uri";
/**
* URI opened when the action is performed (Max: 1000 characters).
* Must start with `http`, `https`, or `tel`.
*/
uri: string;
altUri?: AltURI;
};
/**
* URI opened on LINE for macOS and Windows when the action is performed (Max: 1000 characters)
* If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.
* The available schemes are http, https, line, and tel.
* For more information about the LINE URL scheme, see Using the LINE URL scheme.
* This property is supported on the following version of LINE.
*
* LINE 5.12.0 or later for macOS and Windows
* Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.
*/
export declare type AltURI = {
desktop: string;
};
/**
* When a control associated with this action is tapped, a
* [postback event](https://developers.line.biz/en/reference/messaging-api/#postback-event)
* is returned via webhook with the date and time selected by the user from the
* date and time selection dialog.
*
* The datetime picker action does not support time zones.
*
* #### Date and time format
*
* The date and time formats for the `initial`, `max`, and `min` values are
* shown below. The `full-date`, `time-hour`, and `time-minute` formats follow
* the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) protocol.
*
* | Mode | Format | Example |
* | -------- | ------------------------------------------------------------ | -------------------------------- |
* | date | `full-date` (Max: 2100-12-31; Min: 1900-01-01) | 2017-06-18 |
* | time | `time-hour`:`time-minute` (Max: 23:59; Min: 00:00) | 00:0006:1523:59 |
* | 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 |
*/
export declare type DatetimePickerAction = {
type: "datetimepicker";
/**
* String returned via webhook in the `postback.data` property of the
* postback event (Max: 300 characters)
*/
data: string;
mode: "date" | "time" | "datetime";
/**
* Initial value of date or time
*/
initial?: string;
/**
* Largest date or time value that can be selected. Must be greater than the
* `min` value.
*/
max?: string;
/**
* Smallest date or time value that can be selected. Must be less than the
* `max` value.
*/
min?: string;
};
export declare type Size = {
width: number;
height: number;
};
/**
* Rich menus consist of either of these objects.
*
* - [Rich menu object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-object)
* without the rich menu ID. Use this object when you
* [create a rich menu](https://developers.line.biz/en/reference/messaging-api/#create-rich-menu).
* - [Rich menu response object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-response-object)
* with the rich menu ID. This object is returned when you
* [get a rich menu](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu)
* or [get a list of rich menus](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list).
*
* [Area objects](https://developers.line.biz/en/reference/messaging-api/#area-object) and
* [action objects](https://developers.line.biz/en/reference/messaging-api/#action-objects)
* are included in these objects.
*/
export declare type RichMenu = {
/**
* [`size` object](https://developers.line.biz/en/reference/messaging-api/#size-object)
* which contains the width and height of the rich menu displayed in the chat.
* Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px.
*/
size: Size;
/**
* `true` to display the rich menu by default. Otherwise, `false`.
*/
selected: boolean;
/**
* Name of the rich menu.
*
* This value can be used to help manage your rich menus and is not displayed
* to users.
*
* (Max: 300 characters)
*/
name: string;
/**
* Text displayed in the chat bar (Max: 14 characters)
*/
chatBarText: string;
/**
* Array of [area objects](https://developers.line.biz/en/reference/messaging-api/#area-object)
* which define the coordinates and size of tappable areas
* (Max: 20 area objects)
*/
areas: Array<{
bounds: Area;
action: Action<{}>;
}>;
};
export declare type RichMenuResponse = {
richMenuId: string;
} & RichMenu;
export declare type NumberOfMessagesSentResponse = InsightStatisticsResponse & {
/**
* The number of messages sent with the Messaging API on the date specified in date.
* The response has this property only when the value of status is `ready`.
*/
success?: number;
};
export declare type TargetLimitForAdditionalMessages = {
/**
* One of the following values to indicate whether a target limit is set or not.
* - `none`: This indicates that a target limit is not set.
* - `limited`: This indicates that a target limit is set.
*/
type: "none" | "limited";
/**
* The target limit for additional messages in the current month.
* This property is returned when the `type` property has a value of `limited`.
*/
value?: number;
};
export declare type NumberOfMessagesSentThisMonth = {
/**
* The number of sent messages in the current month
*/
totalUsage: number;
};
export declare const LINE_REQUEST_ID_HTTP_HEADER_NAME = "x-line-request-id";
export declare type MessageAPIResponseBase = {
[LINE_REQUEST_ID_HTTP_HEADER_NAME]?: string;
};
export declare type InsightStatisticsResponse = {
/**
* Calculation status. One of:
* - `ready`: Calculation has finished; the numbers are up-to-date.
* - `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.
* - `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/).
*/
status: "ready" | "unready" | "out_of_service";
};
export declare type NumberOfMessageDeliveries = InsightStatisticsResponse & {
/**
* Number of push messages sent to **all** of this LINE official account's friends (broadcast messages).
*/
broadcast: number;
/**
* Number of push messages sent to **some** of this LINE official account's friends, based on specific attributes (targeted/segmented messages).
*/
targeting: number;
/**
* Number of auto-response messages sent.
*/
autoResponse: number;
/**
* Number of greeting messages sent.
*/
welcomeResponse: number;
/**
* Number of messages sent from LINE Official Account Manager [Chat screen](https://www.linebiz.com/jp-en/manual/OfficialAccountManager/chats/screens/).
*/
chat: number;
/**
* Number of broadcast messages sent with the [Send broadcast message](https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message) Messaging API operation.
*/
apiBroadcast: number;
/**
* Number of push messages sent with the [Send push message](https://developers.line.biz/en/reference/messaging-api/#send-push-message) Messaging API operation.
*/
apiPush: number;
/**
* Number of multicast messages sent with the [Send multicast message](https://developers.line.biz/en/reference/messaging-api/#send-multicast-message) Messaging API operation.
*/
apiMulticast: number;
/**
* Number of replies sent with the [Send reply message](https://developers.line.biz/en/reference/messaging-api/#send-reply-message) Messaging API operation.
*/
apiReply: number;
};
export declare type NumberOfFollowers = InsightStatisticsResponse & {
/**
* 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.
*/
followers: Number;
/**
* 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.
*/
targetedReaches: Number;
/**
* The number of users blocking the account as of the specified `date`. The number decreases when a user unblocks the account.
*/
blocks: Number;
};
export declare type NumberOfMessageDeliveriesResponse = InsightStatisticsResponse | NumberOfMessageDeliveries;
export declare type NumberOfFollowersResponse = InsightStatisticsResponse | NumberOfFollowers;
declare type PercentageAble = {
percentage: number;
};
export declare type FriendDemoGraphics = {
/**
* `true` if friend demographic information is available.
*/
available: boolean;
/**
* Percentage per gender
*/
genders?: Array<{
/**
* Gender
*/
gender: "unknown" | "male" | "female";
} & PercentageAble>;
/**
* Percentage per age group
*/
ages?: Array<{
/**
* Age group
*/
age: string;
} & PercentageAble>;
/**
* Percentage per area
*/
areas?: Array<{
area: string;
} & PercentageAble>;
/**
* Percentage by OS
*/
appTypes?: Array<{
appType: "ios" | "android" | "others";
} & PercentageAble>;
/**
* Percentage per friendship duration
*/
subscriptionPeriods?: Array<{
/**
* Friendship duration
*/
subscriptionPeriod: "over365days" | "within365days" | "within180days" | "within90days" | "within30days" | "within7days" | "unknown";
} & PercentageAble>;
};
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LINE_REQUEST_ID_HTTP_HEADER_NAME = "x-line-request-id";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const crypto_1 = require("crypto");
function s2b(str, encoding) {
return Buffer.from(str, encoding);
}
function safeCompare(a, b) {
if (a.length !== b.length) {
return false;
}
return crypto_1.timingSafeEqual(a, b);
}
function validateSignature(body, channelSecret, signature) {
return safeCompare(crypto_1.createHmac("SHA256", channelSecret)
.update(body)
.digest(), s2b(signature, "base64"));
}
exports.default = validateSignature;
import { Readable } from "stream";
import HTTPClient from "./http";
import * as Types from "./types";
import { JSONParseError } from "./exceptions";
import { AxiosResponse } from "axios";
function toArray<T>(maybeArr: T | T[]): T[] {
return Array.isArray(maybeArr) ? maybeArr : [maybeArr];
}
function ensureJSON<T>(raw: T): T {
if (typeof raw === "object") {
return raw;
} else {
throw new JSONParseError("Failed to parse response body as JSON", raw);
}
}
type ChatType = "group" | "room";
const API_HOST: string = process.env.API_BASE_URL || "https://api.line.me/v2/";
const BOT_BASE_URL: string = process.env.API_BASE_URL || `${API_HOST}bot/`;
const OAUTH_BASE_URL = `${API_HOST}oauth/`;
export default class Client {
public config: Types.ClientConfig;
private http: HTTPClient;
constructor(config: Types.ClientConfig) {
if (!config.channelAccessToken) {
throw new Error("no channel access token");
}
this.config = config;
this.http = new HTTPClient({
baseURL: BOT_BASE_URL,
defaultHeaders: {
Authorization: "Bearer " + this.config.channelAccessToken,
},
responseParser: this.parseHTTPResponse.bind(this),
});
}
private parseHTTPResponse(response: AxiosResponse) {
const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types;
let resBody = {
...response.data,
};
if (response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME]) {
resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] =
response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME];
}
return resBody;
}
public pushMessage(
to: string,
messages: Types.Message | Types.Message[],
notificationDisabled: boolean = false,
): Promise<Types.MessageAPIResponseBase> {
return this.http.post("/message/push", {
messages: toArray(messages),
to,
notificationDisabled,
});
}
public replyMessage(
replyToken: string,
messages: Types.Message | Types.Message[],
notificationDisabled: boolean = false,
): Promise<Types.MessageAPIResponseBase> {
return this.http.post("/message/reply", {
messages: toArray(messages),
replyToken,
notificationDisabled,
});
}
public async multicast(
to: string[],
messages: Types.Message | Types.Message[],
notificationDisabled: boolean = false,
): Promise<Types.MessageAPIResponseBase> {
return this.http.post("/message/multicast", {
messages: toArray(messages),
to,
notificationDisabled,
});
}
public async broadcast(
messages: Types.Message | Types.Message[],
notificationDisabled: boolean = false,
): Promise<Types.MessageAPIResponseBase> {
return this.http.post("/message/broadcast", {
messages: toArray(messages),
notificationDisabled,
});
}
public async getProfile(userId: string): Promise<Types.Profile> {
const profile = await this.http.get<Types.Profile>(`/profile/${userId}`);
return ensureJSON(profile);
}
private async getChatMemberProfile(
chatType: ChatType,
chatId: string,
userId: string,
): Promise<Types.Profile> {
const profile = await this.http.get<Types.Profile>(
`/${chatType}/${chatId}/member/${userId}`,
);
return ensureJSON(profile);
}
public async getGroupMemberProfile(
groupId: string,
userId: string,
): Promise<Types.Profile> {
return this.getChatMemberProfile("group", groupId, userId);
}
public async getRoomMemberProfile(
roomId: string,
userId: string,
): Promise<Types.Profile> {
return this.getChatMemberProfile("room", roomId, userId);
}
private async getChatMemberIds(
chatType: ChatType,
chatId: string,
): Promise<string[]> {
let memberIds: string[] = [];
let start: string;
do {
const res = await this.http.get<{ memberIds: string[]; next?: string }>(
`/${chatType}/${chatId}/members/ids`,
start ? { start } : null,
);
ensureJSON(res);
memberIds = memberIds.concat(res.memberIds);
start = res.next;
} while (start);
return memberIds;
}
public async getGroupMemberIds(groupId: string): Promise<string[]> {
return this.getChatMemberIds("group", groupId);
}
public async getRoomMemberIds(roomId: string): Promise<string[]> {
return this.getChatMemberIds("room", roomId);
}
public async getMessageContent(messageId: string): Promise<Readable> {
return this.http.getStream(`/message/${messageId}/content`);
}
private leaveChat(chatType: ChatType, chatId: string): Promise<any> {
return this.http.post(`/${chatType}/${chatId}/leave`);
}
public async leaveGroup(groupId: string): Promise<any> {
return this.leaveChat("group", groupId);
}
public async leaveRoom(roomId: string): Promise<any> {
return this.leaveChat("room", roomId);
}
public async getRichMenu(
richMenuId: string,
): Promise<Types.RichMenuResponse> {
const res = await this.http.get<Types.RichMenuResponse>(
`/richmenu/${richMenuId}`,
);
return ensureJSON(res);
}
public async createRichMenu(richMenu: Types.RichMenu): Promise<string> {
const res = await this.http.post<any>("/richmenu", richMenu);
return ensureJSON(res).richMenuId;
}
public async deleteRichMenu(richMenuId: string): Promise<any> {
return this.http.delete(`/richmenu/${richMenuId}`);
}
public async getRichMenuIdOfUser(userId: string): Promise<string> {
const res = await this.http.get<any>(`/user/${userId}/richmenu`);
return ensureJSON(res).richMenuId;
}
public async linkRichMenuToUser(
userId: string,
richMenuId: string,
): Promise<any> {
return this.http.post(`/user/${userId}/richmenu/${richMenuId}`);
}
public async unlinkRichMenuFromUser(userId: string): Promise<any> {
return this.http.delete(`/user/${userId}/richmenu`);
}
public async linkRichMenuToMultipleUsers(
richMenuId: string,
userIds: string[],
): Promise<any> {
return this.http.post("/richmenu/bulk/link", {
richMenuId,
userIds,
});
}
public async unlinkRichMenusFromMultipleUsers(
userIds: string[],
): Promise<any> {
return this.http.post("/richmenu/bulk/unlink", {
userIds,
});
}
public async getRichMenuImage(richMenuId: string): Promise<Readable> {
return this.http.getStream(`/richmenu/${richMenuId}/content`);
}
public async setRichMenuImage(
richMenuId: string,
data: Buffer | Readable,
contentType?: string,
): Promise<any> {
return this.http.postBinary(
`/richmenu/${richMenuId}/content`,
data,
contentType,
);
}
public async getRichMenuList(): Promise<Array<Types.RichMenuResponse>> {
const res = await this.http.get<any>(`/richmenu/list`);
return ensureJSON(res).richmenus;
}
public async setDefaultRichMenu(richMenuId: string): Promise<{}> {
return this.http.post(`/user/all/richmenu/${richMenuId}`);
}
public async getDefaultRichMenuId(): Promise<string> {
const res = await this.http.get<any>("/user/all/richmenu");
return ensureJSON(res).richMenuId;
}
public async deleteDefaultRichMenu(): Promise<{}> {
return this.http.delete("/user/all/richmenu");
}
public async getLinkToken(userId: string): Promise<string> {
const res = await this.http.post<any>(`/user/${userId}/linkToken`);
return ensureJSON(res).linkToken;
}
public async getNumberOfSentReplyMessages(
date: string,
): Promise<Types.NumberOfMessagesSentResponse> {
const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
`/message/delivery/reply?date=${date}`,
);
return ensureJSON(res);
}
public async getNumberOfSentPushMessages(
date: string,
): Promise<Types.NumberOfMessagesSentResponse> {
const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
`/message/delivery/push?date=${date}`,
);
return ensureJSON(res);
}
public async getNumberOfSentMulticastMessages(
date: string,
): Promise<Types.NumberOfMessagesSentResponse> {
const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
`/message/delivery/multicast?date=${date}`,
);
return ensureJSON(res);
}
public async getTargetLimitForAdditionalMessages(): Promise<
Types.TargetLimitForAdditionalMessages
> {
const res = await this.http.get<Types.TargetLimitForAdditionalMessages>(
"/message/quota",
);
return ensureJSON(res);
}
public async getNumberOfMessagesSentThisMonth(): Promise<
Types.NumberOfMessagesSentThisMonth
> {
const res = await this.http.get<Types.NumberOfMessagesSentThisMonth>(
"/message/quota/consumption",
);
return ensureJSON(res);
}
public async getNumberOfSentBroadcastMessages(
date: string,
): Promise<Types.NumberOfMessagesSentResponse> {
const res = await this.http.get<Types.NumberOfMessagesSentResponse>(
`/message/delivery/broadcast?date=${date}`,
);
return ensureJSON(res);
}
public async getNumberOfMessageDeliveries(
date: string,
): Promise<Types.NumberOfMessageDeliveriesResponse> {
const res = await this.http.get<Types.NumberOfMessageDeliveriesResponse>(
`/insight/message/delivery?date=${date}`,
);
return ensureJSON(res);
}
public async getNumberOfFollowers(
date: string,
): Promise<Types.NumberOfFollowersResponse> {
const res = await this.http.get<Types.NumberOfFollowersResponse>(
`/insight/followers?date=${date}`,
);
return ensureJSON(res);
}
public async getFriendDemographics(): Promise<Types.FriendDemoGraphics> {
const res = await this.http.get<Types.FriendDemoGraphics>(
`/insight/demographic`,
);
return ensureJSON(res);
}
}
export class OAuth {
private http: HTTPClient;
constructor() {
this.http = new HTTPClient({
baseURL: OAUTH_BASE_URL,
});
}
public issueAccessToken(
client_id: string,
client_secret: string,
): Promise<{
access_token: string;
expires_in: number;
token_type: "Bearer";
}> {
return this.http.postForm("/accessToken", {
grant_type: "client_credentials",
client_id,
client_secret,
});
}
public revokeAccessToken(access_token: string): Promise<{}> {
return this.http.postForm("/revoke", { access_token });
}
}
import axios, { AxiosInstance, AxiosError, AxiosResponse } from "axios";
import { Readable } from "stream";
import { HTTPError, ReadError, RequestError } from "./exceptions";
import * as fileType from "file-type";
import * as qs from "querystring";
const pkg = require("../package.json");
type httpClientConfig = {
baseURL?: string;
defaultHeaders?: any;
responseParser?: <T>(res: AxiosResponse) => T;
};
export default class HTTPClient {
private instance: AxiosInstance;
private config: httpClientConfig;
constructor(config: httpClientConfig = {}) {
this.config = config;
const { baseURL, defaultHeaders } = config;
this.instance = axios.create({
baseURL,
headers: Object.assign({}, defaultHeaders, {
"User-Agent": `${pkg.name}/${pkg.version}`,
}),
});
this.instance.interceptors.response.use(
res => res,
err => Promise.reject(this.wrapError(err)),
);
}
public async get<T>(url: string, params?: any): Promise<T> {
const res = await this.instance.get(url, { params });
return res.data;
}
public async getStream(url: string, params?: any): Promise<Readable> {
const res = await this.instance.get(url, {
params,
responseType: "stream",
});
return res.data as Readable;
}
public async post<T>(url: string, body?: any): Promise<T> {
const res = await this.instance.post(url, body, {
headers: { "Content-Type": "application/json" },
});
const { responseParser } = this.config;
if (responseParser) return responseParser<T>(res);
else return res.data;
}
public async postForm<T>(url: string, body?: any): Promise<T> {
const res = await this.instance.post(url, qs.stringify(body), {
headers: { "Content-Type": "application/x-www-form-urlencoded" },
});
return res.data;
}
public async postBinary<T>(
url: string,
data: Buffer | Readable,
contentType?: string,
): Promise<T> {
const buffer = await (async (): Promise<Buffer> => {
if (Buffer.isBuffer(data)) {
return data;
} else if (data instanceof Readable) {
return new Promise<Buffer>((resolve, reject) => {
const buffers: Buffer[] = [];
let size = 0;
data.on("data", (chunk: Buffer) => {
buffers.push(chunk);
size += chunk.length;
});
data.on("end", () => resolve(Buffer.concat(buffers, size)));
data.on("error", reject);
});
} else {
throw new Error("invalid data type for postBinary");
}
})();
const res = await this.instance.post(url, buffer, {
headers: {
"Content-Type": contentType || fileType(buffer).mime,
"Content-Length": buffer.length,
},
});
return res.data;
}
public async delete<T>(url: string, params?: any): Promise<T> {
const res = await this.instance.delete(url, { params });
return res.data;
}
private wrapError(err: AxiosError): Error {
if (err.response) {
return new HTTPError(
err.message,
err.response.status,
err.response.statusText,
err,
);
} else if (err.code) {
return new RequestError(err.message, err.code, err);
} else if (err.config) {
// unknown, but from axios
return new ReadError(err);
}
// otherwise, just rethrow
return err;
}
}
import Client, { OAuth } from "./client";
import middleware from "./middleware";
import validateSignature from "./validate-signature";
export { Client, middleware, validateSignature, OAuth };
// re-export exceptions and types
export * from "./exceptions";
export * from "./types";
import { raw } from "body-parser";
import * as http from "http";
import { JSONParseError, SignatureValidationFailed } from "./exceptions";
import * as Types from "./types";
import validateSignature from "./validate-signature";
export type Request = http.IncomingMessage & { body: any };
export type Response = http.ServerResponse;
export type NextCallback = (err?: Error) => void;
export type Middleware = (
req: Request,
res: Response,
next: NextCallback,
) => void | Promise<void>;
function isValidBody(body?: any): body is string | Buffer {
return (body && typeof body === "string") || Buffer.isBuffer(body);
}
export default function middleware(config: Types.MiddlewareConfig): Middleware {
if (!config.channelSecret) {
throw new Error("no channel secret");
}
const secret = config.channelSecret;
const _middleware: Middleware = async (req, res, next) => {
// header names are lower-cased
// https://nodejs.org/api/http.html#http_message_headers
const signature = req.headers["x-line-signature"] as string;
if (!signature) {
next(new SignatureValidationFailed("no signature"));
return;
}
const body = await (async (): Promise<string | Buffer> => {
if (isValidBody((req as any).rawBody)) {
// rawBody is provided in Google Cloud Functions and others
return (req as any).rawBody;
} else if (isValidBody(req.body)) {
return req.body;
} else {
// body may not be parsed yet, parse it to a buffer
return new Promise<Buffer>((resolve, reject) =>
raw({ type: "*/*" })(req as any, res as any, (error: Error) =>
error ? reject(error) : resolve(req.body),
),
);
}
})();
if (!validateSignature(body, secret, signature)) {
next(
new SignatureValidationFailed("signature validation failed", signature),
);
return;
}
const strBody = Buffer.isBuffer(body) ? body.toString() : body;
try {
req.body = JSON.parse(strBody);
next();
} catch (err) {
next(new JSONParseError(err.message, strBody));
}
};
return (req, res, next): void => {
(<Promise<void>>_middleware(req, res, next)).catch(next);
};
}
export interface Config {
channelAccessToken?: string;
channelSecret?: string;
}
export interface ClientConfig extends Config {
channelAccessToken: string;
}
export interface MiddlewareConfig extends Config {
channelSecret: string;
}
export type Profile = {
displayName: string;
userId: string;
pictureUrl: string;
statusMessage: string;
};
/**
* Request body which is sent by webhook.
*
* @see [Request body](https://developers.line.biz/en/reference/messaging-api/#request-body)
*/
export type WebhookRequestBody = {
/**
* 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}.
*/
destination: string;
/**
* Information about the event
*/
events: Array<WebhookEvent>;
};
/**
* JSON objects which contain events generated on the LINE Platform.
*
* @see [Webhook event objects](https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects)
*/
export type WebhookEvent =
| MessageEvent
| FollowEvent
| UnfollowEvent
| JoinEvent
| LeaveEvent
| MemberJoinEvent
| MemberLeaveEvent
| PostbackEvent
| BeaconEvent
| AccountLinkEvent
| DeviceLinkEvent
| DeviceUnlinkEvent
| LINEThingsScenarioExecutionEvent;
export type EventBase = {
/**
* Time of the event in milliseconds
*/
timestamp: number;
/**
* Source user, group, or room object with information about the source of the event.
*/
source: EventSource;
};
export type EventSource = User | Group | Room;
export type User = { type: "user"; userId: string };
export type Group = {
type: "group";
groupId: string;
/**
* ID of the source user.
*
* Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
* Not included if the user has not agreed to the
* [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
*/
userId?: string;
};
export type Room = {
type: "room";
roomId: string;
/**
* ID of the source user.
*
* Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
* Not included if the user has not agreed to the
* [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
*/
userId?: string;
};
export type ReplyableEvent = EventBase & { replyToken: string };
/**
* Webhook event object which contains the sent message.
*
* The `message` property contains a message object which corresponds with the
* message type. You can reply to message events.
*
* @see [Message event](https://developers.line.biz/en/reference/messaging-api/#message-event)
*/
export type MessageEvent = {
type: "message";
message: EventMessage;
} & ReplyableEvent;
/**
* Event object for when your account is added as a friend (or unblocked).
*/
export type FollowEvent = { type: "follow" } & ReplyableEvent;
/**
* Event object for when your account is blocked.
*/
export type UnfollowEvent = { type: "unfollow" } & EventBase;
/**
* Event object for when your bot joins a group or room. You can reply to join events.
*
* A join event is triggered at different times for groups and rooms.
*
* - For groups: A join event is sent when a user invites your bot.
* - For rooms: A join event is sent when the first event (for example when a
* user sends a message or is added to the room) occurs after your bot is
* added.
*/
export type JoinEvent = { type: "join" } & ReplyableEvent;
/**
* Event object for when a user removes your bot from a group or a room.
*/
export type LeaveEvent = { type: "leave" } & EventBase;
/**
* Event object for when a user joins a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
* or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
*/
export type MemberJoinEvent = {
type: "memberJoined";
/**
* User ID of users who joined
* Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
*/
joined: { members: Array<User> };
} & ReplyableEvent;
/**
* Event object for when a user leaves a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
* or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
*/
export type MemberLeaveEvent = {
type: "memberLeft";
/**
* User ID of users who left
* Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
*/
left: { members: Array<User> };
} & EventBase;
/**
* Event object for when a user performs an action on a
* [template message](https://developers.line.biz/en/reference/messaging-api/#template-messages).
*/
export type PostbackEvent = {
type: "postback";
postback: Postback;
} & ReplyableEvent;
/**
* Event object for when a user enters or leaves the range of a
* [LINE Beacon](https://developers.line.biz/en/docs/messaging-api/using-beacons/).
*/
export type BeaconEvent = ReplyableEvent & {
type: "beacon";
beacon: {
type: "enter" | "leave" | "banner";
/**
* Hardware ID of the beacon that was detected
*/
hwid: string;
/**
* Device message of beacon that was detected.
*
* This message consists of data generated by the beacon to send notifications to bots.
* Only included in webhooks from devices that support the "device message" property.
* For more information, see the
* [LINE Simple Beacon specification](https://github.com/line/line-simple-beacon/blob/master/README.en.md/#line-simple-beacon-frame).
*/
dm?: string;
};
};
/**
* Event object for when a user has linked his/her LINE account with a provider's service account.
*/
export type AccountLinkEvent = ReplyableEvent & {
type: "accountLink";
link: {
result: "ok" | "failed";
/**
* Specified nonce when verifying the user ID
*/
nonce: string;
};
};
/**
* Indicates that a LINE Things-compatible device has been linked with LINE by a user operation.
* For more information, see [Receiving device link events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#link-event).
*/
export type DeviceLinkEvent = ReplyableEvent & {
type: "things";
things: {
/**
* Device ID of the LINE Things-compatible device that was linked with LINE
*/
deviceId: string;
type: "link";
};
};
/**
* Indicates that a LINE Things-compatible device has been unlinked from LINE by a user operation.
* For more information, see [Receiving device unlink events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#unlink-event).
*/
export type DeviceUnlinkEvent = ReplyableEvent & {
type: "things";
things: {
/**
* Device ID of the LINE Things-compatible device that was unlinked with LINE
*/
deviceId: string;
type: "unlink";
};
};
export type LINEThingsScenarioExecutionEvent = ReplyableEvent & {
type: "things";
things: {
type: "scenarioResult";
/**
* Device ID of the device that executed the scenario
*/
deviceId: string;
result: {
/**
* Scenario ID executed
*/
scenarioId: string;
/**
* Revision number of the scenario set containing the executed scenario
*/
revision: number;
/**
* Timestamp for when execution of scenario action started (milliseconds, LINE app time)
*/
startTime: number;
/**
* Timestamp for when execution of scenario was completed (milliseconds, LINE app time)
*/
endtime: number;
/**
* Scenario execution completion status
* See also [things.resultCode definitions](https://developers.line.biz/en/reference/messaging-api/#things-resultcode).
*/
resultCode: "success" | "gatt_error" | "runtime_error";
/**
* Execution result of individual operations specified in action
* Note that an array of actions specified in a scenario has the following characteristics
* - The actions defined in a scenario are performed sequentially, from top to bottom.
* - Each action produces some result when executed.
* Even actions that do not generate data, such as `SLEEP`, return an execution result of type `void`.
* The number of items in an action array may be 0.
*
* Therefore, things.actionResults has the following properties:
* - The number of items in the array matches the number of actions defined in the scenario.
* - The order of execution results matches the order in which actions are performed.
* That is, in a scenario set with multiple `GATT_READ` actions,
* the results are returned in the order in which each individual `GATT_READ` action was performed.
* - If 0 actions are defined in the scenario, the number of items in things.actionResults will be 0.
*/
actionResults: Array<LINEThingsActionResult>;
/**
* Data contained in notification
* The value is Base64-encoded binary data.
* Only included for scenarios where `trigger.type = BLE_NOTIFICATION`.
*/
bleNotificationPayload?: string;
/**
* Error reason
*/
errorReason?: string;
};
};
};
export type LINEThingsActionResult = {
/**
* `void`, `binary`
* Depends on `type` of the executed action.
* This property is always included if `things.actionResults` is not empty.
*/
type: "void" | "binary";
/**
* Base64-encoded binary data
* This property is always included when `things.actionResults[].type` is `binary`.
*/
data?: string;
};
export type EventMessage =
| TextEventMessage
| ImageEventMessage
| VideoEventMessage
| AudioEventMessage
| LocationEventMessage
| FileEventMessage
| StickerEventMessage;
export type EventMessageBase = { id: string };
/**
* Message object which contains the text sent from the source.
*/
export type TextEventMessage = {
type: "text";
text: string;
} & EventMessageBase;
export type ContentProvider<WithPreview extends boolean = true> =
| {
/**
* The content is provided by LINE.
*
* The data itself can be retrieved from the content API.
*/
type: "line";
}
| {
/**
* The content is provided by a provider other than LINE
*/
type: "external";
/**
* URL of the content. Only included when contentProvider.type is external.
*/
originalContentUrl: string;
/**
* URL of the content preview. Only included when contentProvider.type is external.
*
* For contents without preview (e.g. audio), it's undefined.
*/
previewImageUrl: WithPreview extends true ? string : undefined;
};
/**
* Message object which contains the image content sent from the source.
* The binary image data can be retrieved using Client#getMessageContent.
*/
export type ImageEventMessage = {
type: "image";
contentProvider: ContentProvider;
} & EventMessageBase;
/**
* Message object which contains the video content sent from the source.
* The binary video data can be retrieved using Client#getMessageContent.
*/
export type VideoEventMessage = {
type: "video";
contentProvider: ContentProvider;
} & EventMessageBase;
/**
* Message object which contains the audio content sent from the source.
* The binary audio data can be retrieved using Client#getMessageContent.
*/
export type AudioEventMessage = {
type: "audio";
duration: number;
contentProvider: ContentProvider<false>;
} & EventMessageBase;
/**
* Message object which contains the file sent from the source.
* The binary data can be retrieved using Client#getMessageContent.
*/
export type FileEventMessage = {
type: "file";
fileName: string;
fileSize: string;
} & EventMessageBase;
/**
* Message object which contains the location data sent from the source.
*/
export type LocationEventMessage = {
type: "location";
title: string;
address: string;
latitude: number;
longitude: number;
} & EventMessageBase;
/**
* Message object which contains the sticker data sent from the source.
* For a list of basic LINE stickers and sticker IDs, see
* [sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
*/
export type StickerEventMessage = {
type: "sticker";
packageId: string;
stickerId: string;
} & EventMessageBase;
export type Postback = {
data: string;
/**
* Object with the date and time selected by a user through a
* [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
* Only returned for postback actions via a
* [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
* The `full-date`, `time-hour`, and `time-minute` formats follow the
* [RFC3339 protocol](https://www.ietf.org/rfc/rfc3339.txt).
*/
params?: {
/**
* Date selected by user. Only included in the `date` mode.
*/
date?: string;
/**
* Time selected by the user. Only included in the `time` mode.
*/
time?: string;
/**
* Date and time selected by the user. Only included in the `datetime` mode.
*/
datetime?: string;
};
};
/**
* JSON object which contains the contents of the message you send.
*
* @see [Message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects)
*/
export type Message =
| TextMessage
| ImageMessage
| VideoMessage
| AudioMessage
| LocationMessage
| StickerMessage
| ImageMapMessage
| TemplateMessage
| FlexMessage;
/**
* @see [Common properties for messages](https://developers.line.biz/en/reference/messaging-api/#common-properties-for-messages)
*/
export type MessageCommon = {
/**
* For the quick reply feature.
* For more information, see [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
*
* If the user receives multiple
* [message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects),
* the quickReply property of the last message object is displayed.
*/
quickReply?: QuickReply;
};
/**
* @see [Text message](https://developers.line.biz/en/reference/messaging-api/#text-message)
*/
export type TextMessage = MessageCommon & {
type: "text";
/**
* Message text. You can include the following emoji:
*
* - Unicode emoji
* - LINE original emoji
* ([Unicode codepoint table for LINE original emoji](https://developers.line.biz/media/messaging-api/emoji-list.pdf))
*
* Max: 2000 characters
*/
text: string;
};
/**
* @see [Image message](https://developers.line.biz/en/reference/messaging-api/#image-message)
*/
export type ImageMessage = MessageCommon & {
type: "image";
/**
* Image URL (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 1024 x 1024
* - Max: 1 MB
*/
originalContentUrl: string;
/**
* Preview image URL (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 240 x 240
* - Max: 1 MB
*/
previewImageUrl: string;
};
/**
* @see [Video message](https://developers.line.biz/en/reference/messaging-api/#video-message)
*/
export type VideoMessage = MessageCommon & {
type: "video";
/**
* URL of video file (Max: 1000 characters)
*
* - **HTTPS**
* - mp4
* - Max: 1 minute
* - Max: 10 MB
*
* A very wide or tall video may be cropped when played in some environments.
*/
originalContentUrl: string;
/**
* URL of preview image (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 240 x 240
* - Max: 1 MB
*/
previewImageUrl: string;
};
/**
* @see [Audio message](https://developers.line.biz/en/reference/messaging-api/#audio-message)
*/
export type AudioMessage = MessageCommon & {
type: "audio";
/**
* URL of audio file (Max: 1000 characters)
*
* - **HTTPS**
* - m4a
* - Max: 1 minute
* - Max: 10 MB
*/
originalContentUrl: string;
/**
* Length of audio file (milliseconds)
*/
duration: number;
};
/**
* @see [Location message](https://developers.line.biz/en/reference/messaging-api/#location-message)
*/
export type LocationMessage = MessageCommon & {
type: "location";
/**
* Title (Max: 100 characters)
*/
title: string;
/**
* Address (Max: 100 characters)
*/
address: string;
latitude: number;
longitude: number;
};
/**
* @see [Sticker message](https://developers.line.biz/en/reference/messaging-api/#sticker-message)
*/
export type StickerMessage = MessageCommon & {
type: "sticker";
/**
* Package ID for a set of stickers.
* For information on package IDs, see the
* [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
*/
packageId: string;
/**
* Sticker ID.
* For a list of sticker IDs for stickers that can be sent with the Messaging
* API, see the
* [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
*/
stickerId: string;
};
/**
* @see [Imagemap message](https://developers.line.biz/en/reference/messaging-api/#imagemap-message)
*/
export type ImageMapMessage = MessageCommon & {
type: "imagemap";
/**
* [Base URL](https://developers.line.biz/en/reference/messaging-api/#base-url) of image
* (Max: 1000 characters, **HTTPS**)
*/
baseUrl: string;
/**
* Alternative text (Max: 400 characters)
*/
altText: string;
baseSize: Size;
/**
* Video to play inside a image map messages
*/
video?: {
/**
* URL of video file (Max: 1000 characters)
*
* - **HTTPS**
* - mp4
* - Max: 1 minute
* - Max: 10 MB
*
* A very wide or tall video may be cropped when played in some environments.
*/
originalContentUrl: string;
/**
* URL of preview image (Max: 1000 characters)
*
* - **HTTPS**
* - JPEG
* - Max: 240 x 240
* - Max: 1 MB
*/
previewImageUrl: string;
area: Area;
/**
* External link to be displayed after a video is played
* This property is required if you set a video to play and a label to display after the video on the imagemap
*/
externalLink?: {
linkUri: string;
label: string;
};
};
/**
* Action when tapped (Max: 50)
*/
actions: ImageMapAction[];
};
/**
* Template messages are messages with predefined layouts which you can
* customize. For more information, see
* [template messages](https://developers.line.biz/en/docs/messaging-api/message-types/#template-messages).
*
* The following template types are available:
*
* - [Buttons](https://developers.line.biz/en/reference/messaging-api/#buttons)
* - [Confirm](https://developers.line.biz/en/reference/messaging-api/#confirm)
* - [Carousel](https://developers.line.biz/en/reference/messaging-api/#carousel)
* - [Image carousel](https://developers.line.biz/en/reference/messaging-api/#image-carousel)
*
* @see [Template messages](https://developers.line.biz/en/reference/messaging-api/#template-messages)
*/
export type TemplateMessage = MessageCommon & {
type: "template";
/**
* Alternative text (Max: 400 characters)
*/
altText: string;
/**
* Carousel template content
*/
template: TemplateContent;
};
/**
* Flex Messages are messages with a customizable layout.
* You can customize the layout freely by combining multiple elements.
* For more information, see
* [Using Flex Messages](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/).
*
* @see [Flex messages](https://developers.line.biz/en/reference/messaging-api/#flex-message)
*/
export type FlexMessage = MessageCommon & {
type: "flex";
altText: string;
contents: FlexContainer;
};
/**
* Object which specifies the actions and tappable regions of an imagemap.
*
* When a region is tapped, the user is redirected to the URI specified in
* `uri` and the message specified in `message` is sent.
*
* @see [Imagemap action objects](https://developers.line.biz/en/reference/messaging-api/#imagemap-action-objects)
*/
export type ImageMapAction = ImageMapURIAction | ImageMapMessageAction;
export type ImageMapActionBase = {
/** Defined tappable area */
area: Area;
};
export type ImageMapURIAction = {
type: "uri";
/**
* Webpage URL (Max: 1000 characters)
*/
linkUri: string;
} & ImageMapActionBase;
export type ImageMapMessageAction = {
type: "message";
/**
* Message to send (Max: 400 characters)
*/
text: string;
} & ImageMapActionBase;
export type Area = {
/**
* Horizontal position relative to the top-left corner of the area
*/
x: number;
/**
* Vertical position relative to the top-left corner of the area
*/
y: number;
/**
* Width of the tappable area
*/
width: number;
/**
* Height of the tappable area
*/
height: number;
};
/**
* A container is the top-level structure of a Flex Message. Here are the types of containers available.
*
* - [Bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
* - [Carousel](https://developers.line.biz/en/reference/messaging-api/#f-carousel)
*
* See [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
* for the containers' JSON data samples and usage.
*/
export type FlexContainer = FlexBubble | FlexCarousel;
/**
* This is a container that contains one message bubble. It can contain four
* blocks: header, hero, body, and footer.
*
* For more information about using each block, see
* [Block](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/#block).
*/
export type FlexBubble = {
type: "bubble";
size?: "nano" | "micro" | "kilo" | "mega" | "giga";
/**
* Text directionality and the order of components in horizontal boxes in the
* container. Specify one of the following values:
*
* - `ltr`: Left to right
* - `rtl`: Right to left
*
* The default value is `ltr`.
*/
direction?: "ltr" | "rtl";
header?: FlexBox;
hero?: FlexBox | FlexImage;
body?: FlexBox;
footer?: FlexBox;
styles?: FlexBubbleStyle;
action?: Action;
};
export type FlexBubbleStyle = {
header?: FlexBlockStyle;
hero?: FlexBlockStyle;
body?: FlexBlockStyle;
footer?: FlexBlockStyle;
};
export type FlexBlockStyle = {
/**
* Background color of the block. Use a hexadecimal color code.
*/
backgroundColor?: string;
/**
* - `true` to place a separator above the block.
* - `true` will be ignored for the first block in a container because you
* cannot place a separator above the first block.
* - The default value is `false`.
*/
separator?: boolean;
/**
* Color of the separator. Use a hexadecimal color code.
*/
separatorColor?: string;
};
export type FlexCarousel = {
type: "carousel";
/**
* (Max: 10 bubbles)
*/
contents: FlexBubble[];
};
/**
* Components are objects that compose a Flex Message container. Here are the
* types of components available:
*
* - [Box](https://developers.line.biz/en/reference/messaging-api/#box)
* - [Button](https://developers.line.biz/en/reference/messaging-api/#button)
* - [Image](https://developers.line.biz/en/reference/messaging-api/#f-image)
* - [Icon](https://developers.line.biz/en/reference/messaging-api/#icon)
* - [Text](https://developers.line.biz/en/reference/messaging-api/#f-text)
* - [Span](https://developers.line.biz/en/reference/messaging-api/#span)
* - [Separator](https://developers.line.biz/en/reference/messaging-api/#separator)
* - [Filler](https://developers.line.biz/en/reference/messaging-api/#filler)
* - [Spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
*
* See the followings for the components' JSON data samples and usage.
*
* - [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
* - [Flex Message layout](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/)
*/
export type FlexComponent =
| FlexBox
| FlexButton
| FlexImage
| FlexIcon
| FlexText
| FlexSpan
| FlexSeparator
| FlexFiller
| FlexSpacer;
/**
* This is a component that defines the layout of child components.
* You can also include a box in a box.
*/
export type FlexBox = {
type: "box";
/**
* The placement style of components in this box. Specify one of the following values:
*
* - `horizontal`: Components are placed horizontally. The `direction`
* property of the [bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
* container specifies the order.
* - `vertical`: Components are placed vertically from top to bottom.
* - `baseline`: Components are placed in the same way as `horizontal` is
* specified except the baselines of the components are aligned.
*
* For more information, see
* [Types of box layouts](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-layout-types).
*/
layout: "horizontal" | "vertical" | "baseline";
/**
* Components in this box. Here are the types of components available:
*
* - When the `layout` property is `horizontal` or `vertical`:
* + [Box](https://developers.line.biz/en/reference/messaging-api/#box)
* + [button](https://developers.line.biz/en/reference/messaging-api/#button)
* + [image](https://developers.line.biz/en/reference/messaging-api/#f-image)
* + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
* + [separator](https://developers.line.biz/en/reference/messaging-api/#separator)
* + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
* + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
* - When the `layout` property is `baseline`:
* + [icon](https://developers.line.biz/en/reference/messaging-api/#icon)
* + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
* + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
* + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
*/
contents: FlexComponent[];
/**
* Background color of the block. In addition to the RGB color, an alpha
* channel (transparency) can also be set. Use a hexadecimal color code.
* (Example:#RRGGBBAA) The default value is `#00000000`.
*/
backgroundColor?: string;
/**
* Color of box border. Use a hexadecimal color code.
*/
borderColor?: string;
/**
* Width of box border. You can specify a value in pixels or any one of none,
* light, normal, medium, semi-bold, or bold. none does not render a border
* while the others become wider in the order of listing.
*/
borderWidth?:
| string
| "none"
| "light"
| "normal"
| "medium"
| "semi-bold"
| "bold";
/**
* Radius at the time of rounding the corners of the border. You can specify a
* value in pixels or any one of `none`, `xs`, `sm`, `md`, `lg`, `xl`, or `xxl`. none does not
* round the corner while the others increase in radius in the order of listing. The default value is none.
*/
cornerRadius?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* 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.
*/
width?: string;
/**
* 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.
*/
height?: string;
/**
* The ratio of the width or height of this box within the parent box. The
* default value for the horizontal parent box is `1`, and the default value
* for the vertical parent box is `0`.
*
* For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between components in this box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is `none`.
* - To override this setting for a specific component, set the `margin`
* property of that component.
*/
spacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Minimum space between this box and the previous component in the parent box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Free space between the borders of this box and the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingAll?: string;
/**
* Free space between the border at the upper end of this box and the upper end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingTop?: string;
/**
* Free space between the border at the lower end of this box and the lower end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingBottom?: string;
/**
* Free space between the border at the left end of this box and the left end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingStart?: string;
/**
* Free space between the border at the right end of this box and the right end of the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
*/
paddingEnd?: string;
/**
* Action performed when this button is tapped.
*
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
} & Offset;
export type Offset = {
/**
* Reference position for placing this box. Specify one of the following values:
* - `relative`: Use the previous box as reference.
* - `absolute`: Use the top left of parent element as reference.
*
* The default value is relative.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
position?: "relative" | "absolute";
/**
* The top offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetTop?: string;
/**
* The bottom offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetBottom?: string;
/**
* The left offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetStart?: string;
/**
* The right offset.
* For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
*/
offsetEnd?: string;
};
/**
* This component draws a button.
*
* When the user taps a button, a specified action is performed.
*/
export type FlexButton = {
type: "button";
/**
* Action performed when this button is tapped.
*
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action: Action;
/**
* The ratio of the width or height of this box within the parent box.
*
* The default value for the horizontal parent box is `1`, and the default
* value for the vertical parent box is `0`.
*
* For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between this box and the previous component in the parent box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Height of the button. The default value is `md`.
*/
height?: "sm" | "md";
/**
* Style of the button. Specify one of the following values:
*
* - `link`: HTML link style
* - `primary`: Style for dark color buttons
* - `secondary`: Style for light color buttons
*
* The default value is `link`.
*/
style?: "link" | "primary" | "secondary";
/**
* Use a hexadecimal color code.
*
* - Character color when the `style` property is `link`.
* - Background color when the `style` property is `primary` or `secondary`.
*/
color?: string;
/**
* Vertical alignment style. Specify one of the following values:
*
* - `top`: Top-aligned
* - `bottom`: Bottom-aligned
* - `center`: Center-aligned
*
* The default value is `top`.
*
* If the `layout` property of the parent box is `baseline`, the `gravity`
* property will be ignored.
*/
gravity?: "top" | "bottom" | "center";
} & Offset;
/**
* This is an invisible component to fill extra space between components.
*
* - The filler's `flex` property is fixed to 1.
* - The `spacing` property of the parent box will be ignored for fillers.
*/
export type FlexFiller = {
type: "filler";
/**
* 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).
*/
flex?: number;
};
/**
* This component draws an icon.
*/
export type FlexIcon = {
type: "icon";
/**
* Image URL
*
* Protocol: HTTPS
* Image format: JPEG or PNG
* Maximum image size: 240×240 pixels
* Maximum data size: 1 MB
*/
url: string;
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Maximum size of the icon width.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?:
| "xxs"
| "xs"
| "sm"
| "md"
| "lg"
| "xl"
| "xxl"
| "3xl"
| "4xl"
| "5xl";
/**
* Aspect ratio of the icon. The default value is `1:1`.
*/
aspectRatio?: "1:1" | "2:1" | "3:1";
} & Offset;
/**
* This component draws an image.
*/
export type FlexImage = {
type: "image";
/**
* Image URL
*
* - Protocol: HTTPS
* - Image format: JPEG or PNG
* - Maximum image size: 1024×1024 pixels
* - Maximum data size: 1 MB
*/
url: string;
/**
* The ratio of the width or height of this box within the parent box.
*
* The default value for the horizontal parent box is `1`, and the default
* value for the vertical parent box is `0`.
*
* - For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Horizontal alignment style. Specify one of the following values:
*
* - `start`: Left-aligned
* - `end`: Right-aligned
* - `center`: Center-aligned
*
* The default value is `center`.
*/
align?: "start" | "end" | "center";
/**
* Vertical alignment style. Specify one of the following values:
*
* - `top`: Top-aligned
* - `bottom`: Bottom-aligned
* - `center`: Center-aligned
*
* The default value is `top`.
*
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored.
*/
gravity?: "top" | "bottom" | "center";
/**
* Maximum size of the image width.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?:
| "xxs"
| "xs"
| "sm"
| "md"
| "lg"
| "xl"
| "xxl"
| "3xl"
| "4xl"
| "5xl"
| "full";
/**
* Aspect ratio of the image.
* The default value is `1:1`.
*/
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";
/**
* Style of the image. Specify one of the following values:
*
* - `cover`: The image fills the entire drawing area. Parts of the image
* that do not fit in the drawing area are not displayed.
* - `fit`: The entire image is displayed in the drawing area. The background
* is displayed in the unused areas to the left and right of vertical images
* and in the areas above and below horizontal images.
*
* The default value is `fit`.
*/
aspectMode?: "cover" | "fit";
/**
* Background color of the image. Use a hexadecimal color code.
*/
backgroundColor?: string;
/**
* Action performed when this button is tapped.
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
} & Offset;
/**
* This component draws a separator between components in the parent box.
*/
export type FlexSeparator = {
type: "separator";
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Color of the separator. Use a hexadecimal color code.
*/
color?: string;
};
/**
* This is an invisible component that places a fixed-size space at the
* beginning or end of the box.
*/
export type FlexSpacer = {
type: "spacer";
/**
* Size of the space.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
};
export type FlexText = {
type: "text";
text: string;
/**
* 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.
*/
contents?: FlexSpan[];
/**
* The ratio of the width or height of this box within the parent box.
*
* The default value for the horizontal parent box is `1`, and the default
* value for the vertical parent box is `0`.
*
* For more information, see
* [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
*/
flex?: number;
/**
* Minimum space between this box and the previous component in the parent
* box.
*
* - `none` does not set a space while the other values set a space whose
* size increases in the order of listing.
* - The default value is the value of the `spacing` property of the parent
* box.
* - If this box is the first component in the parent box, the `margin`
* property will be ignored.
*/
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Font size.
* The size increases in the order of listing.
* The default value is `md`.
*/
size?:
| "xxs"
| "xs"
| "sm"
| "md"
| "lg"
| "xl"
| "xxl"
| "3xl"
| "4xl"
| "5xl";
/**
* Horizontal alignment style. Specify one of the following values:
*
* - `start`: Left-aligned
* - `end`: Right-aligned
* - `center`: Center-aligned
*
* The default value is `start`.
*/
align?: "start" | "end" | "center";
/**
* Vertical alignment style. Specify one of the following values:
*
* - `top`: Top-aligned
* - `bottom`: Bottom-aligned
* - `center`: Center-aligned
*
* The default value is `top`.
*
* If the `layout` property of the parent box is `baseline`, the `gravity`
* property will be ignored.
*/
gravity?: "top" | "bottom" | "center";
/**
* `true` to wrap text.
*
* The default value is `false`.
*
* If set to `true`, you can use a new line character (\n) to begin on a new
* line.
*/
wrap?: boolean;
/**
* Max number of lines. If the text does not fit in the specified number of
* lines, an ellipsis (…) is displayed at the end of the last line. If set to
* 0, all the text is displayed. The default value is 0.
*/
maxLines?: number;
/**
* Font weight.
* Specifying `bold`makes the font bold.
* The default value is `regular`.
*/
weight?: "regular" | "bold";
/**
* Font color. Use a hexadecimal color code.
*/
color?: string;
/**
* Action performed when this text is tapped.
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
/**
* Style of the text. Specify one of the following values:
* - `normal`: Normal
* - `italic`: Italic
*
* The default value is `normal`.
*/
style?: string;
/**
* Decoration of the text. Specify one of the following values:
* `none`: No decoration
* `underline`: Underline
* `line-through`: Strikethrough
*
* The default value is `none`.
*/
decoration?: string;
} & Offset;
/**
* 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).
*/
export type FlexSpan = {
type: "span";
/**
* 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.
*/
text: string;
/**
* Font color. Use a hexadecimal color code.
*/
color?: string;
/**
* 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`.
*/
size?: string;
/**
* Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
*/
weight?: string;
/**
* Style of the text. Specify one of the following values:
* - `normal`: Normal
* - `italic`: Italic
*
* The default value is `normal`.
*/
style?: string;
/**
* Decoration of the text. Specify one of the following values:
* `none`: No decoration
* `underline`: Underline
* `line-through`: Strikethrough
*
* The default value is `none`.
*
* 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.
*/
decoration?: string;
};
export type TemplateContent =
| TemplateButtons
| TemplateConfirm
| TemplateCarousel
| TemplateImageCarousel;
/**
* Template with an image, title, text, and multiple action buttons.
*
* Because of the height limitation for buttons template messages, the lower
* part of the text display area will get cut off if the height limitation is
* exceeded. For this reason, depending on the character width, the message
* text may not be fully displayed even when it is within the character limits.
*/
export type TemplateButtons = {
type: "buttons";
/**
* Image URL (Max: 1000 characters)
*
* - HTTPS
* - JPEG or PNG
* - Max width: 1024px
* - Max: 1 MB
*/
thumbnailImageUrl?: string;
/**
* Aspect ratio of the image. Specify one of the following values:
*
* - `rectangle`: 1.51:1
* - `square`: 1:1
*
* The default value is `rectangle`
*/
imageAspectRatio?: "rectangle" | "square";
/**
* Size of the image. Specify one of the following values:
*
* - `cover`: The image fills the entire image area. Parts of the image that
* do not fit in the area are not displayed.
* - `contain`: The entire image is displayed in the image area. A background
* is displayed in the unused areas to the left and right of vertical images
* and in the areas above and below horizontal images.
*
* The default value is `cover`.
*/
imageSize?: "cover" | "contain";
/**
* Background color of image. Specify a RGB color value.
* The default value is `#FFFFFF` (white).
*/
imageBackgroundColor?: string;
/**
* Title (Max: 40 characters)
*/
title?: string;
/**
* Message text
*
* - Max: 160 characters (no image or title)
* - Max: 60 characters (message with an image or title)
*/
text: string;
/**
* Action when tapped (Max: 4)
*/
actions: Action[];
};
/**
* Template with two action buttons.
*
* Because of the height limitation for confirm template messages, the lower
* part of the `text` display area will get cut off if the height limitation is
* exceeded. For this reason, depending on the character width, the message
* text may not be fully displayed even when it is within the character limits.
*/
export type TemplateConfirm = {
type: "confirm";
/**
* Message text (Max: 240 characters)
*/
text: string;
/**
* Action when tapped. Set 2 actions for the 2 buttons
*/
actions: Action[];
};
/**
* Template with multiple columns which can be cycled like a carousel.
* The columns will be shown in order by scrolling horizontally.
*
* Because of the height limitation for carousel template messages, the lower
* part of the `text` display area will get cut off if the height limitation is
* exceeded. For this reason, depending on the character width, the message
* text may not be fully displayed even when it is within the character limits.
*
* Keep the number of actions consistent for all columns. If you use an image
* or title for a column, make sure to do the same for all other columns.
*/
export type TemplateCarousel = {
type: "carousel";
/**
* Array of columns (Max: 10)
*/
columns: TemplateColumn[];
/**
* Aspect ratio of the image. Specify one of the following values:
*
* - `rectangle`: 1.51:1
* - `square`: 1:1
*
* Applies to all columns. The default value is `rectangle`.
*/
imageAspectRatio?: "rectangle" | "square";
/**
* Size of the image. Specify one of the following values:
*
* - `cover`: The image fills the entire image area. Parts of the image that
* do not fit in the area are not displayed.
* - `contain`: The entire image is displayed in the image area. A background
* is displayed in the unused areas to the left and right of vertical images
* and in the areas above and below horizontal images.
*
* Applies to all columns. The default value is `cover`.
*/
imageSize?: "cover" | "contain";
};
export type TemplateColumn = {
/**
* Image URL (Max: 1000 characters)
*
* - HTTPS
* - JPEG or PNG
* - Aspect ratio: 1:1.51
* - Max width: 1024px
* - Max: 1 MB
*/
thumbnailImageUrl?: string;
/**
* Background color of image. Specify a RGB color value.
* The default value is `#FFFFFF` (white).
*/
imageBackgroundColor?: string;
/**
* Title (Max: 40 characters)
*/
title?: string;
/**
* Message text
*
* - Max: 120 characters (no image or title)
* - Max: 60 characters (message with an image or title)
*/
text: string;
/**
* Action when image is tapped; set for the entire image, title, and text area
*/
defaultAction?: Action;
/**
* Action when tapped (Max: 3)
*/
actions: Action[];
};
/**
* Template with multiple images which can be cycled like a carousel.
* The images will be shown in order by scrolling horizontally.
*/
export type TemplateImageCarousel = {
type: "image_carousel";
/**
* Array of columns (Max: 10)
*/
columns: TemplateImageColumn[];
};
export type TemplateImageColumn = {
/**
* Image URL (Max: 1000 characters)
*
* - HTTPS
* - JPEG or PNG
* - Aspect ratio: 1:1
* - Max width: 1024px
* - Max: 1 MB
*/
imageUrl: string;
/**
* Action when image is tapped
*/
action: Action<{ label?: string }>;
};
/**
* These properties are used for the quick reply.
*
* For more information, see
* [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
*/
export type QuickReply = {
/**
* This is a container that contains
* [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
*
* Array of objects (Max: 13)
*/
items: QuickReplyItem[];
};
/**
* This is a quick reply option that is displayed as a button.
*
* For more information, see
* [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
*/
export type QuickReplyItem = {
type: "action";
/**
* URL of the icon that is displayed at the beginning of the button (Max: 1000 characters)
*
* - URL scheme: https
* - Image format: PNG
* - Aspect ratio: 1:1
* - Data size: Up to 1 MB
*
* There is no limit on the image size. If the `action` property has the
* following actions with empty `imageUrl`:
*
* - [camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
*
* the default icon is displayed.
*/
imageUrl?: string;
/**
* Action performed when this button is tapped.
*
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*
* The following is a list of the available actions:
*
* - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
* - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
* - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
* - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
*/
action: Action;
};
/**
* These are types of actions for your bot to take when a user taps a button or an image in a message.
*
* - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
* - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
* - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
* - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
* - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
*/
export type Action<ExtraFields = { label: string }> = (
| PostbackAction
| MessageAction
| URIAction
| DatetimePickerAction
| { type: "camera" }
| { type: "cameraRoll" }
| { type: "location" }) &
ExtraFields;
/**
* When a control associated with this action is tapped, a postback event is
* returned via webhook with the specified string in the data property.
*/
export type PostbackAction = {
type: "postback";
/**
* String returned via webhook in the `postback.data` property of the
* postback event (Max: 300 characters)
*/
data: string;
/**
* Text displayed in the chat as a message sent by the user when the action
* is performed. Returned from the server through a webhook.
*
* - This property cannot be used with quick reply buttons. (Max: 300 characters)
* - The `displayText` and `text` properties cannot both be used at the same time.
* @deprecated
*/
text?: string;
/**
* Text displayed in the chat as a message sent by the user when the action is performed.
*
* - Required for quick reply buttons.
* - Optional for the other message types.
*
* Max: 300 characters
*
* The `displayText` and `text` properties cannot both be used at the same time.
*/
displayText?: string;
};
/**
* When a control associated with this action is tapped, the string in the text
* property is sent as a message from the user.
*/
export type MessageAction = {
type: "message";
/**
* Text sent when the action is performed (Max: 300 characters)
*/
text: string;
};
/**
* When a control associated with this action is tapped, the URI specified in
* the `uri` property is opened.
*/
export type URIAction = {
type: "uri";
/**
* URI opened when the action is performed (Max: 1000 characters).
* Must start with `http`, `https`, or `tel`.
*/
uri: string;
altUri?: AltURI;
};
/**
* URI opened on LINE for macOS and Windows when the action is performed (Max: 1000 characters)
* If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.
* The available schemes are http, https, line, and tel.
* For more information about the LINE URL scheme, see Using the LINE URL scheme.
* This property is supported on the following version of LINE.
*
* LINE 5.12.0 or later for macOS and Windows
* Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.
*/
export type AltURI = {
desktop: string;
};
/**
* When a control associated with this action is tapped, a
* [postback event](https://developers.line.biz/en/reference/messaging-api/#postback-event)
* is returned via webhook with the date and time selected by the user from the
* date and time selection dialog.
*
* The datetime picker action does not support time zones.
*
* #### Date and time format
*
* The date and time formats for the `initial`, `max`, and `min` values are
* shown below. The `full-date`, `time-hour`, and `time-minute` formats follow
* the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) protocol.
*
* | Mode | Format | Example |
* | -------- | ------------------------------------------------------------ | -------------------------------- |
* | date | `full-date` (Max: 2100-12-31; Min: 1900-01-01) | 2017-06-18 |
* | time | `time-hour`:`time-minute` (Max: 23:59; Min: 00:00) | 00:0006:1523:59 |
* | 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 |
*/
export type DatetimePickerAction = {
type: "datetimepicker";
/**
* String returned via webhook in the `postback.data` property of the
* postback event (Max: 300 characters)
*/
data: string;
mode: "date" | "time" | "datetime";
/**
* Initial value of date or time
*/
initial?: string;
/**
* Largest date or time value that can be selected. Must be greater than the
* `min` value.
*/
max?: string;
/**
* Smallest date or time value that can be selected. Must be less than the
* `max` value.
*/
min?: string;
};
export type Size = {
width: number;
height: number;
};
/**
* Rich menus consist of either of these objects.
*
* - [Rich menu object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-object)
* without the rich menu ID. Use this object when you
* [create a rich menu](https://developers.line.biz/en/reference/messaging-api/#create-rich-menu).
* - [Rich menu response object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-response-object)
* with the rich menu ID. This object is returned when you
* [get a rich menu](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu)
* or [get a list of rich menus](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list).
*
* [Area objects](https://developers.line.biz/en/reference/messaging-api/#area-object) and
* [action objects](https://developers.line.biz/en/reference/messaging-api/#action-objects)
* are included in these objects.
*/
export type RichMenu = {
/**
* [`size` object](https://developers.line.biz/en/reference/messaging-api/#size-object)
* which contains the width and height of the rich menu displayed in the chat.
* Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px.
*/
size: Size;
/**
* `true` to display the rich menu by default. Otherwise, `false`.
*/
selected: boolean;
/**
* Name of the rich menu.
*
* This value can be used to help manage your rich menus and is not displayed
* to users.
*
* (Max: 300 characters)
*/
name: string;
/**
* Text displayed in the chat bar (Max: 14 characters)
*/
chatBarText: string;
/**
* Array of [area objects](https://developers.line.biz/en/reference/messaging-api/#area-object)
* which define the coordinates and size of tappable areas
* (Max: 20 area objects)
*/
areas: Array<{ bounds: Area; action: Action<{}> }>;
};
export type RichMenuResponse = { richMenuId: string } & RichMenu;
export type NumberOfMessagesSentResponse = InsightStatisticsResponse & {
/**
* The number of messages sent with the Messaging API on the date specified in date.
* The response has this property only when the value of status is `ready`.
*/
success?: number;
};
export type TargetLimitForAdditionalMessages = {
/**
* One of the following values to indicate whether a target limit is set or not.
* - `none`: This indicates that a target limit is not set.
* - `limited`: This indicates that a target limit is set.
*/
type: "none" | "limited";
/**
* The target limit for additional messages in the current month.
* This property is returned when the `type` property has a value of `limited`.
*/
value?: number;
};
export type NumberOfMessagesSentThisMonth = {
/**
* The number of sent messages in the current month
*/
totalUsage: number;
};
export const LINE_REQUEST_ID_HTTP_HEADER_NAME = "x-line-request-id";
export type MessageAPIResponseBase = {
[LINE_REQUEST_ID_HTTP_HEADER_NAME]?: string;
};
export type InsightStatisticsResponse = {
/**
* Calculation status. One of:
* - `ready`: Calculation has finished; the numbers are up-to-date.
* - `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.
* - `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/).
*/
status: "ready" | "unready" | "out_of_service";
};
export type NumberOfMessageDeliveries = InsightStatisticsResponse & {
/**
* Number of push messages sent to **all** of this LINE official account's friends (broadcast messages).
*/
broadcast: number;
/**
* Number of push messages sent to **some** of this LINE official account's friends, based on specific attributes (targeted/segmented messages).
*/
targeting: number;
/**
* Number of auto-response messages sent.
*/
autoResponse: number;
/**
* Number of greeting messages sent.
*/
welcomeResponse: number;
/**
* Number of messages sent from LINE Official Account Manager [Chat screen](https://www.linebiz.com/jp-en/manual/OfficialAccountManager/chats/screens/).
*/
chat: number;
/**
* Number of broadcast messages sent with the [Send broadcast message](https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message) Messaging API operation.
*/
apiBroadcast: number;
/**
* Number of push messages sent with the [Send push message](https://developers.line.biz/en/reference/messaging-api/#send-push-message) Messaging API operation.
*/
apiPush: number;
/**
* Number of multicast messages sent with the [Send multicast message](https://developers.line.biz/en/reference/messaging-api/#send-multicast-message) Messaging API operation.
*/
apiMulticast: number;
/**
* Number of replies sent with the [Send reply message](https://developers.line.biz/en/reference/messaging-api/#send-reply-message) Messaging API operation.
*/
apiReply: number;
};
export type NumberOfFollowers = InsightStatisticsResponse & {
/**
* 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.
*/
followers: Number;
/**
* 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.
*/
targetedReaches: Number;
/**
* The number of users blocking the account as of the specified `date`. The number decreases when a user unblocks the account.
*/
blocks: Number;
};
export type NumberOfMessageDeliveriesResponse =
| InsightStatisticsResponse
| NumberOfMessageDeliveries;
export type NumberOfFollowersResponse =
| InsightStatisticsResponse
| NumberOfFollowers;
type PercentageAble = {
percentage: number;
};
export type FriendDemoGraphics = {
/**
* `true` if friend demographic information is available.
*/
available: boolean;
/**
* Percentage per gender
*/
genders?: Array<
{
/**
* Gender
*/
gender: "unknown" | "male" | "female";
} & PercentageAble
>;
/**
* Percentage per age group
*/
ages?: Array<
{
/**
* Age group
*/
age: string;
} & PercentageAble
>;
/**
* Percentage per area
*/
areas?: Array<
{
area: string;
} & PercentageAble
>;
/**
* Percentage by OS
*/
appTypes?: Array<
{
appType: "ios" | "android" | "others";
} & PercentageAble
>;
/**
* Percentage per friendship duration
*/
subscriptionPeriods?: Array<
{
/**
* Friendship duration
*/
subscriptionPeriod:
| "over365days"
| "within365days"
| "within180days"
| "within90days"
| "within30days"
| "within7days"
// in case for some rare cases(almost no)
| "unknown";
} & PercentageAble
>;
};
import { createHmac, timingSafeEqual } from "crypto";
function s2b(str: string, encoding: string): Buffer {
return Buffer.from(str, encoding);
}
function safeCompare(a: Buffer, b: Buffer): boolean {
if (a.length !== b.length) {
return false;
}
return timingSafeEqual(a, b);
}
export default function validateSignature(
body: string | Buffer,
channelSecret: string,
signature: string,
): boolean {
return safeCompare(
createHmac("SHA256", channelSecret)
.update(body)
.digest(),
s2b(signature, "base64"),
);
}
{
"_from": "@line/bot-sdk@^6.4.0",
"_id": "@line/bot-sdk@6.8.3",
"_inBundle": false,
"_integrity": "sha512-nj2T4CQxw0W/juAlpj0kMTDScOh5QUK6xMCR2dZp+pN8B0vj/c+5uX3TyGB4ijz/NIsehgfKujPgzw7LhtYtJw==",
"_location": "/@line/bot-sdk",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@line/bot-sdk@^6.4.0",
"name": "@line/bot-sdk",
"escapedName": "@line%2fbot-sdk",
"scope": "@line",
"rawSpec": "^6.4.0",
"saveSpec": null,
"fetchSpec": "^6.4.0"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/@line/bot-sdk/-/bot-sdk-6.8.3.tgz",
"_shasum": "0a886461e8c16a8c89091fd5338f6071335636a6",
"_spec": "@line/bot-sdk@^6.4.0",
"_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT",
"bugs": {
"url": "https://github.com/line/line-bot-sdk-nodejs/issues"
},
"bundleDependencies": false,
"dependencies": {
"@types/body-parser": "^1.16.8",
"@types/file-type": "^5.2.1",
"@types/node": "^7.0.31",
"axios": "^0.19.0",
"body-parser": "^1.18.2",
"file-type": "^7.2.0"
},
"deprecated": false,
"description": "Node.js SDK for LINE Messaging API",
"devDependencies": {
"@types/express": "^4.0.35",
"@types/finalhandler": "^1.1.0",
"@types/mocha": "^2.2.41",
"del-cli": "^1.1.0",
"express": "^4.16.3",
"finalhandler": "^1.1.2",
"husky": "^0.14.3",
"mocha": "^5.2.0",
"nyc": "^14.1.1",
"prettier": "^1.15.2",
"ts-node": "^8.3.0",
"typescript": "^3.1.6",
"vuepress": "^0.14.10"
},
"engines": {
"node": ">=8"
},
"files": [
"dist",
"lib"
],
"homepage": "https://github.com/line/line-bot-sdk-nodejs#readme",
"keywords": [
"node",
"line",
"sdk"
],
"license": "Apache-2.0",
"main": "dist/index.js",
"name": "@line/bot-sdk",
"nyc": {
"require": [
"ts-node/register"
],
"extension": [
".ts"
],
"reporter": [
"lcov",
"text-summary"
],
"sourceMap": true,
"instrument": true
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/line/line-bot-sdk-nodejs.git"
},
"scripts": {
"build": "tsc",
"clean": "del-cli dist",
"docs": "vuepress dev docs",
"docs:build": "vuepress build docs",
"docs:deploy": "./deploy-docs.sh",
"format": "npm run prettier -- --write",
"format:check": "npm run prettier -- -l",
"prebuild": "npm run format:check && npm run clean",
"precommit": "npm run format:check",
"prepush": "npm run format:check && npm run build && npm run test",
"pretest": "npm run build",
"prettier": "prettier --parser typescript --trailing-comma all \"{lib,test}/**/*.ts\"",
"release": "npm run build && npm publish --access public",
"test": "API_BASE_URL=http://localhost:1234/ TEST_PORT=1234 TS_NODE_CACHE=0 nyc mocha"
},
"types": "dist/index.d.ts",
"version": "6.8.3"
}
# Installation
> `npm install --save @types/body-parser`
# Summary
This package contains type definitions for body-parser (https://github.com/expressjs/body-parser).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser
Additional Details
* Last updated: Mon, 19 Aug 2019 00:51:08 GMT
* Dependencies: @types/connect, @types/node
* Global values: none
# Credits
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>.
// Type definitions for body-parser 1.17
// Project: https://github.com/expressjs/body-parser
// Definitions 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>
// Jason Walton <https://github.com/jwalton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
import { NextHandleFunction } from 'connect';
import * as http from 'http';
// for docs go to https://github.com/expressjs/body-parser/tree/1.16.0#body-parser
// @deprecated
declare function bodyParser(options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded): NextHandleFunction;
declare namespace bodyParser {
interface Options {
inflate?: boolean;
limit?: number | string;
type?: string | string[] | ((req: http.IncomingMessage) => any);
verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;
}
interface OptionsJson extends Options {
reviver?(key: string, value: any): any;
strict?: boolean;
}
interface OptionsText extends Options {
defaultCharset?: string;
}
interface OptionsUrlencoded extends Options {
extended?: boolean;
parameterLimit?: number;
}
function json(options?: OptionsJson): NextHandleFunction;
function raw(options?: Options): NextHandleFunction;
function text(options?: OptionsText): NextHandleFunction;
function urlencoded(options?: OptionsUrlencoded): NextHandleFunction;
}
export = bodyParser;
{
"_from": "@types/body-parser@^1.16.8",
"_id": "@types/body-parser@1.17.1",
"_inBundle": false,
"_integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
"_location": "/@types/body-parser",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@types/body-parser@^1.16.8",
"name": "@types/body-parser",
"escapedName": "@types%2fbody-parser",
"scope": "@types",
"rawSpec": "^1.16.8",
"saveSpec": null,
"fetchSpec": "^1.16.8"
},
"_requiredBy": [
"/@line/bot-sdk"
],
"_resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
"_shasum": "18fcf61768fb5c30ccc508c21d6fd2e8b3bf7897",
"_spec": "@types/body-parser@^1.16.8",
"_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\@line\\bot-sdk",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Santi Albo",
"url": "https://github.com/santialbo"
},
{
"name": "Vilic Vane",
"url": "https://github.com/vilic"
},
{
"name": "Jonathan Häberle",
"url": "https://github.com/dreampulse"
},
{
"name": "Gevik Babakhani",
"url": "https://github.com/blendsdk"
},
{
"name": "Tomasz Łaziuk",
"url": "https://github.com/tlaziuk"
},
{
"name": "Jason Walton",
"url": "https://github.com/jwalton"
}
],
"dependencies": {
"@types/connect": "*",
"@types/node": "*"
},
"deprecated": false,
"description": "TypeScript definitions for body-parser",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
"license": "MIT",
"main": "",
"name": "@types/body-parser",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/body-parser"
},
"scripts": {},
"typeScriptVersion": "2.3",
"types": "index",
"typesPublisherContentHash": "ada1b55777df6de5327f420d23285a5c476895faa88cacf6b80a1a791eef0f67",
"version": "1.17.1"
}
# Installation
> `npm install --save @types/node`
# Summary
This package contains type definitions for Node.js (http://nodejs.org/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v7
Additional Details
* Last updated: Wed, 30 Oct 2019 15:44:46 GMT
* Dependencies: none
* Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
# Credits
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.
// Type definitions for Node.js 7.10
// Project: http://nodejs.org/
// Definitions 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>
// Jordi Oliveras Rovira <https://github.com/j-oliveras>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
* *
* Node.js v7.x API *
* *
************************************************/
// NOTE: These definitions support NodeJS and TypeScript 3.1.
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
// - ~/ts3.1/index.d.ts - Definitions specific to TypeScript 3.1
// NOTE: Augmentations for TypeScript 3.1 and later should use individual files for overrides
// within the respective ~/ts3.1 (or later) folder. However, this is disallowed for versions
// prior to TypeScript 3.1, so the older definitions will be found here.
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
/// <reference path="base.d.ts" />
// TypeScript 2.1-specific augmentations:
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
interface MapConstructor { }
interface WeakMapConstructor { }
interface SetConstructor { }
interface WeakSetConstructor { }
interface IteratorResult<T> {}
interface Iterable<T> {}
interface Iterator<T> {
next(value?: any): IteratorResult<T>;
}
interface IterableIterator<T> { }
interface SymbolConstructor {
readonly iterator: symbol;
}
declare var Symbol: SymbolConstructor;
{
"_from": "@types/node@^7.0.31",
"_id": "@types/node@7.10.9",
"_inBundle": false,
"_integrity": "sha512-usSpgoUsRtO5xNV5YEPU8PPnHisFx8u0rokj1BPVn/hDF7zwUDzVLiuKZM38B7z8V2111Fj6kd4rGtQFUZpNOw==",
"_location": "/@types/node",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@types/node@^7.0.31",
"name": "@types/node",
"escapedName": "@types%2fnode",
"scope": "@types",
"rawSpec": "^7.0.31",
"saveSpec": null,
"fetchSpec": "^7.0.31"
},
"_requiredBy": [
"/@line/bot-sdk",
"/@types/body-parser",
"/@types/connect",
"/@types/file-type"
],
"_resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.9.tgz",
"_shasum": "4343e3b009f8cf5e1ed685e36097b74b4101e880",
"_spec": "@types/node@^7.0.31",
"_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\@line\\bot-sdk",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Microsoft TypeScript",
"url": "https://github.com/Microsoft"
},
{
"name": "DefinitelyTyped",
"url": "https://github.com/DefinitelyTyped"
},
{
"name": "Parambir Singh",
"url": "https://github.com/parambirs"
},
{
"name": "Christian Vaagland Tellnes",
"url": "https://github.com/tellnes"
},
{
"name": "Wilco Bakker",
"url": "https://github.com/WilcoBakker"
},
{
"name": "Sebastian Silbermann",
"url": "https://github.com/eps1lon"
},
{
"name": "Hoàng Văn Khải",
"url": "https://github.com/KSXGitHub"
},
{
"name": "Sander Koenders",
"url": "https://github.com/Archcry"
},
{
"name": "Jordi Oliveras Rovira",
"url": "https://github.com/j-oliveras"
}
],
"dependencies": {},
"deprecated": false,
"description": "TypeScript definitions for Node.js",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
"license": "MIT",
"main": "",
"name": "@types/node",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/node"
},
"scripts": {},
"typeScriptVersion": "2.0",
"types": "index",
"typesPublisherContentHash": "0c534d9103600d73c97ec8a474420c4d9262b941ae93e66c175cb27e62683e84",
"typesVersions": {
">=3.2.0-0": {
"*": [
"ts3.2/*"
]
}
},
"version": "7.10.9"
}
// NOTE: These definitions support NodeJS and TypeScript 3.2.
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
// Reference required types from the default lib:
/// <reference lib="es2016" />
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
// tslint:disable-next-line:no-bad-reference
/// <reference path="../base.d.ts" />
// TypeScript 3.2-specific augmentations:
# Changelog
### 0.19.0 (May 30, 2019)
Fixes and Functionality:
- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski
- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issue/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev
- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama
- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester
- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers
- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel
- Consistent coding style ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez
- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov
- 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 `#`
- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson
- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi
- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta
- Fix failing SauceLabs tests by updating configuration - Emily Morehouse
Documentation:
- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna
- 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
- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan
- Add r2curl in ECOSYSTEM ([#2141](https://github.com/axios/axios/pull/2141)) - 유용우 / CX
- Update README.md - Add instructions for installing with yarn ([#2036](https://github.com/axios/axios/pull/2036)) - Victor Hermes
- Fixing spacing for README.md ([#2066](https://github.com/axios/axios/pull/2066)) - Josh McCarty
- Update README.md. - Change `.then` to `.finally` in example code ([#2090](https://github.com/axios/axios/pull/2090)) - Omar Cai
- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher
- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe
- 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
- Add issue templates - Emily Morehouse
- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko
- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan
- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer
### 0.19.0-beta.1 (Aug 9, 2018)
**NOTE:** This is a beta version of this release. There may be functionality that is broken in
certain browsers, though we suspect that builds are hanging and not erroring. See
https://saucelabs.com/u/axios for the most up-to-date information.
New Functionality:
- Add getUri method ([#1712](https://github.com/axios/axios/issues/1712))
- Add support for no_proxy env variable ([#1693](https://github.com/axios/axios/issues/1693))
- Add toJSON to decorated Axios errors to faciliate serialization ([#1625](https://github.com/axios/axios/issues/1625))
- Add second then on axios call ([#1623](https://github.com/axios/axios/issues/1623))
- Typings: allow custom return types
- Add option to specify character set in responses (with http adapter)
Fixes:
- Fix Keep defaults local to instance ([#385](https://github.com/axios/axios/issues/385))
- Correctly catch exception in http test ([#1475](https://github.com/axios/axios/issues/1475))
- Fix accept header normalization ([#1698](https://github.com/axios/axios/issues/1698))
- Fix http adapter to allow HTTPS connections via HTTP ([#959](https://github.com/axios/axios/issues/959))
- Fix Removes usage of deprecated Buffer constructor. ([#1555](https://github.com/axios/axios/issues/1555), [#1622](https://github.com/axios/axios/issues/1622))
- Fix defaults to use httpAdapter if available ([#1285](https://github.com/axios/axios/issues/1285))
- Fixing defaults to use httpAdapter if available
- Use a safer, cross-platform method to detect the Node environment
- Fix Reject promise if request is cancelled by the browser ([#537](https://github.com/axios/axios/issues/537))
- [Typescript] Fix missing type parameters on delete/head methods
- [NS]: Send `false` flag isStandardBrowserEnv for Nativescript
- Fix missing type parameters on delete/head
- Fix Default method for an instance always overwritten by get
- Fix type error when socketPath option in AxiosRequestConfig
- Capture errors on request data streams
- Decorate resolve and reject to clear timeout in all cases
Huge thanks to everyone who contributed to this release via code (authors listed
below) or via reviews and triaging on GitHub:
- Andrew Scott <ascott18@gmail.com>
- Anthony Gauthier <antho325@hotmail.com>
- arpit <arpit2438735@gmail.com>
- ascott18
- Benedikt Rötsch <axe312ger@users.noreply.github.com>
- Chance Dickson <me@chancedickson.com>
- Dave Stewart <info@davestewart.co.uk>
- Deric Cain <deric.cain@gmail.com>
- Guillaume Briday <guillaumebriday@gmail.com>
- Jacob Wejendorp <jacob@wejendorp.dk>
- Jim Lynch <mrdotjim@gmail.com>
- johntron
- Justin Beckwith <beckwith@google.com>
- Justin Beckwith <justin.beckwith@gmail.com>
- Khaled Garbaya <khaledgarbaya@gmail.com>
- Lim Jing Rong <jjingrong@users.noreply.github.com>
- Mark van den Broek <mvdnbrk@gmail.com>
- Martti Laine <martti@codeclown.net>
- mattridley
- mattridley <matt.r@joinblink.com>
- Nicolas Del Valle <nicolas.delvalle@gmail.com>
- Nilegfx
- pbarbiero
- Rikki Gibson <rikkigibson@gmail.com>
- Sako Hartounian <sakohartounian@yahoo.com>
- Shane Fitzpatrick <fitzpasd@gmail.com>
- Stephan Schneider <stephanschndr@gmail.com>
- Steven <steven@ceriously.com>
- Tim Garthwaite <tim.garthwaite@jibo.com>
- Tim Johns <timjohns@yahoo.com>
- Yutaro Miyazaki <yutaro@studio-rubbish.com>
### 0.18.0 (Feb 19, 2018)
- Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070))
- Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)):
- AxiosRequestConfig.proxy: allows type false
- AxiosProxyConfig: added auth field
- 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))
- Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287))
- Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342))
### 0.17.1 (Nov 11, 2017)
- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))
- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080))
- 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))
### 0.17.0 (Oct 21, 2017)
- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))
- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874))
- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691))
- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061))
### 0.16.2 (Jun 3, 2017)
- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))
- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830))
- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930))
### 0.16.1 (Apr 8, 2017)
- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))
- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829))
- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773))
### 0.16.0 (Mar 31, 2017)
- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))
- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461))
- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654))
- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731))
- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581))
- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561))
### 0.15.3 (Nov 27, 2016)
- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))
- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519))
- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509))
- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507))
- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483))
- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493))
- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491))
### 0.15.2 (Oct 17, 2016)
- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482))
### 0.15.1 (Oct 14, 2016)
- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
### 0.15.0 (Oct 10, 2016)
- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))
- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437))
- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440))
- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445))
### 0.14.0 (Aug 27, 2016)
- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))
- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387))
- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423))
- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366))
- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397))
- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406))
### 0.13.1 (Jul 16, 2016)
- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378))
### 0.13.0 (Jul 13, 2016)
- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))
- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343))
- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352))
- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341))
- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217))
### 0.12.0 (May 31, 2016)
- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))
- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307))
### 0.11.1 (May 17, 2016)
- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))
- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325))
- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321))
### 0.11.0 (Apr 26, 2016)
- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))
- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308))
- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299))
### 0.10.0 (Apr 20, 2016)
- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))
- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252))
- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227))
- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249))
- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251))
- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275))
- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279))
- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200))
### 0.9.1 (Jan 24, 2016)
- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))
- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205))
- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201))
- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198))
### 0.9.0 (Jan 18, 2016)
- Adding support for custom adapters
- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195))
- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185))
- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183))
- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182))
### 0.8.1 (Dec 14, 2015)
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))
- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173))
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174))
### 0.8.0 (Dec 11, 2015)
- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128))
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121))
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127))
- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146))
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149))
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140))
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167))
- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160))
### 0.7.0 (Sep 29, 2015)
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))
- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102))
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106))
- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105))
- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112))
- 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))
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116))
### 0.6.0 (Sep 21, 2015)
- Removing deprecated success/error aliases
- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49))
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69))
- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56))
- Removing es6-promise dependency
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91))
- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85))
- Converting build to UMD
### 0.5.4 (Apr 08, 2015)
- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53))
### 0.5.3 (Apr 07, 2015)
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
### 0.5.2 (Mar 13, 2015)
- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46))
### 0.5.1 (Mar 10, 2015)
- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))
- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47))
### 0.5.0 (Jan 23, 2015)
- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))
- Updating es6-promise dependency
### 0.4.2 (Dec 10, 2014)
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))
- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25))
- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29))
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30))
### 0.4.1 (Oct 15, 2014)
- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18))
### 0.4.0 (Oct 03, 2014)
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))
- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13))
- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12))
- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9))
- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11))
- Deprecating `success`/`error` in favor of `then`/`catch`
### 0.3.1 (Sep 16, 2014)
- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3))
### 0.3.0 (Sep 16, 2014)
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6))
- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7))
### 0.2.2 (Sep 14, 2014)
- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
### 0.2.1 (Sep 12, 2014)
- Fixing build problem causing ridiculous file sizes
### 0.2.0 (Sep 12, 2014)
- Adding support for `all` and `spread`
- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1))
### 0.1.0 (Aug 29, 2014)
- Initial release
Copyright (c) 2014-present Matt Zabriskie
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# axios
[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
[![build status](https://img.shields.io/travis/axios/axios.svg?style=flat-square)](https://travis-ci.org/axios/axios)
[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
[![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
Promise based HTTP client for the browser and node.js
## Features
- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
- Make [http](http://nodejs.org/api/http.html) requests from node.js
- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
- Intercept request and response
- Transform request and response data
- Cancel requests
- Automatic transforms for JSON data
- Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
## Browser Support
![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) |
--- | --- | --- | --- | --- | --- |
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
## Installing
Using npm:
```bash
$ npm install axios
```
Using bower:
```bash
$ bower install axios
```
Using yarn:
```bash
$ yarn add axios
```
Using cdn:
```html
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
```
## Example
Performing a `GET` request
```js
const axios = require('axios');
// Make a request for a user with a given ID
axios.get('/user?ID=12345')
.then(function (response) {
// handle success
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});
// Optionally the request above could also be done as
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})
.then(function () {
// always executed
});
// Want to use async/await? Add the `async` keyword to your outer function/method.
async function getUser() {
try {
const response = await axios.get('/user?ID=12345');
console.log(response);
} catch (error) {
console.error(error);
}
}
```
> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
> Explorer and older browsers, so use with caution.
Performing a `POST` request
```js
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
```
Performing multiple concurrent requests
```js
function getUserAccount() {
return axios.get('/user/12345');
}
function getUserPermissions() {
return axios.get('/user/12345/permissions');
}
axios.all([getUserAccount(), getUserPermissions()])
.then(axios.spread(function (acct, perms) {
// Both requests are now complete
}));
```
## axios API
Requests can be made by passing the relevant config to `axios`.
##### axios(config)
```js
// Send a POST request
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});
```
```js
// GET request for remote image
axios({
method: 'get',
url: 'http://bit.ly/2mTM3nY',
responseType: 'stream'
})
.then(function (response) {
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
});
```
##### axios(url[, config])
```js
// Send a GET request (default method)
axios('/user/12345');
```
### Request method aliases
For convenience aliases have been provided for all supported request methods.
##### axios.request(config)
##### axios.get(url[, config])
##### axios.delete(url[, config])
##### axios.head(url[, config])
##### axios.options(url[, config])
##### axios.post(url[, data[, config]])
##### axios.put(url[, data[, config]])
##### axios.patch(url[, data[, config]])
###### NOTE
When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
### Concurrency
Helper functions for dealing with concurrent requests.
##### axios.all(iterable)
##### axios.spread(callback)
### Creating an instance
You can create a new instance of axios with a custom config.
##### axios.create([config])
```js
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
```
### Instance methods
The available instance methods are listed below. The specified config will be merged with the instance config.
##### axios#request(config)
##### axios#get(url[, config])
##### axios#delete(url[, config])
##### axios#head(url[, config])
##### axios#options(url[, config])
##### axios#post(url[, data[, config]])
##### axios#put(url[, data[, config]])
##### axios#patch(url[, data[, config]])
##### axios#getUri([config])
## Request Config
These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
```js
{
// `url` is the server URL that will be used for the request
url: '/user',
// `method` is the request method to be used when making the request
method: 'get', // default
// `baseURL` will be prepended to `url` unless `url` is absolute.
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
// to methods of that instance.
baseURL: 'https://some-domain.com/api/',
// `transformRequest` allows changes to the request data before it is sent to the server
// This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
// FormData or Stream
// You may modify the headers object.
transformRequest: [function (data, headers) {
// Do whatever you want to transform the data
return data;
}],
// `transformResponse` allows changes to the response data to be made before
// it is passed to then/catch
transformResponse: [function (data) {
// Do whatever you want to transform the data
return data;
}],
// `headers` are custom headers to be sent
headers: {'X-Requested-With': 'XMLHttpRequest'},
// `params` are the URL parameters to be sent with the request
// Must be a plain object or a URLSearchParams object
params: {
ID: 12345
},
// `paramsSerializer` is an optional function in charge of serializing `params`
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
// `data` is the data to be sent as the request body
// Only applicable for request methods 'PUT', 'POST', and 'PATCH'
// When no `transformRequest` is set, must be of one of the following types:
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
// - Browser only: FormData, File, Blob
// - Node only: Stream, Buffer
data: {
firstName: 'Fred'
},
// `timeout` specifies the number of milliseconds before the request times out.
// If the request takes longer than `timeout`, the request will be aborted.
timeout: 1000, // default is `0` (no timeout)
// `withCredentials` indicates whether or not cross-site Access-Control requests
// should be made using credentials
withCredentials: false, // default
// `adapter` allows custom handling of requests which makes testing easier.
// Return a promise and supply a valid response (see lib/adapters/README.md).
adapter: function (config) {
/* ... */
},
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
// This will set an `Authorization` header, overwriting any existing
// `Authorization` custom headers you have set using `headers`.
// Please note that only HTTP Basic auth is configurable through this parameter.
// For Bearer tokens and such, use `Authorization` custom headers instead.
auth: {
username: 'janedoe',
password: 's00pers3cret'
},
// `responseType` indicates the type of data that the server will respond with
// options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
// browser only: 'blob'
responseType: 'json', // default
// `responseEncoding` indicates encoding to use for decoding responses
// Note: Ignored for `responseType` of 'stream' or client-side requests
responseEncoding: 'utf8', // default
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
xsrfCookieName: 'XSRF-TOKEN', // default
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value
xsrfHeaderName: 'X-XSRF-TOKEN', // default
// `onUploadProgress` allows handling of progress events for uploads
onUploadProgress: function (progressEvent) {
// Do whatever you want with the native progress event
},
// `onDownloadProgress` allows handling of progress events for downloads
onDownloadProgress: function (progressEvent) {
// Do whatever you want with the native progress event
},
// `maxContentLength` defines the max size of the http response content in bytes allowed
maxContentLength: 2000,
// `validateStatus` defines whether to resolve or reject the promise for a given
// HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
// or `undefined`), the promise will be resolved; otherwise, the promise will be
// rejected.
validateStatus: function (status) {
return status >= 200 && status < 300; // default
},
// `maxRedirects` defines the maximum number of redirects to follow in node.js.
// If set to 0, no redirects will be followed.
maxRedirects: 5, // default
// `socketPath` defines a UNIX Socket to be used in node.js.
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
// Only either `socketPath` or `proxy` can be specified.
// If both are specified, `socketPath` is used.
socketPath: null, // default
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
// and https requests, respectively, in node.js. This allows options to be added like
// `keepAlive` that are not enabled by default.
httpAgent: new http.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true }),
// 'proxy' defines the hostname and port of the proxy server.
// You can also define your proxy using the conventional `http_proxy` and
// `https_proxy` environment variables. If you are using environment variables
// for your proxy configuration, you can also define a `no_proxy` environment
// variable as a comma-separated list of domains that should not be proxied.
// Use `false` to disable proxies, ignoring environment variables.
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
// supplies credentials.
// This will set an `Proxy-Authorization` header, overwriting any existing
// `Proxy-Authorization` custom headers you have set using `headers`.
proxy: {
host: '127.0.0.1',
port: 9000,
auth: {
username: 'mikeymike',
password: 'rapunz3l'
}
},
// `cancelToken` specifies a cancel token that can be used to cancel the request
// (see Cancellation section below for details)
cancelToken: new CancelToken(function (cancel) {
})
}
```
## Response Schema
The response for a request contains the following information.
```js
{
// `data` is the response that was provided by the server
data: {},
// `status` is the HTTP status code from the server response
status: 200,
// `statusText` is the HTTP status message from the server response
statusText: 'OK',
// `headers` the headers that the server responded with
// All header names are lower cased
headers: {},
// `config` is the config that was provided to `axios` for the request
config: {},
// `request` is the request that generated this response
// It is the last ClientRequest instance in node.js (in redirects)
// and an XMLHttpRequest instance the browser
request: {}
}
```
When using `then`, you will receive the response as follows:
```js
axios.get('/user/12345')
.then(function (response) {
console.log(response.data);
console.log(response.status);
console.log(response.statusText);
console.log(response.headers);
console.log(response.config);
});
```
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.
## Config Defaults
You can specify config defaults that will be applied to every request.
### Global axios defaults
```js
axios.defaults.baseURL = 'https://api.example.com';
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
```
### Custom instance defaults
```js
// Set config defaults when creating the instance
const instance = axios.create({
baseURL: 'https://api.example.com'
});
// Alter defaults after instance has been created
instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
```
### Config order of precedence
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.
```js
// Create an instance using the config defaults provided by the library
// At this point the timeout config value is `0` as is the default for the library
const instance = axios.create();
// Override timeout default for the library
// Now all requests using this instance will wait 2.5 seconds before timing out
instance.defaults.timeout = 2500;
// Override timeout for this request as it's known to take a long time
instance.get('/longRequest', {
timeout: 5000
});
```
## Interceptors
You can intercept requests or responses before they are handled by `then` or `catch`.
```js
// Add a request interceptor
axios.interceptors.request.use(function (config) {
// Do something before request is sent
return config;
}, function (error) {
// Do something with request error
return Promise.reject(error);
});
// Add a response interceptor
axios.interceptors.response.use(function (response) {
// Do something with response data
return response;
}, function (error) {
// Do something with response error
return Promise.reject(error);
});
```
If you may need to remove an interceptor later you can.
```js
const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
axios.interceptors.request.eject(myInterceptor);
```
You can add interceptors to a custom instance of axios.
```js
const instance = axios.create();
instance.interceptors.request.use(function () {/*...*/});
```
## Handling Errors
```js
axios.get('/user/12345')
.catch(function (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
}
console.log(error.config);
});
```
You can define a custom HTTP status code error range using the `validateStatus` config option.
```js
axios.get('/user/12345', {
validateStatus: function (status) {
return status < 500; // Reject only if the status code is greater than or equal to 500
}
})
```
## Cancellation
You can cancel a request using a *cancel token*.
> The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
You can create a cancel token using the `CancelToken.source` factory as shown below:
```js
const CancelToken = axios.CancelToken;
const source = CancelToken.source();
axios.get('/user/12345', {
cancelToken: source.token
}).catch(function (thrown) {
if (axios.isCancel(thrown)) {
console.log('Request canceled', thrown.message);
} else {
// handle error
}
});
axios.post('/user/12345', {
name: 'new name'
}, {
cancelToken: source.token
})
// cancel the request (the message parameter is optional)
source.cancel('Operation canceled by the user.');
```
You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
```js
const CancelToken = axios.CancelToken;
let cancel;
axios.get('/user/12345', {
cancelToken: new CancelToken(function executor(c) {
// An executor function receives a cancel function as a parameter
cancel = c;
})
});
// cancel the request
cancel();
```
> Note: you can cancel several requests with the same cancel token.
## Using application/x-www-form-urlencoded format
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.
### Browser
In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
```js
const params = new URLSearchParams();
params.append('param1', 'value1');
params.append('param2', 'value2');
axios.post('/foo', params);
```
> 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).
Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
```js
const qs = require('qs');
axios.post('/foo', qs.stringify({ 'bar': 123 }));
```
Or in another way (ES6),
```js
import qs from 'qs';
const data = { 'bar': 123 };
const options = {
method: 'POST',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
data: qs.stringify(data),
url,
};
axios(options);
```
### Node.js
In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
```js
const querystring = require('querystring');
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
```
You can also use the [`qs`](https://github.com/ljharb/qs) library.
###### NOTE
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).
## Semver
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.
## Promises
axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
## TypeScript
axios includes [TypeScript](http://typescriptlang.org) definitions.
```typescript
import axios from 'axios';
axios.get('/user?ID=12345');
```
## Resources
* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
## Credits
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.
## License
MIT
# Upgrade Guide
### 0.15.x -> 0.16.0
#### `Promise` Type Declarations
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.
### 0.13.x -> 0.14.0
#### TypeScript Definitions
The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
Please use the following `import` statement to import axios in TypeScript:
```typescript
import axios from 'axios';
axios.get('/foo')
.then(response => console.log(response))
.catch(error => console.log(error));
```
#### `agent` Config Option
The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
```js
{
// Define a custom agent for HTTP
httpAgent: new http.Agent({ keepAlive: true }),
// Define a custom agent for HTTPS
httpsAgent: new https.Agent({ keepAlive: true })
}
```
#### `progress` Config Option
The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
```js
{
// Define a handler for upload progress events
onUploadProgress: function (progressEvent) {
// ...
},
// Define a handler for download progress events
onDownloadProgress: function (progressEvent) {
// ...
}
}
```
### 0.12.x -> 0.13.0
The `0.13.0` release contains several changes to custom adapters and error handling.
#### Error Handling
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.
```js
axios.get('/user/12345')
.catch((error) => {
console.log(error.message);
console.log(error.code); // Not always specified
console.log(error.config); // The config that was used to make the request
console.log(error.response); // Only available if response was received from the server
});
```
#### Request Adapters
This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
1. Response transformer is now called outside of adapter.
2. Request adapter returns a `Promise`.
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.
Previous code:
```js
function myAdapter(resolve, reject, config) {
var response = {
data: transformData(
responseData,
responseHeaders,
config.transformResponse
),
status: request.status,
statusText: request.statusText,
headers: responseHeaders
};
settle(resolve, reject, response);
}
```
New code:
```js
function myAdapter(config) {
return new Promise(function (resolve, reject) {
var response = {
data: responseData,
status: request.status,
statusText: request.statusText,
headers: responseHeaders
};
settle(resolve, reject, response);
});
}
```
See the related commits for more details:
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
### 0.5.x -> 0.6.0
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
#### ES6 Promise Polyfill
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.
```js
require('es6-promise').polyfill();
var axios = require('axios');
```
This will polyfill the global environment, and only needs to be done once.
#### `axios.success`/`axios.error`
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.
```js
axios.get('some/url')
.then(function (res) {
/* ... */
})
.catch(function (err) {
/* ... */
});
```
#### UMD
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
```js
// AMD
require(['bower_components/axios/dist/axios'], function (axios) {
/* ... */
});
// CommonJS
var axios = require('axios/dist/axios');
```
/* axios v0.19.0 | (c) 2019 by Matt Zabriskie */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["axios"] = factory();
else
root["axios"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
var bind = __webpack_require__(3);
var Axios = __webpack_require__(5);
var mergeConfig = __webpack_require__(22);
var defaults = __webpack_require__(11);
/**
* Create an instance of Axios
*
* @param {Object} defaultConfig The default config for the instance
* @return {Axios} A new instance of Axios
*/
function createInstance(defaultConfig) {
var context = new Axios(defaultConfig);
var instance = bind(Axios.prototype.request, context);
// Copy axios.prototype to instance
utils.extend(instance, Axios.prototype, context);
// Copy context to instance
utils.extend(instance, context);
return instance;
}
// Create the default instance to be exported
var axios = createInstance(defaults);
// Expose Axios class to allow class inheritance
axios.Axios = Axios;
// Factory for creating new instances
axios.create = function create(instanceConfig) {
return createInstance(mergeConfig(axios.defaults, instanceConfig));
};
// Expose Cancel & CancelToken
axios.Cancel = __webpack_require__(23);
axios.CancelToken = __webpack_require__(24);
axios.isCancel = __webpack_require__(10);
// Expose all/spread
axios.all = function all(promises) {
return Promise.all(promises);
};
axios.spread = __webpack_require__(25);
module.exports = axios;
// Allow use of default import syntax in TypeScript
module.exports.default = axios;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var bind = __webpack_require__(3);
var isBuffer = __webpack_require__(4);
/*global toString:true*/
// utils is a library of generic helper functions non-specific to axios
var toString = Object.prototype.toString;
/**
* Determine if a value is an Array
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Array, otherwise false
*/
function isArray(val) {
return toString.call(val) === '[object Array]';
}
/**
* Determine if a value is an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
*/
function isArrayBuffer(val) {
return toString.call(val) === '[object ArrayBuffer]';
}
/**
* Determine if a value is a FormData
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an FormData, otherwise false
*/
function isFormData(val) {
return (typeof FormData !== 'undefined') && (val instanceof FormData);
}
/**
* Determine if a value is a view on an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
*/
function isArrayBufferView(val) {
var result;
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
result = ArrayBuffer.isView(val);
} else {
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
}
return result;
}
/**
* Determine if a value is a String
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a String, otherwise false
*/
function isString(val) {
return typeof val === 'string';
}
/**
* Determine if a value is a Number
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Number, otherwise false
*/
function isNumber(val) {
return typeof val === 'number';
}
/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}
/**
* Determine if a value is an Object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Object, otherwise false
*/
function isObject(val) {
return val !== null && typeof val === 'object';
}
/**
* Determine if a value is a Date
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Date, otherwise false
*/
function isDate(val) {
return toString.call(val) === '[object Date]';
}
/**
* Determine if a value is a File
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a File, otherwise false
*/
function isFile(val) {
return toString.call(val) === '[object File]';
}
/**
* Determine if a value is a Blob
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Blob, otherwise false
*/
function isBlob(val) {
return toString.call(val) === '[object Blob]';
}
/**
* Determine if a value is a Function
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Function, otherwise false
*/
function isFunction(val) {
return toString.call(val) === '[object Function]';
}
/**
* Determine if a value is a Stream
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Stream, otherwise false
*/
function isStream(val) {
return isObject(val) && isFunction(val.pipe);
}
/**
* Determine if a value is a URLSearchParams object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
*/
function isURLSearchParams(val) {
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
}
/**
* Trim excess whitespace off the beginning and end of a string
*
* @param {String} str The String to trim
* @returns {String} The String freed of excess whitespace
*/
function trim(str) {
return str.replace(/^\s*/, '').replace(/\s*$/, '');
}
/**
* Determine if we're running in a standard browser environment
*
* This allows axios to run in a web worker, and react-native.
* Both environments support XMLHttpRequest, but not fully standard globals.
*
* web workers:
* typeof window -> undefined
* typeof document -> undefined
*
* react-native:
* navigator.product -> 'ReactNative'
* nativescript
* navigator.product -> 'NativeScript' or 'NS'
*/
function isStandardBrowserEnv() {
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
navigator.product === 'NativeScript' ||
navigator.product === 'NS')) {
return false;
}
return (
typeof window !== 'undefined' &&
typeof document !== 'undefined'
);
}
/**
* Iterate over an Array or an Object invoking a function for each item.
*
* If `obj` is an Array callback will be called passing
* the value, index, and complete array for each item.
*
* If 'obj' is an Object callback will be called passing
* the value, key, and complete object for each property.
*
* @param {Object|Array} obj The object to iterate
* @param {Function} fn The callback to invoke for each item
*/
function forEach(obj, fn) {
// Don't bother if no value provided
if (obj === null || typeof obj === 'undefined') {
return;
}
// Force an array if not already something iterable
if (typeof obj !== 'object') {
/*eslint no-param-reassign:0*/
obj = [obj];
}
if (isArray(obj)) {
// Iterate over array values
for (var i = 0, l = obj.length; i < l; i++) {
fn.call(null, obj[i], i, obj);
}
} else {
// Iterate over object keys
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
fn.call(null, obj[key], key, obj);
}
}
}
}
/**
* Accepts varargs expecting each argument to be an object, then
* immutably merges the properties of each object and returns result.
*
* When multiple objects contain the same key the later object in
* the arguments list will take precedence.
*
* Example:
*
* ```js
* var result = merge({foo: 123}, {foo: 456});
* console.log(result.foo); // outputs 456
* ```
*
* @param {Object} obj1 Object to merge
* @returns {Object} Result of all merge properties
*/
function merge(/* obj1, obj2, obj3, ... */) {
var result = {};
function assignValue(val, key) {
if (typeof result[key] === 'object' && typeof val === 'object') {
result[key] = merge(result[key], val);
} else {
result[key] = val;
}
}
for (var i = 0, l = arguments.length; i < l; i++) {
forEach(arguments[i], assignValue);
}
return result;
}
/**
* Function equal to merge with the difference being that no reference
* to original objects is kept.
*
* @see merge
* @param {Object} obj1 Object to merge
* @returns {Object} Result of all merge properties
*/
function deepMerge(/* obj1, obj2, obj3, ... */) {
var result = {};
function assignValue(val, key) {
if (typeof result[key] === 'object' && typeof val === 'object') {
result[key] = deepMerge(result[key], val);
} else if (typeof val === 'object') {
result[key] = deepMerge({}, val);
} else {
result[key] = val;
}
}
for (var i = 0, l = arguments.length; i < l; i++) {
forEach(arguments[i], assignValue);
}
return result;
}
/**
* Extends object a by mutably adding to it the properties of object b.
*
* @param {Object} a The object to be extended
* @param {Object} b The object to copy properties from
* @param {Object} thisArg The object to bind function to
* @return {Object} The resulting value of object a
*/
function extend(a, b, thisArg) {
forEach(b, function assignValue(val, key) {
if (thisArg && typeof val === 'function') {
a[key] = bind(val, thisArg);
} else {
a[key] = val;
}
});
return a;
}
module.exports = {
isArray: isArray,
isArrayBuffer: isArrayBuffer,
isBuffer: isBuffer,
isFormData: isFormData,
isArrayBufferView: isArrayBufferView,
isString: isString,
isNumber: isNumber,
isObject: isObject,
isUndefined: isUndefined,
isDate: isDate,
isFile: isFile,
isBlob: isBlob,
isFunction: isFunction,
isStream: isStream,
isURLSearchParams: isURLSearchParams,
isStandardBrowserEnv: isStandardBrowserEnv,
forEach: forEach,
merge: merge,
deepMerge: deepMerge,
extend: extend,
trim: trim
};
/***/ }),
/* 3 */
/***/ (function(module, exports) {
'use strict';
module.exports = function bind(fn, thisArg) {
return function wrap() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
return fn.apply(thisArg, args);
};
};
/***/ }),
/* 4 */
/***/ (function(module, exports) {
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
module.exports = function isBuffer (obj) {
return obj != null && obj.constructor != null &&
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
var buildURL = __webpack_require__(6);
var InterceptorManager = __webpack_require__(7);
var dispatchRequest = __webpack_require__(8);
var mergeConfig = __webpack_require__(22);
/**
* Create a new instance of Axios
*
* @param {Object} instanceConfig The default config for the instance
*/
function Axios(instanceConfig) {
this.defaults = instanceConfig;
this.interceptors = {
request: new InterceptorManager(),
response: new InterceptorManager()
};
}
/**
* Dispatch a request
*
* @param {Object} config The config specific for this request (merged with this.defaults)
*/
Axios.prototype.request = function request(config) {
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof config === 'string') {
config = arguments[1] || {};
config.url = arguments[0];
} else {
config = config || {};
}
config = mergeConfig(this.defaults, config);
config.method = config.method ? config.method.toLowerCase() : 'get';
// Hook up interceptors middleware
var chain = [dispatchRequest, undefined];
var promise = Promise.resolve(config);
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
chain.unshift(interceptor.fulfilled, interceptor.rejected);
});
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
chain.push(interceptor.fulfilled, interceptor.rejected);
});
while (chain.length) {
promise = promise.then(chain.shift(), chain.shift());
}
return promise;
};
Axios.prototype.getUri = function getUri(config) {
config = mergeConfig(this.defaults, config);
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
};
// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url
}));
};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, data, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url,
data: data
}));
};
});
module.exports = Axios;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
function encode(val) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+').
replace(/%5B/gi, '[').
replace(/%5D/gi, ']');
}
/**
* Build a URL by appending params to the end
*
* @param {string} url The base of the url (e.g., http://www.google.com)
* @param {object} [params] The params to be appended
* @returns {string} The formatted url
*/
module.exports = function buildURL(url, params, paramsSerializer) {
/*eslint no-param-reassign:0*/
if (!params) {
return url;
}
var serializedParams;
if (paramsSerializer) {
serializedParams = paramsSerializer(params);
} else if (utils.isURLSearchParams(params)) {
serializedParams = params.toString();
} else {
var parts = [];
utils.forEach(params, function serialize(val, key) {
if (val === null || typeof val === 'undefined') {
return;
}
if (utils.isArray(val)) {
key = key + '[]';
} else {
val = [val];
}
utils.forEach(val, function parseValue(v) {
if (utils.isDate(v)) {
v = v.toISOString();
} else if (utils.isObject(v)) {
v = JSON.stringify(v);
}
parts.push(encode(key) + '=' + encode(v));
});
});
serializedParams = parts.join('&');
}
if (serializedParams) {
var hashmarkIndex = url.indexOf('#');
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
}
return url;
};
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
function InterceptorManager() {
this.handlers = [];
}
/**
* Add a new interceptor to the stack
*
* @param {Function} fulfilled The function to handle `then` for a `Promise`
* @param {Function} rejected The function to handle `reject` for a `Promise`
*
* @return {Number} An ID used to remove interceptor later
*/
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
this.handlers.push({
fulfilled: fulfilled,
rejected: rejected
});
return this.handlers.length - 1;
};
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*/
InterceptorManager.prototype.eject = function eject(id) {
if (this.handlers[id]) {
this.handlers[id] = null;
}
};
/**
* Iterate over all the registered interceptors
*
* This method is particularly useful for skipping over any
* interceptors that may have become `null` calling `eject`.
*
* @param {Function} fn The function to call for each interceptor
*/
InterceptorManager.prototype.forEach = function forEach(fn) {
utils.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
});
};
module.exports = InterceptorManager;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
var transformData = __webpack_require__(9);
var isCancel = __webpack_require__(10);
var defaults = __webpack_require__(11);
var isAbsoluteURL = __webpack_require__(20);
var combineURLs = __webpack_require__(21);
/**
* Throws a `Cancel` if cancellation has been requested.
*/
function throwIfCancellationRequested(config) {
if (config.cancelToken) {
config.cancelToken.throwIfRequested();
}
}
/**
* Dispatch a request to the server using the configured adapter.
*
* @param {object} config The config that is to be used for the request
* @returns {Promise} The Promise to be fulfilled
*/
module.exports = function dispatchRequest(config) {
throwIfCancellationRequested(config);
// Support baseURL config
if (config.baseURL && !isAbsoluteURL(config.url)) {
config.url = combineURLs(config.baseURL, config.url);
}
// Ensure headers exist
config.headers = config.headers || {};
// Transform request data
config.data = transformData(
config.data,
config.headers,
config.transformRequest
);
// Flatten headers
config.headers = utils.merge(
config.headers.common || {},
config.headers[config.method] || {},
config.headers || {}
);
utils.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
function cleanHeaderConfig(method) {
delete config.headers[method];
}
);
var adapter = config.adapter || defaults.adapter;
return adapter(config).then(function onAdapterResolution(response) {
throwIfCancellationRequested(config);
// Transform response data
response.data = transformData(
response.data,
response.headers,
config.transformResponse
);
return response;
}, function onAdapterRejection(reason) {
if (!isCancel(reason)) {
throwIfCancellationRequested(config);
// Transform response data
if (reason && reason.response) {
reason.response.data = transformData(
reason.response.data,
reason.response.headers,
config.transformResponse
);
}
}
return Promise.reject(reason);
});
};
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
/**
* Transform the data for a request or a response
*
* @param {Object|String} data The data to be transformed
* @param {Array} headers The headers for the request or response
* @param {Array|Function} fns A single function or Array of functions
* @returns {*} The resulting transformed data
*/
module.exports = function transformData(data, headers, fns) {
/*eslint no-param-reassign:0*/
utils.forEach(fns, function transform(fn) {
data = fn(data, headers);
});
return data;
};
/***/ }),
/* 10 */
/***/ (function(module, exports) {
'use strict';
module.exports = function isCancel(value) {
return !!(value && value.__CANCEL__);
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
var normalizeHeaderName = __webpack_require__(12);
var DEFAULT_CONTENT_TYPE = {
'Content-Type': 'application/x-www-form-urlencoded'
};
function setContentTypeIfUnset(headers, value) {
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
headers['Content-Type'] = value;
}
}
function getDefaultAdapter() {
var adapter;
// Only Node.JS has a process variable that is of [[Class]] process
if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
// For node use HTTP adapter
adapter = __webpack_require__(13);
} else if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
adapter = __webpack_require__(13);
}
return adapter;
}
var defaults = {
adapter: getDefaultAdapter(),
transformRequest: [function transformRequest(data, headers) {
normalizeHeaderName(headers, 'Accept');
normalizeHeaderName(headers, 'Content-Type');
if (utils.isFormData(data) ||
utils.isArrayBuffer(data) ||
utils.isBuffer(data) ||
utils.isStream(data) ||
utils.isFile(data) ||
utils.isBlob(data)
) {
return data;
}
if (utils.isArrayBufferView(data)) {
return data.buffer;
}
if (utils.isURLSearchParams(data)) {
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
return data.toString();
}
if (utils.isObject(data)) {
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
return JSON.stringify(data);
}
return data;
}],
transformResponse: [function transformResponse(data) {
/*eslint no-param-reassign:0*/
if (typeof data === 'string') {
try {
data = JSON.parse(data);
} catch (e) { /* Ignore */ }
}
return data;
}],
/**
* A timeout in milliseconds to abort a request. If set to 0 (default) a
* timeout is not created.
*/
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: function validateStatus(status) {
return status >= 200 && status < 300;
}
};
defaults.headers = {
common: {
'Accept': 'application/json, text/plain, */*'
}
};
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
defaults.headers[method] = {};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
});
module.exports = defaults;
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
module.exports = function normalizeHeaderName(headers, normalizedName) {
utils.forEach(headers, function processHeader(value, name) {
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
headers[normalizedName] = value;
delete headers[name];
}
});
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
var settle = __webpack_require__(14);
var buildURL = __webpack_require__(6);
var parseHeaders = __webpack_require__(17);
var isURLSameOrigin = __webpack_require__(18);
var createError = __webpack_require__(15);
module.exports = function xhrAdapter(config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
var requestData = config.data;
var requestHeaders = config.headers;
if (utils.isFormData(requestData)) {
delete requestHeaders['Content-Type']; // Let the browser set it
}
var request = new XMLHttpRequest();
// HTTP basic authentication
if (config.auth) {
var username = config.auth.username || '';
var password = config.auth.password || '';
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
}
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
// Set the request timeout in MS
request.timeout = config.timeout;
// Listen for ready state
request.onreadystatechange = function handleLoad() {
if (!request || request.readyState !== 4) {
return;
}
// The request errored out and we didn't get a response, this will be
// handled by onerror instead
// With one exception: request that using file: protocol, most browsers
// will return status as 0 even though it's a successful request
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
return;
}
// Prepare the response
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
var response = {
data: responseData,
status: request.status,
statusText: request.statusText,
headers: responseHeaders,
config: config,
request: request
};
settle(resolve, reject, response);
// Clean up request
request = null;
};
// Handle browser request cancellation (as opposed to a manual cancellation)
request.onabort = function handleAbort() {
if (!request) {
return;
}
reject(createError('Request aborted', config, 'ECONNABORTED', request));
// Clean up request
request = null;
};
// Handle low level network errors
request.onerror = function handleError() {
// Real errors are hidden from us by the browser
// onerror should only fire if it's a network error
reject(createError('Network Error', config, null, request));
// Clean up request
request = null;
};
// Handle timeout
request.ontimeout = function handleTimeout() {
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
request));
// Clean up request
request = null;
};
// Add xsrf header
// This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native.
if (utils.isStandardBrowserEnv()) {
var cookies = __webpack_require__(19);
// Add xsrf header
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
cookies.read(config.xsrfCookieName) :
undefined;
if (xsrfValue) {
requestHeaders[config.xsrfHeaderName] = xsrfValue;
}
}
// Add headers to the request
if ('setRequestHeader' in request) {
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
// Remove Content-Type if data is undefined
delete requestHeaders[key];
} else {
// Otherwise add header to the request
request.setRequestHeader(key, val);
}
});
}
// Add withCredentials to request if needed
if (config.withCredentials) {
request.withCredentials = true;
}
// Add responseType to request if needed
if (config.responseType) {
try {
request.responseType = config.responseType;
} catch (e) {
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
if (config.responseType !== 'json') {
throw e;
}
}
}
// Handle progress if needed
if (typeof config.onDownloadProgress === 'function') {
request.addEventListener('progress', config.onDownloadProgress);
}
// Not all browsers support upload events
if (typeof config.onUploadProgress === 'function' && request.upload) {
request.upload.addEventListener('progress', config.onUploadProgress);
}
if (config.cancelToken) {
// Handle cancellation
config.cancelToken.promise.then(function onCanceled(cancel) {
if (!request) {
return;
}
request.abort();
reject(cancel);
// Clean up request
request = null;
});
}
if (requestData === undefined) {
requestData = null;
}
// Send the request
request.send(requestData);
});
};
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var createError = __webpack_require__(15);
/**
* Resolve or reject a Promise based on response status.
*
* @param {Function} resolve A function that resolves the promise.
* @param {Function} reject A function that rejects the promise.
* @param {object} response The response.
*/
module.exports = function settle(resolve, reject, response) {
var validateStatus = response.config.validateStatus;
if (!validateStatus || validateStatus(response.status)) {
resolve(response);
} else {
reject(createError(
'Request failed with status code ' + response.status,
response.config,
null,
response.request,
response
));
}
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var enhanceError = __webpack_require__(16);
/**
* Create an Error with the specified message, config, error code, request and response.
*
* @param {string} message The error message.
* @param {Object} config The config.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [request] The request.
* @param {Object} [response] The response.
* @returns {Error} The created error.
*/
module.exports = function createError(message, config, code, request, response) {
var error = new Error(message);
return enhanceError(error, config, code, request, response);
};
/***/ }),
/* 16 */
/***/ (function(module, exports) {
'use strict';
/**
* Update an Error with the specified config, error code, and response.
*
* @param {Error} error The error to update.
* @param {Object} config The config.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [request] The request.
* @param {Object} [response] The response.
* @returns {Error} The error.
*/
module.exports = function enhanceError(error, config, code, request, response) {
error.config = config;
if (code) {
error.code = code;
}
error.request = request;
error.response = response;
error.isAxiosError = true;
error.toJSON = function() {
return {
// Standard
message: this.message,
name: this.name,
// Microsoft
description: this.description,
number: this.number,
// Mozilla
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: this.config,
code: this.code
};
};
return error;
};
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
// Headers whose duplicates are ignored by node
// c.f. https://nodejs.org/api/http.html#http_message_headers
var ignoreDuplicateOf = [
'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'
];
/**
* Parse headers into an object
*
* ```
* Date: Wed, 27 Aug 2014 08:58:49 GMT
* Content-Type: application/json
* Connection: keep-alive
* Transfer-Encoding: chunked
* ```
*
* @param {String} headers Headers needing to be parsed
* @returns {Object} Headers parsed into an object
*/
module.exports = function parseHeaders(headers) {
var parsed = {};
var key;
var val;
var i;
if (!headers) { return parsed; }
utils.forEach(headers.split('\n'), function parser(line) {
i = line.indexOf(':');
key = utils.trim(line.substr(0, i)).toLowerCase();
val = utils.trim(line.substr(i + 1));
if (key) {
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
return;
}
if (key === 'set-cookie') {
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
} else {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
}
}
});
return parsed;
};
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
module.exports = (
utils.isStandardBrowserEnv() ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
var msie = /(msie|trident)/i.test(navigator.userAgent);
var urlParsingNode = document.createElement('a');
var originURL;
/**
* Parse a URL to discover it's components
*
* @param {String} url The URL to be parsed
* @returns {Object}
*/
function resolveURL(url) {
var href = url;
if (msie) {
// IE needs attribute set twice to normalize properties
urlParsingNode.setAttribute('href', href);
href = urlParsingNode.href;
}
urlParsingNode.setAttribute('href', href);
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
return {
href: urlParsingNode.href,
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
host: urlParsingNode.host,
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
hostname: urlParsingNode.hostname,
port: urlParsingNode.port,
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
urlParsingNode.pathname :
'/' + urlParsingNode.pathname
};
}
originURL = resolveURL(window.location.href);
/**
* Determine if a URL shares the same origin as the current location
*
* @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol &&
parsed.host === originURL.host);
};
})() :
// Non standard browser envs (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {
return function isURLSameOrigin() {
return true;
};
})()
);
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
module.exports = (
utils.isStandardBrowserEnv() ?
// Standard browser envs support document.cookie
(function standardBrowserEnv() {
return {
write: function write(name, value, expires, path, domain, secure) {
var cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils.isNumber(expires)) {
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils.isString(path)) {
cookie.push('path=' + path);
}
if (utils.isString(domain)) {
cookie.push('domain=' + domain);
}
if (secure === true) {
cookie.push('secure');
}
document.cookie = cookie.join('; ');
},
read: function read(name) {
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
},
remove: function remove(name) {
this.write(name, '', Date.now() - 86400000);
}
};
})() :
// Non standard browser env (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {
return {
write: function write() {},
read: function read() { return null; },
remove: function remove() {}
};
})()
);
/***/ }),
/* 20 */
/***/ (function(module, exports) {
'use strict';
/**
* Determines whether the specified URL is absolute
*
* @param {string} url The URL to test
* @returns {boolean} True if the specified URL is absolute, otherwise false
*/
module.exports = function isAbsoluteURL(url) {
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
// by any combination of letters, digits, plus, period, or hyphen.
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
};
/***/ }),
/* 21 */
/***/ (function(module, exports) {
'use strict';
/**
* Creates a new URL by combining the specified URLs
*
* @param {string} baseURL The base URL
* @param {string} relativeURL The relative URL
* @returns {string} The combined URL
*/
module.exports = function combineURLs(baseURL, relativeURL) {
return relativeURL
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
: baseURL;
};
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var utils = __webpack_require__(2);
/**
* Config-specific merge-function which creates a new config-object
* by merging two configuration objects together.
*
* @param {Object} config1
* @param {Object} config2
* @returns {Object} New object resulting from merging config2 to config1
*/
module.exports = function mergeConfig(config1, config2) {
// eslint-disable-next-line no-param-reassign
config2 = config2 || {};
var config = {};
utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
if (typeof config2[prop] !== 'undefined') {
config[prop] = config2[prop];
}
});
utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
if (utils.isObject(config2[prop])) {
config[prop] = utils.deepMerge(config1[prop], config2[prop]);
} else if (typeof config2[prop] !== 'undefined') {
config[prop] = config2[prop];
} else if (utils.isObject(config1[prop])) {
config[prop] = utils.deepMerge(config1[prop]);
} else if (typeof config1[prop] !== 'undefined') {
config[prop] = config1[prop];
}
});
utils.forEach([
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
'socketPath'
], function defaultToConfig2(prop) {
if (typeof config2[prop] !== 'undefined') {
config[prop] = config2[prop];
} else if (typeof config1[prop] !== 'undefined') {
config[prop] = config1[prop];
}
});
return config;
};
/***/ }),
/* 23 */
/***/ (function(module, exports) {
'use strict';
/**
* A `Cancel` is an object that is thrown when an operation is canceled.
*
* @class
* @param {string=} message The message.
*/
function Cancel(message) {
this.message = message;
}
Cancel.prototype.toString = function toString() {
return 'Cancel' + (this.message ? ': ' + this.message : '');
};
Cancel.prototype.__CANCEL__ = true;
module.exports = Cancel;
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var Cancel = __webpack_require__(23);
/**
* A `CancelToken` is an object that can be used to request cancellation of an operation.
*
* @class
* @param {Function} executor The executor function.
*/
function CancelToken(executor) {
if (typeof executor !== 'function') {
throw new TypeError('executor must be a function.');
}
var resolvePromise;
this.promise = new Promise(function promiseExecutor(resolve) {
resolvePromise = resolve;
});
var token = this;
executor(function cancel(message) {
if (token.reason) {
// Cancellation has already been requested
return;
}
token.reason = new Cancel(message);
resolvePromise(token.reason);
});
}
/**
* Throws a `Cancel` if cancellation has been requested.
*/
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
if (this.reason) {
throw this.reason;
}
};
/**
* Returns an object that contains a new `CancelToken` and a function that, when called,
* cancels the `CancelToken`.
*/
CancelToken.source = function source() {
var cancel;
var token = new CancelToken(function executor(c) {
cancel = c;
});
return {
token: token,
cancel: cancel
};
};
module.exports = CancelToken;
/***/ }),
/* 25 */
/***/ (function(module, exports) {
'use strict';
/**
* Syntactic sugar for invoking a function and expanding an array for arguments.
*
* Common use case would be to use `Function.prototype.apply`.
*
* ```js
* function f(x, y, z) {}
* var args = [1, 2, 3];
* f.apply(null, args);
* ```
*
* With `spread` this example can be re-written.
*
* ```js
* spread(function(x, y, z) {})([1, 2, 3]);
* ```
*
* @param {Function} callback
* @returns {Function}
*/
module.exports = function spread(callback) {
return function wrap(arr) {
return callback.apply(null, arr);
};
};
/***/ })
/******/ ])
});
;
//# sourceMappingURL=axios.map
\ No newline at end of file
{"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
/* axios v0.19.0 | (c) 2019 by Matt Zabriskie */
!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){/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
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)}}}])});
//# sourceMappingURL=axios.min.map
\ No newline at end of file
This diff could not be displayed because it is too large.
export interface AxiosTransformer {
(data: any, headers?: any): any;
}
export interface AxiosAdapter {
(config: AxiosRequestConfig): AxiosPromise<any>;
}
export interface AxiosBasicCredentials {
username: string;
password: string;
}
export interface AxiosProxyConfig {
host: string;
port: number;
auth?: {
username: string;
password:string;
};
protocol?: string;
}
export type Method =
| 'get' | 'GET'
| 'delete' | 'DELETE'
| 'head' | 'HEAD'
| 'options' | 'OPTIONS'
| 'post' | 'POST'
| 'put' | 'PUT'
| 'patch' | 'PATCH'
export type ResponseType =
| 'arraybuffer'
| 'blob'
| 'document'
| 'json'
| 'text'
| 'stream'
export interface AxiosRequestConfig {
url?: string;
method?: Method;
baseURL?: string;
transformRequest?: AxiosTransformer | AxiosTransformer[];
transformResponse?: AxiosTransformer | AxiosTransformer[];
headers?: any;
params?: any;
paramsSerializer?: (params: any) => string;
data?: any;
timeout?: number;
withCredentials?: boolean;
adapter?: AxiosAdapter;
auth?: AxiosBasicCredentials;
responseType?: ResponseType;
xsrfCookieName?: string;
xsrfHeaderName?: string;
onUploadProgress?: (progressEvent: any) => void;
onDownloadProgress?: (progressEvent: any) => void;
maxContentLength?: number;
validateStatus?: (status: number) => boolean;
maxRedirects?: number;
socketPath?: string | null;
httpAgent?: any;
httpsAgent?: any;
proxy?: AxiosProxyConfig | false;
cancelToken?: CancelToken;
}
export interface AxiosResponse<T = any> {
data: T;
status: number;
statusText: string;
headers: any;
config: AxiosRequestConfig;
request?: any;
}
export interface AxiosError<T = any> extends Error {
config: AxiosRequestConfig;
code?: string;
request?: any;
response?: AxiosResponse<T>;
isAxiosError: boolean;
}
export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
}
export interface CancelStatic {
new (message?: string): Cancel;
}
export interface Cancel {
message: string;
}
export interface Canceler {
(message?: string): void;
}
export interface CancelTokenStatic {
new (executor: (cancel: Canceler) => void): CancelToken;
source(): CancelTokenSource;
}
export interface CancelToken {
promise: Promise<Cancel>;
reason?: Cancel;
throwIfRequested(): void;
}
export interface CancelTokenSource {
token: CancelToken;
cancel: Canceler;
}
export interface AxiosInterceptorManager<V> {
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
eject(id: number): void;
}
export interface AxiosInstance {
(config: AxiosRequestConfig): AxiosPromise;
(url: string, config?: AxiosRequestConfig): AxiosPromise;
defaults: AxiosRequestConfig;
interceptors: {
request: AxiosInterceptorManager<AxiosRequestConfig>;
response: AxiosInterceptorManager<AxiosResponse>;
};
getUri(config?: AxiosRequestConfig): string;
request<T = any, R = AxiosResponse<T>> (config: AxiosRequestConfig): Promise<R>;
get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
}
export interface AxiosStatic extends AxiosInstance {
create(config?: AxiosRequestConfig): AxiosInstance;
Cancel: CancelStatic;
CancelToken: CancelTokenStatic;
isCancel(value: any): boolean;
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
}
declare const Axios: AxiosStatic;
export default Axios;
'use strict';
var utils = require('./../utils');
var settle = require('./../core/settle');
var buildURL = require('./../helpers/buildURL');
var http = require('http');
var https = require('https');
var httpFollow = require('follow-redirects').http;
var httpsFollow = require('follow-redirects').https;
var url = require('url');
var zlib = require('zlib');
var pkg = require('./../../package.json');
var createError = require('../core/createError');
var enhanceError = require('../core/enhanceError');
var isHttps = /https:?/;
/*eslint consistent-return:0*/
module.exports = function httpAdapter(config) {
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
var timer;
var resolve = function resolve(value) {
clearTimeout(timer);
resolvePromise(value);
};
var reject = function reject(value) {
clearTimeout(timer);
rejectPromise(value);
};
var data = config.data;
var headers = config.headers;
// Set User-Agent (required by some servers)
// Only set header if it hasn't been set in config
// See https://github.com/axios/axios/issues/69
if (!headers['User-Agent'] && !headers['user-agent']) {
headers['User-Agent'] = 'axios/' + pkg.version;
}
if (data && !utils.isStream(data)) {
if (Buffer.isBuffer(data)) {
// Nothing to do...
} else if (utils.isArrayBuffer(data)) {
data = Buffer.from(new Uint8Array(data));
} else if (utils.isString(data)) {
data = Buffer.from(data, 'utf-8');
} else {
return reject(createError(
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
config
));
}
// Add Content-Length header if data exists
headers['Content-Length'] = data.length;
}
// HTTP basic authentication
var auth = undefined;
if (config.auth) {
var username = config.auth.username || '';
var password = config.auth.password || '';
auth = username + ':' + password;
}
// Parse url
var parsed = url.parse(config.url);
var protocol = parsed.protocol || 'http:';
if (!auth && parsed.auth) {
var urlAuth = parsed.auth.split(':');
var urlUsername = urlAuth[0] || '';
var urlPassword = urlAuth[1] || '';
auth = urlUsername + ':' + urlPassword;
}
if (auth) {
delete headers.Authorization;
}
var isHttpsRequest = isHttps.test(protocol);
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
var options = {
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
method: config.method.toUpperCase(),
headers: headers,
agent: agent,
auth: auth
};
if (config.socketPath) {
options.socketPath = config.socketPath;
} else {
options.hostname = parsed.hostname;
options.port = parsed.port;
}
var proxy = config.proxy;
if (!proxy && proxy !== false) {
var proxyEnv = protocol.slice(0, -1) + '_proxy';
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
if (proxyUrl) {
var parsedProxyUrl = url.parse(proxyUrl);
var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
var shouldProxy = true;
if (noProxyEnv) {
var noProxy = noProxyEnv.split(',').map(function trim(s) {
return s.trim();
});
shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
if (!proxyElement) {
return false;
}
if (proxyElement === '*') {
return true;
}
if (proxyElement[0] === '.' &&
parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement &&
proxyElement.match(/\./g).length === parsed.hostname.match(/\./g).length) {
return true;
}
return parsed.hostname === proxyElement;
});
}
if (shouldProxy) {
proxy = {
host: parsedProxyUrl.hostname,
port: parsedProxyUrl.port
};
if (parsedProxyUrl.auth) {
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
proxy.auth = {
username: proxyUrlAuth[0],
password: proxyUrlAuth[1]
};
}
}
}
}
if (proxy) {
options.hostname = proxy.host;
options.host = proxy.host;
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
options.port = proxy.port;
options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path;
// Basic proxy authorization
if (proxy.auth) {
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
}
}
var transport;
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
if (config.transport) {
transport = config.transport;
} else if (config.maxRedirects === 0) {
transport = isHttpsProxy ? https : http;
} else {
if (config.maxRedirects) {
options.maxRedirects = config.maxRedirects;
}
transport = isHttpsProxy ? httpsFollow : httpFollow;
}
if (config.maxContentLength && config.maxContentLength > -1) {
options.maxBodyLength = config.maxContentLength;
}
// Create the request
var req = transport.request(options, function handleResponse(res) {
if (req.aborted) return;
// uncompress the response body transparently if required
var stream = res;
switch (res.headers['content-encoding']) {
/*eslint default-case:0*/
case 'gzip':
case 'compress':
case 'deflate':
// add the unzipper to the body stream processing pipeline
stream = (res.statusCode === 204) ? stream : stream.pipe(zlib.createUnzip());
// remove the content-encoding in order to not confuse downstream operations
delete res.headers['content-encoding'];
break;
}
// return the last request in case of redirects
var lastRequest = res.req || req;
var response = {
status: res.statusCode,
statusText: res.statusMessage,
headers: res.headers,
config: config,
request: lastRequest
};
if (config.responseType === 'stream') {
response.data = stream;
settle(resolve, reject, response);
} else {
var responseBuffer = [];
stream.on('data', function handleStreamData(chunk) {
responseBuffer.push(chunk);
// make sure the content length is not over the maxContentLength if specified
if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
stream.destroy();
reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
config, null, lastRequest));
}
});
stream.on('error', function handleStreamError(err) {
if (req.aborted) return;
reject(enhanceError(err, config, null, lastRequest));
});
stream.on('end', function handleStreamEnd() {
var responseData = Buffer.concat(responseBuffer);
if (config.responseType !== 'arraybuffer') {
responseData = responseData.toString(config.responseEncoding);
}
response.data = responseData;
settle(resolve, reject, response);
});
}
});
// Handle errors
req.on('error', function handleRequestError(err) {
if (req.aborted) return;
reject(enhanceError(err, config, null, req));
});
// Handle request timeout
if (config.timeout) {
timer = setTimeout(function handleRequestTimeout() {
req.abort();
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
}, config.timeout);
}
if (config.cancelToken) {
// Handle cancellation
config.cancelToken.promise.then(function onCanceled(cancel) {
if (req.aborted) return;
req.abort();
reject(cancel);
});
}
// Send the request
if (utils.isStream(data)) {
data.on('error', function handleStreamError(err) {
reject(enhanceError(err, config, null, req));
}).pipe(req);
} else {
req.end(data);
}
});
};
'use strict';
var utils = require('./../utils');
var settle = require('./../core/settle');
var buildURL = require('./../helpers/buildURL');
var parseHeaders = require('./../helpers/parseHeaders');
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
var createError = require('../core/createError');
module.exports = function xhrAdapter(config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
var requestData = config.data;
var requestHeaders = config.headers;
if (utils.isFormData(requestData)) {
delete requestHeaders['Content-Type']; // Let the browser set it
}
var request = new XMLHttpRequest();
// HTTP basic authentication
if (config.auth) {
var username = config.auth.username || '';
var password = config.auth.password || '';
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
}
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
// Set the request timeout in MS
request.timeout = config.timeout;
// Listen for ready state
request.onreadystatechange = function handleLoad() {
if (!request || request.readyState !== 4) {
return;
}
// The request errored out and we didn't get a response, this will be
// handled by onerror instead
// With one exception: request that using file: protocol, most browsers
// will return status as 0 even though it's a successful request
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
return;
}
// Prepare the response
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
var response = {
data: responseData,
status: request.status,
statusText: request.statusText,
headers: responseHeaders,
config: config,
request: request
};
settle(resolve, reject, response);
// Clean up request
request = null;
};
// Handle browser request cancellation (as opposed to a manual cancellation)
request.onabort = function handleAbort() {
if (!request) {
return;
}
reject(createError('Request aborted', config, 'ECONNABORTED', request));
// Clean up request
request = null;
};
// Handle low level network errors
request.onerror = function handleError() {
// Real errors are hidden from us by the browser
// onerror should only fire if it's a network error
reject(createError('Network Error', config, null, request));
// Clean up request
request = null;
};
// Handle timeout
request.ontimeout = function handleTimeout() {
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
request));
// Clean up request
request = null;
};
// Add xsrf header
// This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native.
if (utils.isStandardBrowserEnv()) {
var cookies = require('./../helpers/cookies');
// Add xsrf header
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
cookies.read(config.xsrfCookieName) :
undefined;
if (xsrfValue) {
requestHeaders[config.xsrfHeaderName] = xsrfValue;
}
}
// Add headers to the request
if ('setRequestHeader' in request) {
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
// Remove Content-Type if data is undefined
delete requestHeaders[key];
} else {
// Otherwise add header to the request
request.setRequestHeader(key, val);
}
});
}
// Add withCredentials to request if needed
if (config.withCredentials) {
request.withCredentials = true;
}
// Add responseType to request if needed
if (config.responseType) {
try {
request.responseType = config.responseType;
} catch (e) {
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
if (config.responseType !== 'json') {
throw e;
}
}
}
// Handle progress if needed
if (typeof config.onDownloadProgress === 'function') {
request.addEventListener('progress', config.onDownloadProgress);
}
// Not all browsers support upload events
if (typeof config.onUploadProgress === 'function' && request.upload) {
request.upload.addEventListener('progress', config.onUploadProgress);
}
if (config.cancelToken) {
// Handle cancellation
config.cancelToken.promise.then(function onCanceled(cancel) {
if (!request) {
return;
}
request.abort();
reject(cancel);
// Clean up request
request = null;
});
}
if (requestData === undefined) {
requestData = null;
}
// Send the request
request.send(requestData);
});
};
'use strict';
var utils = require('./utils');
var bind = require('./helpers/bind');
var Axios = require('./core/Axios');
var mergeConfig = require('./core/mergeConfig');
var defaults = require('./defaults');
/**
* Create an instance of Axios
*
* @param {Object} defaultConfig The default config for the instance
* @return {Axios} A new instance of Axios
*/
function createInstance(defaultConfig) {
var context = new Axios(defaultConfig);
var instance = bind(Axios.prototype.request, context);
// Copy axios.prototype to instance
utils.extend(instance, Axios.prototype, context);
// Copy context to instance
utils.extend(instance, context);
return instance;
}
// Create the default instance to be exported
var axios = createInstance(defaults);
// Expose Axios class to allow class inheritance
axios.Axios = Axios;
// Factory for creating new instances
axios.create = function create(instanceConfig) {
return createInstance(mergeConfig(axios.defaults, instanceConfig));
};
// Expose Cancel & CancelToken
axios.Cancel = require('./cancel/Cancel');
axios.CancelToken = require('./cancel/CancelToken');
axios.isCancel = require('./cancel/isCancel');
// Expose all/spread
axios.all = function all(promises) {
return Promise.all(promises);
};
axios.spread = require('./helpers/spread');
module.exports = axios;
// Allow use of default import syntax in TypeScript
module.exports.default = axios;
'use strict';
var utils = require('./../utils');
var buildURL = require('../helpers/buildURL');
var InterceptorManager = require('./InterceptorManager');
var dispatchRequest = require('./dispatchRequest');
var mergeConfig = require('./mergeConfig');
/**
* Create a new instance of Axios
*
* @param {Object} instanceConfig The default config for the instance
*/
function Axios(instanceConfig) {
this.defaults = instanceConfig;
this.interceptors = {
request: new InterceptorManager(),
response: new InterceptorManager()
};
}
/**
* Dispatch a request
*
* @param {Object} config The config specific for this request (merged with this.defaults)
*/
Axios.prototype.request = function request(config) {
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof config === 'string') {
config = arguments[1] || {};
config.url = arguments[0];
} else {
config = config || {};
}
config = mergeConfig(this.defaults, config);
config.method = config.method ? config.method.toLowerCase() : 'get';
// Hook up interceptors middleware
var chain = [dispatchRequest, undefined];
var promise = Promise.resolve(config);
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
chain.unshift(interceptor.fulfilled, interceptor.rejected);
});
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
chain.push(interceptor.fulfilled, interceptor.rejected);
});
while (chain.length) {
promise = promise.then(chain.shift(), chain.shift());
}
return promise;
};
Axios.prototype.getUri = function getUri(config) {
config = mergeConfig(this.defaults, config);
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
};
// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url
}));
};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, data, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url,
data: data
}));
};
});
module.exports = Axios;
'use strict';
var utils = require('./../utils');
var transformData = require('./transformData');
var isCancel = require('../cancel/isCancel');
var defaults = require('../defaults');
var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
var combineURLs = require('./../helpers/combineURLs');
/**
* Throws a `Cancel` if cancellation has been requested.
*/
function throwIfCancellationRequested(config) {
if (config.cancelToken) {
config.cancelToken.throwIfRequested();
}
}
/**
* Dispatch a request to the server using the configured adapter.
*
* @param {object} config The config that is to be used for the request
* @returns {Promise} The Promise to be fulfilled
*/
module.exports = function dispatchRequest(config) {
throwIfCancellationRequested(config);
// Support baseURL config
if (config.baseURL && !isAbsoluteURL(config.url)) {
config.url = combineURLs(config.baseURL, config.url);
}
// Ensure headers exist
config.headers = config.headers || {};
// Transform request data
config.data = transformData(
config.data,
config.headers,
config.transformRequest
);
// Flatten headers
config.headers = utils.merge(
config.headers.common || {},
config.headers[config.method] || {},
config.headers || {}
);
utils.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
function cleanHeaderConfig(method) {
delete config.headers[method];
}
);
var adapter = config.adapter || defaults.adapter;
return adapter(config).then(function onAdapterResolution(response) {
throwIfCancellationRequested(config);
// Transform response data
response.data = transformData(
response.data,
response.headers,
config.transformResponse
);
return response;
}, function onAdapterRejection(reason) {
if (!isCancel(reason)) {
throwIfCancellationRequested(config);
// Transform response data
if (reason && reason.response) {
reason.response.data = transformData(
reason.response.data,
reason.response.headers,
config.transformResponse
);
}
}
return Promise.reject(reason);
});
};
'use strict';
/**
* Update an Error with the specified config, error code, and response.
*
* @param {Error} error The error to update.
* @param {Object} config The config.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [request] The request.
* @param {Object} [response] The response.
* @returns {Error} The error.
*/
module.exports = function enhanceError(error, config, code, request, response) {
error.config = config;
if (code) {
error.code = code;
}
error.request = request;
error.response = response;
error.isAxiosError = true;
error.toJSON = function() {
return {
// Standard
message: this.message,
name: this.name,
// Microsoft
description: this.description,
number: this.number,
// Mozilla
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: this.config,
code: this.code
};
};
return error;
};
'use strict';
var utils = require('../utils');
/**
* Config-specific merge-function which creates a new config-object
* by merging two configuration objects together.
*
* @param {Object} config1
* @param {Object} config2
* @returns {Object} New object resulting from merging config2 to config1
*/
module.exports = function mergeConfig(config1, config2) {
// eslint-disable-next-line no-param-reassign
config2 = config2 || {};
var config = {};
utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
if (typeof config2[prop] !== 'undefined') {
config[prop] = config2[prop];
}
});
utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
if (utils.isObject(config2[prop])) {
config[prop] = utils.deepMerge(config1[prop], config2[prop]);
} else if (typeof config2[prop] !== 'undefined') {
config[prop] = config2[prop];
} else if (utils.isObject(config1[prop])) {
config[prop] = utils.deepMerge(config1[prop]);
} else if (typeof config1[prop] !== 'undefined') {
config[prop] = config1[prop];
}
});
utils.forEach([
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
'socketPath'
], function defaultToConfig2(prop) {
if (typeof config2[prop] !== 'undefined') {
config[prop] = config2[prop];
} else if (typeof config1[prop] !== 'undefined') {
config[prop] = config1[prop];
}
});
return config;
};
'use strict';
var createError = require('./createError');
/**
* Resolve or reject a Promise based on response status.
*
* @param {Function} resolve A function that resolves the promise.
* @param {Function} reject A function that rejects the promise.
* @param {object} response The response.
*/
module.exports = function settle(resolve, reject, response) {
var validateStatus = response.config.validateStatus;
if (!validateStatus || validateStatus(response.status)) {
resolve(response);
} else {
reject(createError(
'Request failed with status code ' + response.status,
response.config,
null,
response.request,
response
));
}
};
'use strict';
var utils = require('./utils');
var normalizeHeaderName = require('./helpers/normalizeHeaderName');
var DEFAULT_CONTENT_TYPE = {
'Content-Type': 'application/x-www-form-urlencoded'
};
function setContentTypeIfUnset(headers, value) {
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
headers['Content-Type'] = value;
}
}
function getDefaultAdapter() {
var adapter;
// Only Node.JS has a process variable that is of [[Class]] process
if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
// For node use HTTP adapter
adapter = require('./adapters/http');
} else if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
adapter = require('./adapters/xhr');
}
return adapter;
}
var defaults = {
adapter: getDefaultAdapter(),
transformRequest: [function transformRequest(data, headers) {
normalizeHeaderName(headers, 'Accept');
normalizeHeaderName(headers, 'Content-Type');
if (utils.isFormData(data) ||
utils.isArrayBuffer(data) ||
utils.isBuffer(data) ||
utils.isStream(data) ||
utils.isFile(data) ||
utils.isBlob(data)
) {
return data;
}
if (utils.isArrayBufferView(data)) {
return data.buffer;
}
if (utils.isURLSearchParams(data)) {
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
return data.toString();
}
if (utils.isObject(data)) {
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
return JSON.stringify(data);
}
return data;
}],
transformResponse: [function transformResponse(data) {
/*eslint no-param-reassign:0*/
if (typeof data === 'string') {
try {
data = JSON.parse(data);
} catch (e) { /* Ignore */ }
}
return data;
}],
/**
* A timeout in milliseconds to abort a request. If set to 0 (default) a
* timeout is not created.
*/
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: function validateStatus(status) {
return status >= 200 && status < 300;
}
};
defaults.headers = {
common: {
'Accept': 'application/json, text/plain, */*'
}
};
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
defaults.headers[method] = {};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
});
module.exports = defaults;
'use strict';
var utils = require('./../utils');
function encode(val) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+').
replace(/%5B/gi, '[').
replace(/%5D/gi, ']');
}
/**
* Build a URL by appending params to the end
*
* @param {string} url The base of the url (e.g., http://www.google.com)
* @param {object} [params] The params to be appended
* @returns {string} The formatted url
*/
module.exports = function buildURL(url, params, paramsSerializer) {
/*eslint no-param-reassign:0*/
if (!params) {
return url;
}
var serializedParams;
if (paramsSerializer) {
serializedParams = paramsSerializer(params);
} else if (utils.isURLSearchParams(params)) {
serializedParams = params.toString();
} else {
var parts = [];
utils.forEach(params, function serialize(val, key) {
if (val === null || typeof val === 'undefined') {
return;
}
if (utils.isArray(val)) {
key = key + '[]';
} else {
val = [val];
}
utils.forEach(val, function parseValue(v) {
if (utils.isDate(v)) {
v = v.toISOString();
} else if (utils.isObject(v)) {
v = JSON.stringify(v);
}
parts.push(encode(key) + '=' + encode(v));
});
});
serializedParams = parts.join('&');
}
if (serializedParams) {
var hashmarkIndex = url.indexOf('#');
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
}
return url;
};
'use strict';
var utils = require('./../utils');
module.exports = (
utils.isStandardBrowserEnv() ?
// Standard browser envs support document.cookie
(function standardBrowserEnv() {
return {
write: function write(name, value, expires, path, domain, secure) {
var cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils.isNumber(expires)) {
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils.isString(path)) {
cookie.push('path=' + path);
}
if (utils.isString(domain)) {
cookie.push('domain=' + domain);
}
if (secure === true) {
cookie.push('secure');
}
document.cookie = cookie.join('; ');
},
read: function read(name) {
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
},
remove: function remove(name) {
this.write(name, '', Date.now() - 86400000);
}
};
})() :
// Non standard browser env (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {
return {
write: function write() {},
read: function read() { return null; },
remove: function remove() {}
};
})()
);
'use strict';
var utils = require('./../utils');
module.exports = (
utils.isStandardBrowserEnv() ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
var msie = /(msie|trident)/i.test(navigator.userAgent);
var urlParsingNode = document.createElement('a');
var originURL;
/**
* Parse a URL to discover it's components
*
* @param {String} url The URL to be parsed
* @returns {Object}
*/
function resolveURL(url) {
var href = url;
if (msie) {
// IE needs attribute set twice to normalize properties
urlParsingNode.setAttribute('href', href);
href = urlParsingNode.href;
}
urlParsingNode.setAttribute('href', href);
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
return {
href: urlParsingNode.href,
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
host: urlParsingNode.host,
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
hostname: urlParsingNode.hostname,
port: urlParsingNode.port,
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
urlParsingNode.pathname :
'/' + urlParsingNode.pathname
};
}
originURL = resolveURL(window.location.href);
/**
* Determine if a URL shares the same origin as the current location
*
* @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol &&
parsed.host === originURL.host);
};
})() :
// Non standard browser envs (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {
return function isURLSameOrigin() {
return true;
};
})()
);
'use strict';
var utils = require('./../utils');
// Headers whose duplicates are ignored by node
// c.f. https://nodejs.org/api/http.html#http_message_headers
var ignoreDuplicateOf = [
'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'
];
/**
* Parse headers into an object
*
* ```
* Date: Wed, 27 Aug 2014 08:58:49 GMT
* Content-Type: application/json
* Connection: keep-alive
* Transfer-Encoding: chunked
* ```
*
* @param {String} headers Headers needing to be parsed
* @returns {Object} Headers parsed into an object
*/
module.exports = function parseHeaders(headers) {
var parsed = {};
var key;
var val;
var i;
if (!headers) { return parsed; }
utils.forEach(headers.split('\n'), function parser(line) {
i = line.indexOf(':');
key = utils.trim(line.substr(0, i)).toLowerCase();
val = utils.trim(line.substr(i + 1));
if (key) {
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
return;
}
if (key === 'set-cookie') {
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
} else {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
}
}
});
return parsed;
};
'use strict';
var bind = require('./helpers/bind');
var isBuffer = require('is-buffer');
/*global toString:true*/
// utils is a library of generic helper functions non-specific to axios
var toString = Object.prototype.toString;
/**
* Determine if a value is an Array
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Array, otherwise false
*/
function isArray(val) {
return toString.call(val) === '[object Array]';
}
/**
* Determine if a value is an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
*/
function isArrayBuffer(val) {
return toString.call(val) === '[object ArrayBuffer]';
}
/**
* Determine if a value is a FormData
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an FormData, otherwise false
*/
function isFormData(val) {
return (typeof FormData !== 'undefined') && (val instanceof FormData);
}
/**
* Determine if a value is a view on an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
*/
function isArrayBufferView(val) {
var result;
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
result = ArrayBuffer.isView(val);
} else {
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
}
return result;
}
/**
* Determine if a value is a String
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a String, otherwise false
*/
function isString(val) {
return typeof val === 'string';
}
/**
* Determine if a value is a Number
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Number, otherwise false
*/
function isNumber(val) {
return typeof val === 'number';
}
/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}
/**
* Determine if a value is an Object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Object, otherwise false
*/
function isObject(val) {
return val !== null && typeof val === 'object';
}
/**
* Determine if a value is a Date
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Date, otherwise false
*/
function isDate(val) {
return toString.call(val) === '[object Date]';
}
/**
* Determine if a value is a File
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a File, otherwise false
*/
function isFile(val) {
return toString.call(val) === '[object File]';
}
/**
* Determine if a value is a Blob
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Blob, otherwise false
*/
function isBlob(val) {
return toString.call(val) === '[object Blob]';
}
/**
* Determine if a value is a Function
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Function, otherwise false
*/
function isFunction(val) {
return toString.call(val) === '[object Function]';
}
/**
* Determine if a value is a Stream
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Stream, otherwise false
*/
function isStream(val) {
return isObject(val) && isFunction(val.pipe);
}
/**
* Determine if a value is a URLSearchParams object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
*/
function isURLSearchParams(val) {
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
}
/**
* Trim excess whitespace off the beginning and end of a string
*
* @param {String} str The String to trim
* @returns {String} The String freed of excess whitespace
*/
function trim(str) {
return str.replace(/^\s*/, '').replace(/\s*$/, '');
}
/**
* Determine if we're running in a standard browser environment
*
* This allows axios to run in a web worker, and react-native.
* Both environments support XMLHttpRequest, but not fully standard globals.
*
* web workers:
* typeof window -> undefined
* typeof document -> undefined
*
* react-native:
* navigator.product -> 'ReactNative'
* nativescript
* navigator.product -> 'NativeScript' or 'NS'
*/
function isStandardBrowserEnv() {
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
navigator.product === 'NativeScript' ||
navigator.product === 'NS')) {
return false;
}
return (
typeof window !== 'undefined' &&
typeof document !== 'undefined'
);
}
/**
* Iterate over an Array or an Object invoking a function for each item.
*
* If `obj` is an Array callback will be called passing
* the value, index, and complete array for each item.
*
* If 'obj' is an Object callback will be called passing
* the value, key, and complete object for each property.
*
* @param {Object|Array} obj The object to iterate
* @param {Function} fn The callback to invoke for each item
*/
function forEach(obj, fn) {
// Don't bother if no value provided
if (obj === null || typeof obj === 'undefined') {
return;
}
// Force an array if not already something iterable
if (typeof obj !== 'object') {
/*eslint no-param-reassign:0*/
obj = [obj];
}
if (isArray(obj)) {
// Iterate over array values
for (var i = 0, l = obj.length; i < l; i++) {
fn.call(null, obj[i], i, obj);
}
} else {
// Iterate over object keys
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
fn.call(null, obj[key], key, obj);
}
}
}
}
/**
* Accepts varargs expecting each argument to be an object, then
* immutably merges the properties of each object and returns result.
*
* When multiple objects contain the same key the later object in
* the arguments list will take precedence.
*
* Example:
*
* ```js
* var result = merge({foo: 123}, {foo: 456});
* console.log(result.foo); // outputs 456
* ```
*
* @param {Object} obj1 Object to merge
* @returns {Object} Result of all merge properties
*/
function merge(/* obj1, obj2, obj3, ... */) {
var result = {};
function assignValue(val, key) {
if (typeof result[key] === 'object' && typeof val === 'object') {
result[key] = merge(result[key], val);
} else {
result[key] = val;
}
}
for (var i = 0, l = arguments.length; i < l; i++) {
forEach(arguments[i], assignValue);
}
return result;
}
/**
* Function equal to merge with the difference being that no reference
* to original objects is kept.
*
* @see merge
* @param {Object} obj1 Object to merge
* @returns {Object} Result of all merge properties
*/
function deepMerge(/* obj1, obj2, obj3, ... */) {
var result = {};
function assignValue(val, key) {
if (typeof result[key] === 'object' && typeof val === 'object') {
result[key] = deepMerge(result[key], val);
} else if (typeof val === 'object') {
result[key] = deepMerge({}, val);
} else {
result[key] = val;
}
}
for (var i = 0, l = arguments.length; i < l; i++) {
forEach(arguments[i], assignValue);
}
return result;
}
/**
* Extends object a by mutably adding to it the properties of object b.
*
* @param {Object} a The object to be extended
* @param {Object} b The object to copy properties from
* @param {Object} thisArg The object to bind function to
* @return {Object} The resulting value of object a
*/
function extend(a, b, thisArg) {
forEach(b, function assignValue(val, key) {
if (thisArg && typeof val === 'function') {
a[key] = bind(val, thisArg);
} else {
a[key] = val;
}
});
return a;
}
module.exports = {
isArray: isArray,
isArrayBuffer: isArrayBuffer,
isBuffer: isBuffer,
isFormData: isFormData,
isArrayBufferView: isArrayBufferView,
isString: isString,
isNumber: isNumber,
isObject: isObject,
isUndefined: isUndefined,
isDate: isDate,
isFile: isFile,
isBlob: isBlob,
isFunction: isFunction,
isStream: isStream,
isURLSearchParams: isURLSearchParams,
isStandardBrowserEnv: isStandardBrowserEnv,
forEach: forEach,
merge: merge,
deepMerge: deepMerge,
extend: extend,
trim: trim
};
{
"_from": "axios@^0.19.0",
"_id": "axios@0.19.0",
"_inBundle": false,
"_integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"_location": "/axios",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "axios@^0.19.0",
"name": "axios",
"escapedName": "axios",
"rawSpec": "^0.19.0",
"saveSpec": null,
"fetchSpec": "^0.19.0"
},
"_requiredBy": [
"/@line/bot-sdk"
],
"_resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"_shasum": "8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8",
"_spec": "axios@^0.19.0",
"_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\@line\\bot-sdk",
"author": {
"name": "Matt Zabriskie"
},
"browser": {
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
},
"bugs": {
"url": "https://github.com/axios/axios/issues"
},
"bundleDependencies": false,
"bundlesize": [
{
"path": "./dist/axios.min.js",
"threshold": "5kB"
}
],
"dependencies": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
},
"deprecated": false,
"description": "Promise based HTTP client for the browser and node.js",
"devDependencies": {
"bundlesize": "^0.17.0",
"coveralls": "^3.0.0",
"es6-promise": "^4.2.4",
"grunt": "^1.0.2",
"grunt-banner": "^0.6.0",
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^20.1.0",
"grunt-karma": "^2.0.0",
"grunt-mocha-test": "^0.13.3",
"grunt-ts": "^6.0.0-beta.19",
"grunt-webpack": "^1.0.18",
"istanbul-instrumenter-loader": "^1.0.0",
"jasmine-core": "^2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.1.0",
"karma-jasmine": "^1.1.1",
"karma-jasmine-ajax": "^0.1.13",
"karma-opera-launcher": "^1.0.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^1.2.0",
"karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"load-grunt-tasks": "^3.5.2",
"minimist": "^1.2.0",
"mocha": "^5.2.0",
"sinon": "^4.5.0",
"typescript": "^2.8.1",
"url-search-params": "^0.10.0",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"homepage": "https://github.com/axios/axios",
"keywords": [
"xhr",
"http",
"ajax",
"promise",
"node"
],
"license": "MIT",
"main": "index.js",
"name": "axios",
"repository": {
"type": "git",
"url": "git+https://github.com/axios/axios.git"
},
"scripts": {
"build": "NODE_ENV=production grunt build",
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"examples": "node ./examples/server.js",
"fix": "eslint --fix lib/**/*.js",
"postversion": "git push && git push --tags",
"preversion": "npm test",
"start": "node ./sandbox/server.js",
"test": "grunt test && bundlesize",
"version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
},
"typings": "./index.d.ts",
"version": "0.19.0"
}
# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg
[travis-url]: https://travis-ci.org/feross/is-buffer
[npm-image]: https://img.shields.io/npm/v/is-buffer.svg
[npm-url]: https://npmjs.org/package/is-buffer
[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg
[downloads-url]: https://npmjs.org/package/is-buffer
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer))
[![saucelabs][saucelabs-image]][saucelabs-url]
[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg
[saucelabs-url]: https://saucelabs.com/u/is-buffer
## Why not use `Buffer.isBuffer`?
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/)).
It's future-proof and works in node too!
## install
```bash
npm install is-buffer
```
[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)
## usage
```js
var isBuffer = require('is-buffer')
isBuffer(new Buffer(4)) // true
isBuffer(Buffer.alloc(4)) //true
isBuffer(undefined) // false
isBuffer(null) // false
isBuffer('') // false
isBuffer(true) // false
isBuffer(false) // false
isBuffer(0) // false
isBuffer(1) // false
isBuffer(1.0) // false
isBuffer('string') // false
isBuffer({}) // false
isBuffer(function foo () {}) // false
```
## license
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org).
declare function isBuffer(obj: any): boolean
export = isBuffer
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
module.exports = function isBuffer (obj) {
return obj != null && obj.constructor != null &&
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
{
"_from": "is-buffer@^2.0.2",
"_id": "is-buffer@2.0.4",
"_inBundle": false,
"_integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==",
"_location": "/is-buffer",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-buffer@^2.0.2",
"name": "is-buffer",
"escapedName": "is-buffer",
"rawSpec": "^2.0.2",
"saveSpec": null,
"fetchSpec": "^2.0.2"
},
"_requiredBy": [
"/axios"
],
"_resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"_shasum": "3e572f23c8411a5cfd9557c849e3665e0b290623",
"_spec": "is-buffer@^2.0.2",
"_where": "C:\\Users\\Home\\Documents\\윤동주\\경희\\2019-2 오픈소스SW개발\\Term Project\\LINEBOT\\node_modules\\axios",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
"url": "https://feross.org"
},
"bugs": {
"url": "https://github.com/feross/is-buffer/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Determine if an object is a Buffer",
"devDependencies": {
"airtap": "^2.0.3",
"standard": "*",
"tape": "^4.11.0"
},
"engines": {
"node": ">=4"
},
"homepage": "https://github.com/feross/is-buffer#readme",
"keywords": [
"arraybuffer",
"browser",
"browser buffer",
"browserify",
"buffer",
"buffers",
"core buffer",
"dataview",
"float32array",
"float64array",
"int16array",
"int32array",
"type",
"typed array",
"uint32array"
],
"license": "MIT",
"main": "index.js",
"name": "is-buffer",
"repository": {
"type": "git",
"url": "git://github.com/feross/is-buffer.git"
},
"scripts": {
"test": "standard && npm run test-node && npm run test-browser",
"test-browser": "airtap -- test/*.js",
"test-browser-local": "airtap --local -- test/*.js",
"test-node": "tape test/*.js"
},
"version": "2.0.4"
}
{
"name": "linebot",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@line/bot-sdk": {
"version": "6.8.3",
"resolved": "https://registry.npmjs.org/@line/bot-sdk/-/bot-sdk-6.8.3.tgz",
"integrity": "sha512-nj2T4CQxw0W/juAlpj0kMTDScOh5QUK6xMCR2dZp+pN8B0vj/c+5uX3TyGB4ijz/NIsehgfKujPgzw7LhtYtJw==",
"requires": {
"@types/body-parser": "^1.16.8",
"@types/file-type": "^5.2.1",
"@types/node": "^7.0.31",
"axios": "^0.19.0",
"body-parser": "^1.18.2",
"file-type": "^7.2.0"
}
},
"@types/body-parser": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
"integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
"requires": {
"@types/connect": "*",
"@types/node": "*"
}
},
"@types/connect": {
"version": "3.4.32",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz",
"integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==",
"requires": {
"@types/node": "*"
}
},
"@types/file-type": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/@types/file-type/-/file-type-5.2.2.tgz",
"integrity": "sha512-GWtM4fyqfb+bec4ocpo51/y4x0b83Je+iA6eV131LT9wL0//G+1UgwbkMg7w61ceOwR+KkZXK00z44jrrNljWg==",
"requires": {
"@types/node": "*"
}
},
"@types/node": {
"version": "7.10.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.9.tgz",
"integrity": "sha512-usSpgoUsRtO5xNV5YEPU8PPnHisFx8u0rokj1BPVn/hDF7zwUDzVLiuKZM38B7z8V2111Fj6kd4rGtQFUZpNOw=="
},
"accepts": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
"requires": {
"mime-types": "~2.1.18",
"negotiator": "0.6.1"
}
},
"array-flatten": {
"version": "1.1.1",
"resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
},
"body-parser": {
"version": "1.18.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
"integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
"requires": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "~1.6.3",
"iconv-lite": "0.4.23",
"on-finished": "~2.3.0",
"qs": "6.5.2",
"raw-body": "2.3.3",
"type-is": "~1.6.16"
}
},
"bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
},
"content-disposition": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"express": {
"version": "4.16.4",
"resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz",
"integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==",
"requires": {
"accepts": "~1.3.5",
"array-flatten": "1.1.1",
"body-parser": "1.18.3",
"content-disposition": "0.5.2",
"content-type": "~1.0.4",
"cookie": "0.3.1",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.1.1",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.2",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.4",
"qs": "6.5.2",
"range-parser": "~1.2.0",
"safe-buffer": "5.1.2",
"send": "0.16.2",
"serve-static": "1.13.2",
"setprototypeof": "1.1.0",
"statuses": "~1.4.0",
"type-is": "~1.6.16",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
}
},
"file-type": {
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-7.7.1.tgz",
"integrity": "sha512-bTrKkzzZI6wH+NXhyD3SOXtb2zXTw2SbwI2RxUlRcXVsnN7jNL5hJzVQLYv7FOQhxFkK4XWdAflEaWFpaLLWpQ=="
},
"finalhandler": {
"version": "1.1.1",
"resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
"requires": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "~2.3.0",
"parseurl": "~1.3.2",
"statuses": "~1.4.0",
"unpipe": "~1.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"http-errors": {
"version": "1.6.3",
"resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.0",
"statuses": ">= 1.4.0 < 2"
}
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ipaddr.js": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
"integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4="
},
"is-buffer": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
},
"media-typer": {
"version": "0.3.0",
"resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"mime": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
"integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
},
"mime-db": {
"version": "1.37.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
"integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg=="
},
"mime-types": {
"version": "2.1.21",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
"integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
"requires": {
"mime-db": "~1.37.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"negotiator": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"parseurl": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
"integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"proxy-addr": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
"integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==",
"requires": {
"forwarded": "~0.1.2",
"ipaddr.js": "1.8.0"
}
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
},
"range-parser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
},
"raw-body": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
"requires": {
"bytes": "3.0.0",
"http-errors": "1.6.3",
"iconv-lite": "0.4.23",
"unpipe": "1.0.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"send": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
"integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.6.2",
"mime": "1.4.1",
"ms": "2.0.0",
"on-finished": "~2.3.0",
"range-parser": "~1.2.0",
"statuses": "~1.4.0"
}
},
"serve-static": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
"integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
"requires": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.2",
"send": "0.16.2"
}
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"statuses": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"type-is": {
"version": "1.6.16",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
"integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.18"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
}
}
}
{
"name": "linebot",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "강수인",
"license": "MIT",
"dependencies": {
"@line/bot-sdk": "^6.8.3",
"express": "^4.16.4"
}
}