Initial commit
This commit is contained in:
29
node_modules/@jibo/apptoolkit-library/LICENSE
generated
vendored
Normal file
29
node_modules/@jibo/apptoolkit-library/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, Jibo
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
70
node_modules/@jibo/apptoolkit-library/lib/Account.js
generated
vendored
Normal file
70
node_modules/@jibo/apptoolkit-library/lib/Account.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const axios_1 = require("axios");
|
||||
const constants_1 = require("./constants");
|
||||
const Robot_1 = require("./Robot");
|
||||
/**
|
||||
* @description A reference to a Jibo account. Log in here to get an API handle
|
||||
* to a Jibo robot or robots.
|
||||
* @class Account
|
||||
*/
|
||||
class Account {
|
||||
constructor(creds) {
|
||||
this.clientId = creds.clientId;
|
||||
this._clientSecret = creds.clientSecret;
|
||||
this.email = creds.email;
|
||||
this._password = creds.password;
|
||||
}
|
||||
/**
|
||||
* Log into the account with the credentials provided in the
|
||||
* {@link AccountCreds}
|
||||
* @method Account#login
|
||||
*/
|
||||
async login() {
|
||||
if (this._accessToken) {
|
||||
this.logout();
|
||||
}
|
||||
const getTokenUri = `https://${constants_1.ENDPOINT}/token`;
|
||||
const body = {
|
||||
grant_type: "password",
|
||||
client_id: this.clientId,
|
||||
client_secret: this._clientSecret,
|
||||
username: this.email,
|
||||
password: this._password,
|
||||
};
|
||||
return axios_1.default.post(getTokenUri, body).then(res => {
|
||||
this._accessToken = res.data.access_token;
|
||||
this._tokenType = res.data.token_type;
|
||||
}).catch(err => { throw new Error(err.message); });
|
||||
}
|
||||
/**
|
||||
* Get an API handle for each robot associated with the account
|
||||
* @method Account#getRobots
|
||||
* @returns {Promise<Robot[]>}
|
||||
*/
|
||||
async getRobots() {
|
||||
if (!this._accessToken) {
|
||||
throw new Error('Not logged in');
|
||||
}
|
||||
const getRobotListUri = `https://${constants_1.ENDPOINT}/rom/v1/robots`;
|
||||
return axios_1.default.get(getRobotListUri, {
|
||||
headers: { "Authorization": `${this._tokenType} ${this._accessToken}` },
|
||||
})
|
||||
.then(res => res.data.data.map(data => new Robot_1.Robot(data.robotName, this._tokenType, this._accessToken)))
|
||||
.catch(err => { throw new Error(err.message); });
|
||||
}
|
||||
/**
|
||||
* Log out from the account
|
||||
* @method Account#logout
|
||||
*/
|
||||
logout() {
|
||||
// Don't throw an error if this is called in a late cleanup and this
|
||||
// falls out of scope
|
||||
if (this) {
|
||||
this._accessToken = null;
|
||||
this._tokenType = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Account = Account;
|
||||
//# sourceMappingURL=Account.js.map
|
||||
1
node_modules/@jibo/apptoolkit-library/lib/Account.js.map
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/lib/Account.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":";;AACA,iCAA0B;AAC1B,2CAAqC;AACrC,mCAA8B;AAE9B;;;;GAIG;AACH;IAaI,YAAY,KAAmB;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK;QACP,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,MAAM,EAAE,CAAC;SACjB;QACD,MAAM,WAAW,GAAG,WAAW,oBAAQ,QAAQ,CAAC;QAChD,MAAM,IAAI,GAAG;YACT,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,QAAQ,EAAE,IAAI,CAAC,KAAK;YACpB,QAAQ,EAAE,IAAI,CAAC,SAAS;SAC3B,CAAC;QACF,OAAO,eAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC5C,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;YAC1C,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;QAC1C,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,SAAS;QACX,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;SACpC;QACD,MAAM,eAAe,GAAG,WAAW,oBAAQ,gBAAgB,CAAC;QAC5D,OAAO,eAAK,CAAC,GAAG,CAAgC,eAAe,EAAE;YAC7D,OAAO,EAAE,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE;SAC1E,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,aAAK,CAC5C,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,YAAY,CACpB,CAAC,CAAC;aACF,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,MAAM;QACF,oEAAoE;QACpE,qBAAqB;QACrB,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;SAC1B;IACL,CAAC;CACJ;AA5ED,0BA4EC"}
|
||||
3
node_modules/@jibo/apptoolkit-library/lib/AccountCreds.js
generated
vendored
Normal file
3
node_modules/@jibo/apptoolkit-library/lib/AccountCreds.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=AccountCreds.js.map
|
||||
1
node_modules/@jibo/apptoolkit-library/lib/AccountCreds.js.map
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/lib/AccountCreds.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AccountCreds.js","sourceRoot":"","sources":["../src/AccountCreds.ts"],"names":[],"mappings":""}
|
||||
128
node_modules/@jibo/apptoolkit-library/lib/Robot.js
generated
vendored
Normal file
128
node_modules/@jibo/apptoolkit-library/lib/Robot.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const axios_1 = require("axios");
|
||||
const events_1 = require("events");
|
||||
const command_requester_1 = require("@jibo/command-requester");
|
||||
const constants_1 = require("./constants");
|
||||
/**
|
||||
* An API handle to a Jibo robot, used to request commands
|
||||
* @class Robot
|
||||
* @hideconstructor
|
||||
*/
|
||||
class Robot extends events_1.EventEmitter {
|
||||
/** @private */
|
||||
constructor(
|
||||
/**
|
||||
* The "friendly serial name" from the bottom of the robot,
|
||||
* e.g. My-Friendly-Robot-Name
|
||||
*/
|
||||
serialName, tokenType, accessToken) {
|
||||
super();
|
||||
this.serialName = serialName;
|
||||
this.tokenType = tokenType;
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
/**
|
||||
* `true` if the app is currently connected to this robot
|
||||
* @method Robot#connected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get connected() {
|
||||
return this._connected;
|
||||
}
|
||||
/**
|
||||
* A handle to the command requester for this robot
|
||||
* @method Robot#requester
|
||||
* @returns {CommandRequester}
|
||||
*/
|
||||
get requester() {
|
||||
return this._requester;
|
||||
}
|
||||
/**
|
||||
* Establish a connection to this robot
|
||||
* @method Robot.connect
|
||||
*/
|
||||
async connect() {
|
||||
if (this.connected) {
|
||||
await this.disconnect();
|
||||
}
|
||||
if (!this._ip) {
|
||||
await this._requestCertificate();
|
||||
await this._retrieveCertificate();
|
||||
}
|
||||
const options = {
|
||||
port: constants_1.PORT,
|
||||
key: this._key,
|
||||
cert: this._certificate,
|
||||
rejectUnauthorized: false,
|
||||
perMessageDeflate: false,
|
||||
fingerprint: this._fingerprint,
|
||||
};
|
||||
this._requester = new command_requester_1.CommandRequester();
|
||||
this._requester.disconnected.on(data => {
|
||||
this._connected = false;
|
||||
this.emit('disconnected', data);
|
||||
this.emit('status', 'disconnected');
|
||||
});
|
||||
return this._requester.connect(this._ip, options)
|
||||
.then(() => {
|
||||
this._connected = true;
|
||||
this.emit('status', 'connected');
|
||||
})
|
||||
.catch(err => { throw new Error(err.message); });
|
||||
}
|
||||
/**
|
||||
* Disconnect from this robot
|
||||
* @method Robot#disconnect
|
||||
*/
|
||||
disconnect() {
|
||||
// Don't throw an error if this is called in a late cleanup and this
|
||||
// falls out of scope
|
||||
if (this) {
|
||||
this._requester.disconnect();
|
||||
this._certificate = null;
|
||||
this._connected = false;
|
||||
this._fingerprint = null;
|
||||
this._ip = null;
|
||||
this._key = null;
|
||||
this._requester = null;
|
||||
this.emit('status', 'disconnected');
|
||||
}
|
||||
}
|
||||
async _requestCertificate() {
|
||||
const certificateCreationUri = `https://${constants_1.ENDPOINT}/rom/v1/certificates`;
|
||||
const body = { friendlyId: this.serialName };
|
||||
const headers = { 'Authorization': `${this.tokenType} ${this.accessToken}` };
|
||||
await axios_1.default.post(certificateCreationUri, body, { headers })
|
||||
.then(() => this.emit('status', 'certificateRequested'))
|
||||
.catch(err => { throw new Error(err.message); });
|
||||
}
|
||||
async _retrieveCertificate() {
|
||||
const certificateRetrievalUri = `https://${constants_1.ENDPOINT}/rom/v1/certificates/client?friendlyId=${this.serialName}`;
|
||||
const headers = { 'Authorization': `${this.tokenType} ${this.accessToken}` };
|
||||
this._ip = null;
|
||||
let numTries = 0;
|
||||
while (!this._ip && numTries < constants_1.MAX_CERT_TRIES) {
|
||||
try {
|
||||
await axios_1.default.get(certificateRetrievalUri, {
|
||||
headers,
|
||||
timeout: 5000,
|
||||
}).then(res => {
|
||||
this._certificate = res.data.data.cert;
|
||||
this._fingerprint = res.data.data.fingerprint;
|
||||
this._ip = res.data.data.payload.ipAddress;
|
||||
this._key = res.data.data.private;
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
numTries++;
|
||||
}
|
||||
}
|
||||
if (!this._ip) {
|
||||
throw new Error('Failed to retrieve certificate');
|
||||
}
|
||||
this.emit('status', 'certificateReceived');
|
||||
}
|
||||
}
|
||||
exports.Robot = Robot;
|
||||
//# sourceMappingURL=Robot.js.map
|
||||
1
node_modules/@jibo/apptoolkit-library/lib/Robot.js.map
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/lib/Robot.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Robot.js","sourceRoot":"","sources":["../src/Robot.ts"],"names":[],"mappings":";;AAAA,iCAA0B;AAC1B,mCAAoC;AACpC,+DAAyD;AACzD,2CAA2D;AAE3D;;;;GAIG;AACH,WAAmB,SAAQ,qBAAY;IASnC,eAAe;IACf;IACI;;;OAGG;IACM,UAAkB,EACnB,SAAiB,EACjB,WAAmB;QAE3B,KAAK,EAAE,CAAC;QAJC,eAAU,GAAV,UAAU,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAQ;QACjB,gBAAW,GAAX,WAAW,CAAQ;IAG/B,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO;QACT,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;SAC3B;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACjC,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;SACrC;QACD,MAAM,OAAO,GAAG;YACZ,IAAI,EAAE,gBAAI;YACV,GAAG,EAAE,IAAI,CAAC,IAAI;YACd,IAAI,EAAE,IAAI,CAAC,YAAY;YACvB,kBAAkB,EAAE,KAAK;YACzB,iBAAiB,EAAE,KAAK;YACxB,WAAW,EAAE,IAAI,CAAC,YAAY;SACjC,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,oCAAgB,EAAE,CAAC;QACzC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;YACnC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC;aAChD,IAAI,CAAC,GAAG,EAAE;YACP,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACrC,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,UAAU;QACN,oEAAoE;QACpE,qBAAqB;QACrB,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC7B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;SACvC;IACL,CAAC;IAEO,KAAK,CAAC,mBAAmB;QAC7B,MAAM,sBAAsB,GAAG,WAAW,oBAAQ,sBAAsB,CAAC;QACzE,MAAM,IAAI,GAAG,EAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,EAAC,eAAe,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,EAAC,CAAC;QAC3E,MAAM,eAAK,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,EAAE,EAAC,OAAO,EAAC,CAAC;aACxD,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;aACvD,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IAGO,KAAK,CAAC,oBAAoB;QAC9B,MAAM,uBAAuB,GAAG,WAAW,oBAAQ,0CAA0C,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/G,MAAM,OAAO,GAAG,EAAC,eAAe,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,EAAC,CAAC;QAC3E,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,QAAQ,GAAG,0BAAc,EAAE;YAC3C,IAAI;gBACA,MAAM,eAAK,CAAC,GAAG,CAAC,uBAAuB,EAAE;oBACrC,OAAO;oBACP,OAAO,EAAE,IAAI;iBAChB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;oBACV,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oBACvC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;oBAC9C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;oBAC3C,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;gBACtC,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,QAAQ,EAAE,CAAC;aACd;SACJ;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;SACrD;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC/C,CAAC;CACJ;AAhID,sBAgIC"}
|
||||
6
node_modules/@jibo/apptoolkit-library/lib/constants.js
generated
vendored
Normal file
6
node_modules/@jibo/apptoolkit-library/lib/constants.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ENDPOINT = 'portal.jibo.com';
|
||||
exports.MAX_CERT_TRIES = 40;
|
||||
exports.PORT = 7160;
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
node_modules/@jibo/apptoolkit-library/lib/constants.js.map
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/lib/constants.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;AAAa,QAAA,QAAQ,GAAG,iBAAiB,CAAC;AAC7B,QAAA,cAAc,GAAG,EAAE,CAAC;AACpB,QAAA,IAAI,GAAG,IAAI,CAAC"}
|
||||
7
node_modules/@jibo/apptoolkit-library/lib/index.js
generated
vendored
Normal file
7
node_modules/@jibo/apptoolkit-library/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Account_1 = require("./Account");
|
||||
exports.Account = Account_1.Account;
|
||||
const Robot_1 = require("./Robot");
|
||||
exports.Robot = Robot_1.Robot;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@jibo/apptoolkit-library/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,uCAAkC;AAK9B,kBALI,iBAAO,CAKJ;AAHX,mCAA8B;AAK1B,gBALI,aAAK,CAKJ"}
|
||||
19
node_modules/@jibo/apptoolkit-library/node_modules/axios/LICENSE
generated
vendored
Normal file
19
node_modules/@jibo/apptoolkit-library/node_modules/axios/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
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.
|
||||
38
node_modules/@jibo/apptoolkit-library/node_modules/axios/bower.json
generated
vendored
Normal file
38
node_modules/@jibo/apptoolkit-library/node_modules/axios/bower.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"main": "./dist/axios.js",
|
||||
"version": "0.17.1",
|
||||
"homepage": "https://github.com/axios/axios",
|
||||
"authors": [
|
||||
"Matt Zabriskie"
|
||||
],
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals"
|
||||
],
|
||||
"keywords": [
|
||||
"xhr",
|
||||
"http",
|
||||
"ajax",
|
||||
"promise",
|
||||
"node"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"*.iml",
|
||||
"examples",
|
||||
"lib",
|
||||
"node_modules",
|
||||
"sandbox",
|
||||
"test",
|
||||
"CONTRIBUTING.md",
|
||||
"COOKBOOK.md",
|
||||
"Gruntfile.js",
|
||||
"index.js",
|
||||
"karma.conf.js",
|
||||
"package.json",
|
||||
"webpack.*.js"
|
||||
]
|
||||
}
|
||||
1598
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.js
generated
vendored
Normal file
1598
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.map
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
8
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.min.map
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/node_modules/axios/dist/axios.min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@jibo/apptoolkit-library/node_modules/axios/index.js
generated
vendored
Normal file
1
node_modules/@jibo/apptoolkit-library/node_modules/axios/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib/axios');
|
||||
232
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/adapters/http.js
generated
vendored
Normal file
232
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/adapters/http.js
generated
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
'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');
|
||||
|
||||
/*eslint consistent-return:0*/
|
||||
module.exports = function httpAdapter(config) {
|
||||
return new Promise(function dispatchHttpRequest(resolve, reject) {
|
||||
var data = config.data;
|
||||
var headers = config.headers;
|
||||
var timer;
|
||||
|
||||
// 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 = new Buffer(new Uint8Array(data));
|
||||
} else if (utils.isString(data)) {
|
||||
data = new Buffer(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 isHttps = protocol === 'https:';
|
||||
var agent = isHttps ? config.httpsAgent : config.httpAgent;
|
||||
|
||||
var options = {
|
||||
hostname: parsed.hostname,
|
||||
port: parsed.port,
|
||||
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
||||
method: config.method,
|
||||
headers: headers,
|
||||
agent: agent,
|
||||
auth: auth
|
||||
};
|
||||
|
||||
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);
|
||||
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 = new Buffer(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
||||
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||
}
|
||||
}
|
||||
|
||||
var transport;
|
||||
if (config.transport) {
|
||||
transport = config.transport;
|
||||
} else if (config.maxRedirects === 0) {
|
||||
transport = isHttps ? https : http;
|
||||
} else {
|
||||
if (config.maxRedirects) {
|
||||
options.maxRedirects = config.maxRedirects;
|
||||
}
|
||||
transport = isHttps ? 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;
|
||||
|
||||
// Response has been received so kill timer that handles request timeout
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
|
||||
// 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 = 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) {
|
||||
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('utf8');
|
||||
}
|
||||
|
||||
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) {
|
||||
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.pipe(req);
|
||||
} else {
|
||||
req.end(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
180
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
180
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
'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');
|
||||
var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || require('./../helpers/btoa');
|
||||
|
||||
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();
|
||||
var loadEvent = 'onreadystatechange';
|
||||
var xDomain = false;
|
||||
|
||||
// For IE 8/9 CORS support
|
||||
// Only supports POST and GET calls and doesn't returns the response headers.
|
||||
// DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
|
||||
if (process.env.NODE_ENV !== 'test' &&
|
||||
typeof window !== 'undefined' &&
|
||||
window.XDomainRequest && !('withCredentials' in request) &&
|
||||
!isURLSameOrigin(config.url)) {
|
||||
request = new window.XDomainRequest();
|
||||
loadEvent = 'onload';
|
||||
xDomain = true;
|
||||
request.onprogress = function handleProgress() {};
|
||||
request.ontimeout = function handleTimeout() {};
|
||||
}
|
||||
|
||||
// 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[loadEvent] = function handleLoad() {
|
||||
if (!request || (request.readyState !== 4 && !xDomain)) {
|
||||
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,
|
||||
// IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
|
||||
status: request.status === 1223 ? 204 : request.status,
|
||||
statusText: request.status === 1223 ? 'No Content' : request.statusText,
|
||||
headers: responseHeaders,
|
||||
config: config,
|
||||
request: request
|
||||
};
|
||||
|
||||
settle(resolve, reject, response);
|
||||
|
||||
// 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);
|
||||
});
|
||||
};
|
||||
52
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/axios.js
generated
vendored
Normal file
52
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/axios.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
var utils = require('./utils');
|
||||
var bind = require('./helpers/bind');
|
||||
var Axios = require('./core/Axios');
|
||||
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(utils.merge(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;
|
||||
19
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/cancel/Cancel.js
generated
vendored
Normal file
19
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/cancel/Cancel.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'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;
|
||||
57
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
57
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
var Cancel = require('./Cancel');
|
||||
|
||||
/**
|
||||
* 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;
|
||||
5
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
5
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isCancel(value) {
|
||||
return !!(value && value.__CANCEL__);
|
||||
};
|
||||
79
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
79
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
var defaults = require('./../defaults');
|
||||
var utils = require('./../utils');
|
||||
var InterceptorManager = require('./InterceptorManager');
|
||||
var dispatchRequest = require('./dispatchRequest');
|
||||
|
||||
/**
|
||||
* 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 = utils.merge({
|
||||
url: arguments[0]
|
||||
}, arguments[1]);
|
||||
}
|
||||
|
||||
config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
|
||||
config.method = config.method.toLowerCase();
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
// 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;
|
||||
52
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
52
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
var utils = require('./../utils');
|
||||
|
||||
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;
|
||||
18
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/createError.js
generated
vendored
Normal file
18
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/createError.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var enhanceError = require('./enhanceError');
|
||||
|
||||
/**
|
||||
* 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);
|
||||
};
|
||||
86
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
86
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
'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);
|
||||
});
|
||||
};
|
||||
21
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/enhanceError.js
generated
vendored
Normal file
21
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/enhanceError.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'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;
|
||||
return error;
|
||||
};
|
||||
26
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
26
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'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;
|
||||
// Note: status is not exposed by XDomainRequest
|
||||
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
||||
resolve(response);
|
||||
} else {
|
||||
reject(createError(
|
||||
'Request failed with status code ' + response.status,
|
||||
response.config,
|
||||
null,
|
||||
response.request,
|
||||
response
|
||||
));
|
||||
}
|
||||
};
|
||||
20
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
20
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var utils = require('./../utils');
|
||||
|
||||
/**
|
||||
* 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;
|
||||
};
|
||||
92
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/defaults.js
generated
vendored
Normal file
92
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/defaults.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
'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;
|
||||
if (typeof process !== 'undefined' && process.env && typeof process.env.HOME === 'string') {
|
||||
// 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, '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;
|
||||
}],
|
||||
|
||||
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;
|
||||
11
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/bind.js
generated
vendored
Normal file
11
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/bind.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'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);
|
||||
};
|
||||
};
|
||||
36
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/btoa.js
generated
vendored
Normal file
36
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/btoa.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
|
||||
|
||||
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
|
||||
function E() {
|
||||
this.message = 'String contains an invalid character';
|
||||
}
|
||||
E.prototype = new Error;
|
||||
E.prototype.code = 5;
|
||||
E.prototype.name = 'InvalidCharacterError';
|
||||
|
||||
function btoa(input) {
|
||||
var str = String(input);
|
||||
var output = '';
|
||||
for (
|
||||
// initialize result and counter
|
||||
var block, charCode, idx = 0, map = chars;
|
||||
// if the next str index does not exist:
|
||||
// change the mapping table to "="
|
||||
// check if d has no fractional digits
|
||||
str.charAt(idx | 0) || (map = '=', idx % 1);
|
||||
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
|
||||
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
|
||||
) {
|
||||
charCode = str.charCodeAt(idx += 3 / 4);
|
||||
if (charCode > 0xFF) {
|
||||
throw new E();
|
||||
}
|
||||
block = block << 8 | charCode;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = btoa;
|
||||
66
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
66
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
'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) {
|
||||
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
||||
}
|
||||
|
||||
return url;
|
||||
};
|
||||
14
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
14
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'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;
|
||||
};
|
||||
53
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
53
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'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() {}
|
||||
};
|
||||
})()
|
||||
);
|
||||
24
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
24
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
/*eslint no-console:0*/
|
||||
|
||||
/**
|
||||
* Supply a warning to the developer that a method they are using
|
||||
* has been deprecated.
|
||||
*
|
||||
* @param {string} method The name of the deprecated method
|
||||
* @param {string} [instead] The alternate method to use if applicable
|
||||
* @param {string} [docs] The documentation URL to get further details
|
||||
*/
|
||||
module.exports = function deprecatedMethod(method, instead, docs) {
|
||||
try {
|
||||
console.warn(
|
||||
'DEPRECATED method `' + method + '`.' +
|
||||
(instead ? ' Use `' + instead + '` instead.' : '') +
|
||||
' This method will be removed in a future release.');
|
||||
|
||||
if (docs) {
|
||||
console.warn('For more information about usage see ' + docs);
|
||||
}
|
||||
} catch (e) { /* Ignore */ }
|
||||
};
|
||||
14
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
Normal file
14
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'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);
|
||||
};
|
||||
68
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
Normal file
68
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'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;
|
||||
};
|
||||
})()
|
||||
);
|
||||
12
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
Normal file
12
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var utils = require('../utils');
|
||||
|
||||
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];
|
||||
}
|
||||
});
|
||||
};
|
||||
53
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
Normal file
53
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'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;
|
||||
};
|
||||
27
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/spread.js
generated
vendored
Normal file
27
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/helpers/spread.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'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);
|
||||
};
|
||||
};
|
||||
303
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/utils.js
generated
vendored
Normal file
303
node_modules/@jibo/apptoolkit-library/node_modules/axios/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
'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'
|
||||
*/
|
||||
function isStandardBrowserEnv() {
|
||||
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
extend: extend,
|
||||
trim: trim
|
||||
};
|
||||
65
node_modules/@jibo/apptoolkit-library/node_modules/axios/package.json
generated
vendored
Normal file
65
node_modules/@jibo/apptoolkit-library/node_modules/axios/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"version": "0.17.1",
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/axios/axios.git"
|
||||
},
|
||||
"author": "Matt Zabriskie",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/axios/axios",
|
||||
"devDependencies": {
|
||||
"bundlesize": "^0.5.7",
|
||||
"coveralls": "^2.11.9",
|
||||
"es6-promise": "^4.0.5",
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-banner": "^0.6.0",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-clean": "^1.0.0",
|
||||
"grunt-contrib-nodeunit": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.0.0",
|
||||
"grunt-eslint": "^19.0.0",
|
||||
"grunt-karma": "^2.0.0",
|
||||
"grunt-ts": "^6.0.0-beta.3",
|
||||
"grunt-webpack": "^1.0.18",
|
||||
"istanbul-instrumenter-loader": "^1.0.0",
|
||||
"jasmine-core": "^2.4.1",
|
||||
"karma": "^1.3.0",
|
||||
"karma-chrome-launcher": "^2.0.0",
|
||||
"karma-coverage": "^1.0.0",
|
||||
"karma-firefox-launcher": "^1.0.0",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-jasmine-ajax": "^0.1.13",
|
||||
"karma-opera-launcher": "^1.0.0",
|
||||
"karma-phantomjs-launcher": "^1.0.0",
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
"karma-sauce-launcher": "^1.1.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",
|
||||
"phantomjs-prebuilt": "^2.1.7",
|
||||
"sinon": "^1.17.4",
|
||||
"webpack": "^1.13.1",
|
||||
"webpack-dev-server": "^1.14.1",
|
||||
"url-search-params": "^0.6.1",
|
||||
"typescript": "^2.0.3"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
||||
},
|
||||
"typings": "./index.d.ts",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.2.5",
|
||||
"is-buffer": "^1.1.5"
|
||||
},
|
||||
"bundlesize": [
|
||||
{
|
||||
"path": "./dist/axios.min.js",
|
||||
"threshold": "5kB"
|
||||
}
|
||||
]
|
||||
}
|
||||
173
node_modules/@jibo/apptoolkit-library/node_modules/axios/sandbox/client.html
generated
vendored
Normal file
173
node_modules/@jibo/apptoolkit-library/node_modules/axios/sandbox/client.html
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>axios</title>
|
||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
|
||||
<style type="text/css">
|
||||
pre {
|
||||
max-height: 200px;
|
||||
min-height: 39px;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="container">
|
||||
<h1>axios</h1>
|
||||
|
||||
<div class="well">
|
||||
<h3>Input</h3>
|
||||
<form role="form" onsubmit="return false;">
|
||||
<div class="form-group">
|
||||
<label for="url">URL</label>
|
||||
<input id="url" type="url" class="form-control" placeholder="/api"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="method">Method</label>
|
||||
<select id="method" class="form-control">
|
||||
<option value="GET">GET</option>
|
||||
<option value="POST">POST</option>
|
||||
<option value="PUT">PUT</option>
|
||||
<option value="DELETE">DELETE</option>
|
||||
<option value="HEAD">HEAD</option>
|
||||
<option value="PATCH">PATCH</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="params">Params</label>
|
||||
<textarea id="params" class="form-control" placeholder='{"foo": "bar", "baz": 123.45}'></textarea>
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
<label for="data">Data</label>
|
||||
<textarea id="data" class="form-control" placeholder='{"foo": "bar", "baz": 123.45}'></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="headers">Headers</label>
|
||||
<textarea id="headers" class="form-control" placeholder='{"X-Requested-With": "XMLHttpRequest"}'></textarea>
|
||||
</div>
|
||||
<button id="submit" type="submit" class="btn btn-primary">Send Request</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="well">
|
||||
<h3>Request</h3>
|
||||
<pre id="request">No Data</pre>
|
||||
</div>
|
||||
|
||||
<div class="well">
|
||||
<h3>Response</h3>
|
||||
<pre id="response">No Data</pre>
|
||||
</div>
|
||||
|
||||
<script src="/axios.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
// Just for you IE8
|
||||
if (typeof Array.prototype.indexOf === 'undefined') {
|
||||
Array.prototype.indexOf = function (item) {
|
||||
for (var i=0, l=this.length; i<l; i++) {
|
||||
if (this[i] === item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
var url = document.getElementById('url');
|
||||
var method = document.getElementById('method');
|
||||
var params = document.getElementById('params');
|
||||
var data = document.getElementById('data');
|
||||
var headers = document.getElementById('headers');
|
||||
var submit = document.getElementById('submit');
|
||||
var request = document.getElementById('request');
|
||||
var response = document.getElementById('response');
|
||||
|
||||
function acceptsData(method) {
|
||||
return ['PATCH', 'POST', 'PUT'].indexOf(method) > -1;
|
||||
}
|
||||
|
||||
function getUrl() {
|
||||
return url.value.length === 0 ? '/api' : url.value;
|
||||
}
|
||||
|
||||
function getParams() {
|
||||
return params.value.length === 0 ? null : JSON.parse(params.value);
|
||||
}
|
||||
|
||||
function getData() {
|
||||
return data.value.length === 0 ? null : JSON.parse(data.value);
|
||||
}
|
||||
|
||||
function getHeaders() {
|
||||
return headers.value.length === 0 ? null : JSON.parse(headers.value);
|
||||
}
|
||||
|
||||
function syncWithLocalStorage() {
|
||||
method.value = localStorage.getItem('method') || 'GET';
|
||||
params.value = localStorage.getItem('params') || '';
|
||||
data.value = localStorage.getItem('data') || '';
|
||||
headers.value = localStorage.getItem('headers') || '';
|
||||
}
|
||||
|
||||
function syncParamsAndData() {
|
||||
switch (method.value) {
|
||||
case 'PATCH':
|
||||
case 'POST':
|
||||
case 'PUT':
|
||||
params.parentNode.style.display = 'none';
|
||||
data.parentNode.style.display = '';
|
||||
break;
|
||||
default:
|
||||
params.parentNode.style.display = '';
|
||||
data.parentNode.style.display = 'none';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
submit.onclick = function () {
|
||||
var options = {
|
||||
url: getUrl(),
|
||||
params: !acceptsData(method.value) ? getParams() : undefined,
|
||||
data: acceptsData(method.value) ? getData() : undefined,
|
||||
method: method.value,
|
||||
headers: getHeaders()
|
||||
};
|
||||
|
||||
request.innerHTML = JSON.stringify(options, null, 2);
|
||||
|
||||
axios(options)
|
||||
.then(function (res) {
|
||||
response.innerHTML = JSON.stringify(res.data, null, 2);
|
||||
})
|
||||
.catch(function (res) {
|
||||
response.innerHTML = JSON.stringify(res.data, null, 2);
|
||||
});
|
||||
};
|
||||
|
||||
url.onchange = function () {
|
||||
localStorage.setItem('url', url.value);
|
||||
};
|
||||
|
||||
method.onchange = function () {
|
||||
localStorage.setItem('method', method.value);
|
||||
syncParamsAndData();
|
||||
};
|
||||
|
||||
params.onchange = function () {
|
||||
localStorage.setItem('params', params.value);
|
||||
};
|
||||
|
||||
data.onchange = function () {
|
||||
localStorage.setItem('data', data.value);
|
||||
};
|
||||
|
||||
headers.onchange = function () {
|
||||
localStorage.setItem('headers', headers.value);
|
||||
};
|
||||
|
||||
syncWithLocalStorage();
|
||||
syncParamsAndData();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
20
node_modules/@jibo/apptoolkit-library/node_modules/axios/sandbox/client.js
generated
vendored
Normal file
20
node_modules/@jibo/apptoolkit-library/node_modules/axios/sandbox/client.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var axios = require('../index');
|
||||
|
||||
var URL = 'http://127.0.0.1:3000/api';
|
||||
var BODY = {
|
||||
foo: 'bar',
|
||||
baz: 1234
|
||||
};
|
||||
|
||||
function handleSuccess(data) { console.log(data); }
|
||||
function handleFailure(data) { console.log('error', data); }
|
||||
|
||||
// GET
|
||||
axios.get(URL, { params: BODY })
|
||||
.then(handleSuccess)
|
||||
.catch(handleFailure);
|
||||
|
||||
// POST
|
||||
axios.post(URL, BODY)
|
||||
.then(handleSuccess)
|
||||
.catch(handleFailure);
|
||||
72
node_modules/@jibo/apptoolkit-library/node_modules/axios/sandbox/server.js
generated
vendored
Normal file
72
node_modules/@jibo/apptoolkit-library/node_modules/axios/sandbox/server.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
var fs = require('fs');
|
||||
var url = require('url');
|
||||
var path = require('path');
|
||||
var http = require('http');
|
||||
var server;
|
||||
|
||||
function pipeFileToResponse(res, file, type) {
|
||||
if (type) {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': type
|
||||
});
|
||||
}
|
||||
|
||||
fs.createReadStream(path.join(__dirname, file)).pipe(res);
|
||||
}
|
||||
|
||||
server = http.createServer(function (req, res) {
|
||||
req.setEncoding('utf8');
|
||||
|
||||
var parsed = url.parse(req.url, true);
|
||||
var pathname = parsed.pathname;
|
||||
|
||||
console.log('[' + new Date() + ']', req.method, pathname);
|
||||
|
||||
if (pathname === '/') {
|
||||
pathname = '/index.html';
|
||||
}
|
||||
|
||||
if (pathname === '/index.html') {
|
||||
pipeFileToResponse(res, './client.html');
|
||||
} else if (pathname === '/axios.js') {
|
||||
pipeFileToResponse(res, '../dist/axios.js', 'text/javascript');
|
||||
} else if (pathname === '/axios.map') {
|
||||
pipeFileToResponse(res, '../dist/axios.map', 'text/javascript');
|
||||
} else if (pathname === '/api') {
|
||||
var status;
|
||||
var result;
|
||||
var data = '';
|
||||
|
||||
req.on('data', function (chunk) {
|
||||
data += chunk;
|
||||
});
|
||||
|
||||
req.on('end', function () {
|
||||
try {
|
||||
status = 200;
|
||||
result = {
|
||||
url: req.url,
|
||||
data: data ? JSON.parse(data) : undefined,
|
||||
method: req.method,
|
||||
headers: req.headers
|
||||
};
|
||||
} catch (e) {
|
||||
console.error('Error:', e.message);
|
||||
status = 400;
|
||||
result = {
|
||||
error: e.message
|
||||
};
|
||||
}
|
||||
|
||||
res.writeHead(status, {
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
res.end(JSON.stringify(result));
|
||||
});
|
||||
} else {
|
||||
res.writeHead(404);
|
||||
res.end('<h1>404 Not Found</h1>');
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(3000);
|
||||
44
node_modules/@jibo/apptoolkit-library/node_modules/axios/webpack.config.js
generated
vendored
Normal file
44
node_modules/@jibo/apptoolkit-library/node_modules/axios/webpack.config.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
var webpack = require('webpack');
|
||||
var config = {};
|
||||
|
||||
function generateConfig(name) {
|
||||
var uglify = name.indexOf('min') > -1;
|
||||
var config = {
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: 'dist/',
|
||||
filename: name + '.js',
|
||||
sourceMapFilename: name + '.map',
|
||||
library: 'axios',
|
||||
libraryTarget: 'umd'
|
||||
},
|
||||
node: {
|
||||
process: false
|
||||
},
|
||||
devtool: 'source-map'
|
||||
};
|
||||
|
||||
config.plugins = [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
|
||||
})
|
||||
];
|
||||
|
||||
if (uglify) {
|
||||
config.plugins.push(
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compressor: {
|
||||
warnings: false
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
['axios', 'axios.min'].forEach(function (key) {
|
||||
config[key] = generateConfig(key);
|
||||
});
|
||||
|
||||
module.exports = config;
|
||||
31
node_modules/@jibo/apptoolkit-library/package.json
generated
vendored
Normal file
31
node_modules/@jibo/apptoolkit-library/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@jibo/apptoolkit-library",
|
||||
"description": "Jibo App Toolkit for Node.js",
|
||||
"version": "0.1.5",
|
||||
"author": "Jibo, Inc.",
|
||||
"copyright": "Copyright (c) 2018 Jibo, Inc. All Rights Reserved",
|
||||
"license": "BSD-3-Clause",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:jibo-robot/apptoolkit-node-library.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.5.0"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"dependencies": {
|
||||
"@jibo/command-requester": "^1.0.6",
|
||||
"axios": "github:mividtim/axios#jibo"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^8.10.14",
|
||||
"jsdoc": "^3.5.5",
|
||||
"tslint": "^5.10.0",
|
||||
"typescript": "^2.8.3"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE.md",
|
||||
"lib/**/*"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user