mirror of
https://github.com/aljazceru/satshkd-vercel.git
synced 2025-12-17 21:24:23 +01:00
update node_modules
This commit is contained in:
1
node_modules/.bin/csv-parser
generated
vendored
1
node_modules/.bin/csv-parser
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../csv-parser/bin/csv-parser
|
|
||||||
1
node_modules/.bin/handlebars
generated
vendored
1
node_modules/.bin/handlebars
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../handlebars/bin/handlebars
|
|
||||||
1
node_modules/.bin/mime
generated
vendored
1
node_modules/.bin/mime
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../mime/cli.js
|
|
||||||
1
node_modules/.bin/uglifyjs
generated
vendored
1
node_modules/.bin/uglifyjs
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../uglify-js/bin/uglifyjs
|
|
||||||
9
node_modules/@actions/core/LICENSE.md
generated
vendored
9
node_modules/@actions/core/LICENSE.md
generated
vendored
@@ -1,9 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
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.
|
|
||||||
312
node_modules/@actions/core/README.md
generated
vendored
312
node_modules/@actions/core/README.md
generated
vendored
@@ -1,312 +0,0 @@
|
|||||||
# `@actions/core`
|
|
||||||
|
|
||||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Import the package
|
|
||||||
|
|
||||||
```js
|
|
||||||
// javascript
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
// typescript
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Inputs/Outputs
|
|
||||||
|
|
||||||
Action inputs can be read with `getInput` which returns a `string` or `getBooleanInput` which parses a boolean based on the [yaml 1.2 specification](https://yaml.org/spec/1.2/spec.html#id2804923). If `required` set to be false, the input should have a default value in `action.yml`.
|
|
||||||
|
|
||||||
Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const myInput = core.getInput('inputName', { required: true });
|
|
||||||
const myBooleanInput = core.getBooleanInput('booleanInputName', { required: true });
|
|
||||||
const myMultilineInput = core.getMultilineInput('multilineInputName', { required: true });
|
|
||||||
core.setOutput('outputKey', 'outputVal');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exporting variables
|
|
||||||
|
|
||||||
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.exportVariable('envVar', 'Val');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Setting a secret
|
|
||||||
|
|
||||||
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.setSecret('myPassword');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### PATH Manipulation
|
|
||||||
|
|
||||||
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.addPath('/path/to/mytool');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exit codes
|
|
||||||
|
|
||||||
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Do stuff
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// setFailed logs the message and sets a failing exit code
|
|
||||||
core.setFailed(`Action failed with error ${err}`);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
|
||||||
|
|
||||||
#### Logging
|
|
||||||
|
|
||||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
const myInput = core.getInput('input');
|
|
||||||
try {
|
|
||||||
core.debug('Inside try block');
|
|
||||||
|
|
||||||
if (!myInput) {
|
|
||||||
core.warning('myInput was not set');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (core.isDebug()) {
|
|
||||||
// curl -v https://github.com
|
|
||||||
} else {
|
|
||||||
// curl https://github.com
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do stuff
|
|
||||||
core.info('Output to the actions build log')
|
|
||||||
|
|
||||||
core.notice('This is a message that will also emit an annotation')
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
core.error(`Error ${err}, action may still succeed though`);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This library can also wrap chunks of output in foldable groups.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core')
|
|
||||||
|
|
||||||
// Manually wrap output
|
|
||||||
core.startGroup('Do some function')
|
|
||||||
doSomeFunction()
|
|
||||||
core.endGroup()
|
|
||||||
|
|
||||||
// Wrap an asynchronous function call
|
|
||||||
const result = await core.group('Do something async', async () => {
|
|
||||||
const response = await doSomeHTTPRequest()
|
|
||||||
return response
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Annotations
|
|
||||||
|
|
||||||
This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run).
|
|
||||||
```js
|
|
||||||
core.error('This is a bad error. This will also fail the build.')
|
|
||||||
|
|
||||||
core.warning('Something went wrong, but it\'s not bad enough to fail the build.')
|
|
||||||
|
|
||||||
core.notice('Something happened that you might want to know about.')
|
|
||||||
```
|
|
||||||
|
|
||||||
These will surface to the UI in the Actions page and on Pull Requests. They look something like this:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
These annotations can also be attached to particular lines and columns of your source files to show exactly where a problem is occuring.
|
|
||||||
|
|
||||||
These options are:
|
|
||||||
```typescript
|
|
||||||
export interface AnnotationProperties {
|
|
||||||
/**
|
|
||||||
* A title for the annotation.
|
|
||||||
*/
|
|
||||||
title?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the file for which the annotation should be created.
|
|
||||||
*/
|
|
||||||
file?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The start line for the annotation.
|
|
||||||
*/
|
|
||||||
startLine?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
|
|
||||||
*/
|
|
||||||
endLine?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
*/
|
|
||||||
startColumn?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
* Defaults to `startColumn` when `startColumn` is provided.
|
|
||||||
*/
|
|
||||||
endColumn?: number
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Styling output
|
|
||||||
|
|
||||||
Colored output is supported in the Action logs via standard [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code). 3/4 bit, 8 bit and 24 bit colors are all supported.
|
|
||||||
|
|
||||||
Foreground colors:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 3/4 bit
|
|
||||||
core.info('\u001b[35mThis foreground will be magenta')
|
|
||||||
|
|
||||||
// 8 bit
|
|
||||||
core.info('\u001b[38;5;6mThis foreground will be cyan')
|
|
||||||
|
|
||||||
// 24 bit
|
|
||||||
core.info('\u001b[38;2;255;0;0mThis foreground will be bright red')
|
|
||||||
```
|
|
||||||
|
|
||||||
Background colors:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 3/4 bit
|
|
||||||
core.info('\u001b[43mThis background will be yellow');
|
|
||||||
|
|
||||||
// 8 bit
|
|
||||||
core.info('\u001b[48;5;6mThis background will be cyan')
|
|
||||||
|
|
||||||
// 24 bit
|
|
||||||
core.info('\u001b[48;2;255;0;0mThis background will be bright red')
|
|
||||||
```
|
|
||||||
|
|
||||||
Special styles:
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.info('\u001b[1mBold text')
|
|
||||||
core.info('\u001b[3mItalic text')
|
|
||||||
core.info('\u001b[4mUnderlined text')
|
|
||||||
```
|
|
||||||
|
|
||||||
ANSI escape codes can be combined with one another:
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.info('\u001b[31;46mRed foreground with a cyan background and \u001b[1mbold text at the end');
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note: Escape codes reset at the start of each line
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.info('\u001b[35mThis foreground will be magenta')
|
|
||||||
core.info('This foreground will reset to the default')
|
|
||||||
```
|
|
||||||
|
|
||||||
Manually typing escape codes can be a little difficult, but you can use third party modules such as [ansi-styles](https://github.com/chalk/ansi-styles).
|
|
||||||
|
|
||||||
```js
|
|
||||||
const style = require('ansi-styles');
|
|
||||||
core.info(style.color.ansi16m.hex('#abcdef') + 'Hello world!')
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Action state
|
|
||||||
|
|
||||||
You can use this library to save state and get state for sharing information between a given wrapper action:
|
|
||||||
|
|
||||||
**action.yml**:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: 'Wrapper action sample'
|
|
||||||
inputs:
|
|
||||||
name:
|
|
||||||
default: 'GitHub'
|
|
||||||
runs:
|
|
||||||
using: 'node12'
|
|
||||||
main: 'main.js'
|
|
||||||
post: 'cleanup.js'
|
|
||||||
```
|
|
||||||
|
|
||||||
In action's `main.js`:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
core.saveState("pidToKill", 12345);
|
|
||||||
```
|
|
||||||
|
|
||||||
In action's `cleanup.js`:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
var pid = core.getState("pidToKill");
|
|
||||||
|
|
||||||
process.kill(pid);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### OIDC Token
|
|
||||||
|
|
||||||
You can use these methods to interact with the GitHub OIDC provider and get a JWT ID token which would help to get access token from third party cloud providers.
|
|
||||||
|
|
||||||
**Method Name**: getIDToken()
|
|
||||||
|
|
||||||
**Inputs**
|
|
||||||
|
|
||||||
audience : optional
|
|
||||||
|
|
||||||
**Outputs**
|
|
||||||
|
|
||||||
A [JWT](https://jwt.io/) ID Token
|
|
||||||
|
|
||||||
In action's `main.ts`:
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
async function getIDTokenAction(): Promise<void> {
|
|
||||||
|
|
||||||
const audience = core.getInput('audience', {required: false})
|
|
||||||
|
|
||||||
const id_token1 = await core.getIDToken() // ID Token with default audience
|
|
||||||
const id_token2 = await core.getIDToken(audience) // ID token with custom audience
|
|
||||||
|
|
||||||
// this id_token can be used to get access token from third party cloud providers
|
|
||||||
}
|
|
||||||
getIDTokenAction()
|
|
||||||
```
|
|
||||||
|
|
||||||
In action's `actions.yml`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: 'GetIDToken'
|
|
||||||
description: 'Get ID token from Github OIDC provider'
|
|
||||||
inputs:
|
|
||||||
audience:
|
|
||||||
description: 'Audience for which the ID token is intended for'
|
|
||||||
required: false
|
|
||||||
outputs:
|
|
||||||
id_token1:
|
|
||||||
description: 'ID token obtained from OIDC provider'
|
|
||||||
id_token2:
|
|
||||||
description: 'ID token obtained from OIDC provider'
|
|
||||||
runs:
|
|
||||||
using: 'node12'
|
|
||||||
main: 'dist/index.js'
|
|
||||||
```
|
|
||||||
15
node_modules/@actions/core/lib/command.d.ts
generated
vendored
15
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
export interface CommandProperties {
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ::name key=value,key=value::message
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* ::warning::This is the message
|
|
||||||
* ::set-env name=MY_VAR::some value
|
|
||||||
*/
|
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
|
||||||
export declare function issue(name: string, message?: string): void;
|
|
||||||
92
node_modules/@actions/core/lib/command.js
generated
vendored
92
node_modules/@actions/core/lib/command.js
generated
vendored
@@ -1,92 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.issue = exports.issueCommand = void 0;
|
|
||||||
const os = __importStar(require("os"));
|
|
||||||
const utils_1 = require("./utils");
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ::name key=value,key=value::message
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* ::warning::This is the message
|
|
||||||
* ::set-env name=MY_VAR::some value
|
|
||||||
*/
|
|
||||||
function issueCommand(command, properties, message) {
|
|
||||||
const cmd = new Command(command, properties, message);
|
|
||||||
process.stdout.write(cmd.toString() + os.EOL);
|
|
||||||
}
|
|
||||||
exports.issueCommand = issueCommand;
|
|
||||||
function issue(name, message = '') {
|
|
||||||
issueCommand(name, {}, message);
|
|
||||||
}
|
|
||||||
exports.issue = issue;
|
|
||||||
const CMD_STRING = '::';
|
|
||||||
class Command {
|
|
||||||
constructor(command, properties, message) {
|
|
||||||
if (!command) {
|
|
||||||
command = 'missing.command';
|
|
||||||
}
|
|
||||||
this.command = command;
|
|
||||||
this.properties = properties;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
let cmdStr = CMD_STRING + this.command;
|
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
||||||
cmdStr += ' ';
|
|
||||||
let first = true;
|
|
||||||
for (const key in this.properties) {
|
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
|
||||||
const val = this.properties[key];
|
|
||||||
if (val) {
|
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cmdStr += ',';
|
|
||||||
}
|
|
||||||
cmdStr += `${key}=${escapeProperty(val)}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
|
||||||
return cmdStr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function escapeData(s) {
|
|
||||||
return utils_1.toCommandValue(s)
|
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A');
|
|
||||||
}
|
|
||||||
function escapeProperty(s) {
|
|
||||||
return utils_1.toCommandValue(s)
|
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A')
|
|
||||||
.replace(/:/g, '%3A')
|
|
||||||
.replace(/,/g, '%2C');
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=command.js.map
|
|
||||||
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,OAAO,GAAG,EAAE;IAC9C,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
|
||||||
186
node_modules/@actions/core/lib/core.d.ts
generated
vendored
186
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@@ -1,186 +0,0 @@
|
|||||||
/**
|
|
||||||
* Interface for getInput options
|
|
||||||
*/
|
|
||||||
export interface InputOptions {
|
|
||||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
|
||||||
required?: boolean;
|
|
||||||
/** Optional. Whether leading/trailing whitespace will be trimmed for the input. Defaults to true */
|
|
||||||
trimWhitespace?: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
export declare enum ExitCode {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
Success = 0,
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
Failure = 1
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Optional properties that can be sent with annotatation commands (notice, error, and warning)
|
|
||||||
* See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations.
|
|
||||||
*/
|
|
||||||
export interface AnnotationProperties {
|
|
||||||
/**
|
|
||||||
* A title for the annotation.
|
|
||||||
*/
|
|
||||||
title?: string;
|
|
||||||
/**
|
|
||||||
* The path of the file for which the annotation should be created.
|
|
||||||
*/
|
|
||||||
file?: string;
|
|
||||||
/**
|
|
||||||
* The start line for the annotation.
|
|
||||||
*/
|
|
||||||
startLine?: number;
|
|
||||||
/**
|
|
||||||
* The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
|
|
||||||
*/
|
|
||||||
endLine?: number;
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
*/
|
|
||||||
startColumn?: number;
|
|
||||||
/**
|
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
|
||||||
* Defaults to `startColumn` when `startColumn` is provided.
|
|
||||||
*/
|
|
||||||
endColumn?: number;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets env variable for this action and future actions in the job
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
|
||||||
*/
|
|
||||||
export declare function exportVariable(name: string, val: any): void;
|
|
||||||
/**
|
|
||||||
* Registers a secret which will get masked from logs
|
|
||||||
* @param secret value of the secret
|
|
||||||
*/
|
|
||||||
export declare function setSecret(secret: string): void;
|
|
||||||
/**
|
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
|
||||||
* @param inputPath
|
|
||||||
*/
|
|
||||||
export declare function addPath(inputPath: string): void;
|
|
||||||
/**
|
|
||||||
* Gets the value of an input.
|
|
||||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
|
||||||
* Returns an empty string if the value is not defined.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
export declare function getInput(name: string, options?: InputOptions): string;
|
|
||||||
/**
|
|
||||||
* Gets the values of an multiline input. Each value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string[]
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export declare function getMultilineInput(name: string, options?: InputOptions): string[];
|
|
||||||
/**
|
|
||||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
||||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
||||||
* The return value is also in boolean type.
|
|
||||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns boolean
|
|
||||||
*/
|
|
||||||
export declare function getBooleanInput(name: string, options?: InputOptions): boolean;
|
|
||||||
/**
|
|
||||||
* Sets the value of an output.
|
|
||||||
*
|
|
||||||
* @param name name of the output to set
|
|
||||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
||||||
*/
|
|
||||||
export declare function setOutput(name: string, value: any): void;
|
|
||||||
/**
|
|
||||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
|
||||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export declare function setCommandEcho(enabled: boolean): void;
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1
|
|
||||||
* @param message add error issue message
|
|
||||||
*/
|
|
||||||
export declare function setFailed(message: string | Error): void;
|
|
||||||
/**
|
|
||||||
* Gets whether Actions Step Debug is on or not
|
|
||||||
*/
|
|
||||||
export declare function isDebug(): boolean;
|
|
||||||
/**
|
|
||||||
* Writes debug message to user log
|
|
||||||
* @param message debug message
|
|
||||||
*/
|
|
||||||
export declare function debug(message: string): void;
|
|
||||||
/**
|
|
||||||
* Adds an error issue
|
|
||||||
* @param message error issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
export declare function error(message: string | Error, properties?: AnnotationProperties): void;
|
|
||||||
/**
|
|
||||||
* Adds a warning issue
|
|
||||||
* @param message warning issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
export declare function warning(message: string | Error, properties?: AnnotationProperties): void;
|
|
||||||
/**
|
|
||||||
* Adds a notice issue
|
|
||||||
* @param message notice issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
export declare function notice(message: string | Error, properties?: AnnotationProperties): void;
|
|
||||||
/**
|
|
||||||
* Writes info to log with console.log.
|
|
||||||
* @param message info message
|
|
||||||
*/
|
|
||||||
export declare function info(message: string): void;
|
|
||||||
/**
|
|
||||||
* Begin an output group.
|
|
||||||
*
|
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
|
||||||
*
|
|
||||||
* @param name The name of the output group
|
|
||||||
*/
|
|
||||||
export declare function startGroup(name: string): void;
|
|
||||||
/**
|
|
||||||
* End an output group.
|
|
||||||
*/
|
|
||||||
export declare function endGroup(): void;
|
|
||||||
/**
|
|
||||||
* Wrap an asynchronous function call in a group.
|
|
||||||
*
|
|
||||||
* Returns the same type as the function itself.
|
|
||||||
*
|
|
||||||
* @param name The name of the group
|
|
||||||
* @param fn The function to wrap in the group
|
|
||||||
*/
|
|
||||||
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
||||||
/**
|
|
||||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to store
|
|
||||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
||||||
*/
|
|
||||||
export declare function saveState(name: string, value: any): void;
|
|
||||||
/**
|
|
||||||
* Gets the value of an state set by this action's main execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to get
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
export declare function getState(name: string): string;
|
|
||||||
export declare function getIDToken(aud?: string): Promise<string>;
|
|
||||||
312
node_modules/@actions/core/lib/core.js
generated
vendored
312
node_modules/@actions/core/lib/core.js
generated
vendored
@@ -1,312 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
|
||||||
const command_1 = require("./command");
|
|
||||||
const file_command_1 = require("./file-command");
|
|
||||||
const utils_1 = require("./utils");
|
|
||||||
const os = __importStar(require("os"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const oidc_utils_1 = require("./oidc-utils");
|
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
var ExitCode;
|
|
||||||
(function (ExitCode) {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
|
||||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Variables
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Sets env variable for this action and future actions in the job
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
function exportVariable(name, val) {
|
|
||||||
const convertedVal = utils_1.toCommandValue(val);
|
|
||||||
process.env[name] = convertedVal;
|
|
||||||
const filePath = process.env['GITHUB_ENV'] || '';
|
|
||||||
if (filePath) {
|
|
||||||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
|
||||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
|
||||||
file_command_1.issueCommand('ENV', commandValue);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.exportVariable = exportVariable;
|
|
||||||
/**
|
|
||||||
* Registers a secret which will get masked from logs
|
|
||||||
* @param secret value of the secret
|
|
||||||
*/
|
|
||||||
function setSecret(secret) {
|
|
||||||
command_1.issueCommand('add-mask', {}, secret);
|
|
||||||
}
|
|
||||||
exports.setSecret = setSecret;
|
|
||||||
/**
|
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
|
||||||
* @param inputPath
|
|
||||||
*/
|
|
||||||
function addPath(inputPath) {
|
|
||||||
const filePath = process.env['GITHUB_PATH'] || '';
|
|
||||||
if (filePath) {
|
|
||||||
file_command_1.issueCommand('PATH', inputPath);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
|
||||||
}
|
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
|
||||||
}
|
|
||||||
exports.addPath = addPath;
|
|
||||||
/**
|
|
||||||
* Gets the value of an input.
|
|
||||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
|
||||||
* Returns an empty string if the value is not defined.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
function getInput(name, options) {
|
|
||||||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
|
||||||
if (options && options.required && !val) {
|
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
|
||||||
}
|
|
||||||
if (options && options.trimWhitespace === false) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
return val.trim();
|
|
||||||
}
|
|
||||||
exports.getInput = getInput;
|
|
||||||
/**
|
|
||||||
* Gets the values of an multiline input. Each value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string[]
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function getMultilineInput(name, options) {
|
|
||||||
const inputs = getInput(name, options)
|
|
||||||
.split('\n')
|
|
||||||
.filter(x => x !== '');
|
|
||||||
return inputs;
|
|
||||||
}
|
|
||||||
exports.getMultilineInput = getMultilineInput;
|
|
||||||
/**
|
|
||||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
||||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
||||||
* The return value is also in boolean type.
|
|
||||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns boolean
|
|
||||||
*/
|
|
||||||
function getBooleanInput(name, options) {
|
|
||||||
const trueValue = ['true', 'True', 'TRUE'];
|
|
||||||
const falseValue = ['false', 'False', 'FALSE'];
|
|
||||||
const val = getInput(name, options);
|
|
||||||
if (trueValue.includes(val))
|
|
||||||
return true;
|
|
||||||
if (falseValue.includes(val))
|
|
||||||
return false;
|
|
||||||
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
|
||||||
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
|
||||||
}
|
|
||||||
exports.getBooleanInput = getBooleanInput;
|
|
||||||
/**
|
|
||||||
* Sets the value of an output.
|
|
||||||
*
|
|
||||||
* @param name name of the output to set
|
|
||||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
function setOutput(name, value) {
|
|
||||||
process.stdout.write(os.EOL);
|
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
|
||||||
}
|
|
||||||
exports.setOutput = setOutput;
|
|
||||||
/**
|
|
||||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
|
||||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function setCommandEcho(enabled) {
|
|
||||||
command_1.issue('echo', enabled ? 'on' : 'off');
|
|
||||||
}
|
|
||||||
exports.setCommandEcho = setCommandEcho;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Results
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1
|
|
||||||
* @param message add error issue message
|
|
||||||
*/
|
|
||||||
function setFailed(message) {
|
|
||||||
process.exitCode = ExitCode.Failure;
|
|
||||||
error(message);
|
|
||||||
}
|
|
||||||
exports.setFailed = setFailed;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Logging Commands
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Gets whether Actions Step Debug is on or not
|
|
||||||
*/
|
|
||||||
function isDebug() {
|
|
||||||
return process.env['RUNNER_DEBUG'] === '1';
|
|
||||||
}
|
|
||||||
exports.isDebug = isDebug;
|
|
||||||
/**
|
|
||||||
* Writes debug message to user log
|
|
||||||
* @param message debug message
|
|
||||||
*/
|
|
||||||
function debug(message) {
|
|
||||||
command_1.issueCommand('debug', {}, message);
|
|
||||||
}
|
|
||||||
exports.debug = debug;
|
|
||||||
/**
|
|
||||||
* Adds an error issue
|
|
||||||
* @param message error issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
function error(message, properties = {}) {
|
|
||||||
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
||||||
}
|
|
||||||
exports.error = error;
|
|
||||||
/**
|
|
||||||
* Adds a warning issue
|
|
||||||
* @param message warning issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
function warning(message, properties = {}) {
|
|
||||||
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
||||||
}
|
|
||||||
exports.warning = warning;
|
|
||||||
/**
|
|
||||||
* Adds a notice issue
|
|
||||||
* @param message notice issue message. Errors will be converted to string via toString()
|
|
||||||
* @param properties optional properties to add to the annotation.
|
|
||||||
*/
|
|
||||||
function notice(message, properties = {}) {
|
|
||||||
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
||||||
}
|
|
||||||
exports.notice = notice;
|
|
||||||
/**
|
|
||||||
* Writes info to log with console.log.
|
|
||||||
* @param message info message
|
|
||||||
*/
|
|
||||||
function info(message) {
|
|
||||||
process.stdout.write(message + os.EOL);
|
|
||||||
}
|
|
||||||
exports.info = info;
|
|
||||||
/**
|
|
||||||
* Begin an output group.
|
|
||||||
*
|
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
|
||||||
*
|
|
||||||
* @param name The name of the output group
|
|
||||||
*/
|
|
||||||
function startGroup(name) {
|
|
||||||
command_1.issue('group', name);
|
|
||||||
}
|
|
||||||
exports.startGroup = startGroup;
|
|
||||||
/**
|
|
||||||
* End an output group.
|
|
||||||
*/
|
|
||||||
function endGroup() {
|
|
||||||
command_1.issue('endgroup');
|
|
||||||
}
|
|
||||||
exports.endGroup = endGroup;
|
|
||||||
/**
|
|
||||||
* Wrap an asynchronous function call in a group.
|
|
||||||
*
|
|
||||||
* Returns the same type as the function itself.
|
|
||||||
*
|
|
||||||
* @param name The name of the group
|
|
||||||
* @param fn The function to wrap in the group
|
|
||||||
*/
|
|
||||||
function group(name, fn) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
startGroup(name);
|
|
||||||
let result;
|
|
||||||
try {
|
|
||||||
result = yield fn();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
endGroup();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.group = group;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Wrapper action state
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to store
|
|
||||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
function saveState(name, value) {
|
|
||||||
command_1.issueCommand('save-state', { name }, value);
|
|
||||||
}
|
|
||||||
exports.saveState = saveState;
|
|
||||||
/**
|
|
||||||
* Gets the value of an state set by this action's main execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to get
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
function getState(name) {
|
|
||||||
return process.env[`STATE_${name}`] || '';
|
|
||||||
}
|
|
||||||
exports.getState = getState;
|
|
||||||
function getIDToken(aud) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return yield oidc_utils_1.OidcClient.getIDToken(aud);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.getIDToken = getIDToken;
|
|
||||||
//# sourceMappingURL=core.js.map
|
|
||||||
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAA+D;AAC/D,mCAA2D;AAE3D,uCAAwB;AACxB,2CAA4B;AAE5B,6CAAuC;AAavC;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAuCD,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,sBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IAChD,IAAI,QAAQ,EAAE;QACZ,MAAM,SAAS,GAAG,qCAAqC,CAAA;QACvD,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,SAAS,GAAG,EAAE,CAAC,GAAG,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,GAAG,SAAS,EAAE,CAAA;QACzF,2BAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;KACtC;SAAM;QACL,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;KAC9C;AACH,CAAC;AAZD,wCAYC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;IACjD,IAAI,QAAQ,EAAE;QACZ,2BAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;KACpC;SAAM;QACL,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;KACxC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AARD,0BAQC;AAED;;;;;;;;GAQG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;QAC/C,OAAO,GAAG,CAAA;KACX;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AAZD,4BAYC;AAED;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,IAAY,EACZ,OAAsB;IAEtB,MAAM,MAAM,GAAa,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;SAC7C,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;IAExB,OAAO,MAAM,CAAA;AACf,CAAC;AATD,8CASC;AAED;;;;;;;;;GASG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,OAAsB;IAClE,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAC1C,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACnC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IACxC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IAC1C,MAAM,IAAI,SAAS,CACjB,6DAA6D,IAAI,IAAI;QACnE,4EAA4E,CAC/E,CAAA;AACH,CAAC;AAVD,0CAUC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IAC5B,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAHD,8BAGC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;;GAIG;AACH,SAAgB,KAAK,CACnB,OAAuB,EACvB,aAAmC,EAAE;IAErC,sBAAY,CACV,OAAO,EACP,2BAAmB,CAAC,UAAU,CAAC,EAC/B,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CACxD,CAAA;AACH,CAAC;AATD,sBASC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CACrB,OAAuB,EACvB,aAAmC,EAAE;IAErC,sBAAY,CACV,SAAS,EACT,2BAAmB,CAAC,UAAU,CAAC,EAC/B,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CACxD,CAAA;AACH,CAAC;AATD,0BASC;AAED;;;;GAIG;AACH,SAAgB,MAAM,CACpB,OAAuB,EACvB,aAAmC,EAAE;IAErC,sBAAY,CACV,QAAQ,EACR,2BAAmB,CAAC,UAAU,CAAC,EAC/B,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CACxD,CAAA;AACH,CAAC;AATD,wBASC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC;AAED,SAAsB,UAAU,CAAC,GAAY;;QAC3C,OAAO,MAAM,uBAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACzC,CAAC;CAAA;AAFD,gCAEC"}
|
|
||||||
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
@@ -1 +0,0 @@
|
|||||||
export declare function issueCommand(command: string, message: any): void;
|
|
||||||
42
node_modules/@actions/core/lib/file-command.js
generated
vendored
42
node_modules/@actions/core/lib/file-command.js
generated
vendored
@@ -1,42 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
// For internal use, subject to change.
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.issueCommand = void 0;
|
|
||||||
// We use any as a valid input type
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const os = __importStar(require("os"));
|
|
||||||
const utils_1 = require("./utils");
|
|
||||||
function issueCommand(command, message) {
|
|
||||||
const filePath = process.env[`GITHUB_${command}`];
|
|
||||||
if (!filePath) {
|
|
||||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
|
||||||
}
|
|
||||||
if (!fs.existsSync(filePath)) {
|
|
||||||
throw new Error(`Missing file at path: ${filePath}`);
|
|
||||||
}
|
|
||||||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
|
||||||
encoding: 'utf8'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.issueCommand = issueCommand;
|
|
||||||
//# sourceMappingURL=file-command.js.map
|
|
||||||
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;;;;;;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
|
||||||
7
node_modules/@actions/core/lib/oidc-utils.d.ts
generated
vendored
7
node_modules/@actions/core/lib/oidc-utils.d.ts
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
export declare class OidcClient {
|
|
||||||
private static createHttpClient;
|
|
||||||
private static getRequestToken;
|
|
||||||
private static getIDTokenUrl;
|
|
||||||
private static getCall;
|
|
||||||
static getIDToken(audience?: string): Promise<string>;
|
|
||||||
}
|
|
||||||
77
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
77
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
@@ -1,77 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.OidcClient = void 0;
|
|
||||||
const http_client_1 = require("@actions/http-client");
|
|
||||||
const auth_1 = require("@actions/http-client/auth");
|
|
||||||
const core_1 = require("./core");
|
|
||||||
class OidcClient {
|
|
||||||
static createHttpClient(allowRetry = true, maxRetry = 10) {
|
|
||||||
const requestOptions = {
|
|
||||||
allowRetries: allowRetry,
|
|
||||||
maxRetries: maxRetry
|
|
||||||
};
|
|
||||||
return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
|
|
||||||
}
|
|
||||||
static getRequestToken() {
|
|
||||||
const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
|
|
||||||
if (!token) {
|
|
||||||
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
|
|
||||||
}
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
static getIDTokenUrl() {
|
|
||||||
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
|
|
||||||
if (!runtimeUrl) {
|
|
||||||
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
|
|
||||||
}
|
|
||||||
return runtimeUrl;
|
|
||||||
}
|
|
||||||
static getCall(id_token_url) {
|
|
||||||
var _a;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const httpclient = OidcClient.createHttpClient();
|
|
||||||
const res = yield httpclient
|
|
||||||
.getJson(id_token_url)
|
|
||||||
.catch(error => {
|
|
||||||
throw new Error(`Failed to get ID Token. \n
|
|
||||||
Error Code : ${error.statusCode}\n
|
|
||||||
Error Message: ${error.result.message}`);
|
|
||||||
});
|
|
||||||
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
|
||||||
if (!id_token) {
|
|
||||||
throw new Error('Response json body do not have ID Token field');
|
|
||||||
}
|
|
||||||
return id_token;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static getIDToken(audience) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
// New ID Token is requested from action service
|
|
||||||
let id_token_url = OidcClient.getIDTokenUrl();
|
|
||||||
if (audience) {
|
|
||||||
const encodedAudience = encodeURIComponent(audience);
|
|
||||||
id_token_url = `${id_token_url}&audience=${encodedAudience}`;
|
|
||||||
}
|
|
||||||
core_1.debug(`ID token url is ${id_token_url}`);
|
|
||||||
const id_token = yield OidcClient.getCall(id_token_url);
|
|
||||||
core_1.setSecret(id_token);
|
|
||||||
return id_token;
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
throw new Error(`Error message: ${error.message}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.OidcClient = OidcClient;
|
|
||||||
//# sourceMappingURL=oidc-utils.js.map
|
|
||||||
1
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
1
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,oDAAiE;AACjE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAoB;YACtC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CACtC,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"}
|
|
||||||
14
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
14
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
import { AnnotationProperties } from './core';
|
|
||||||
import { CommandProperties } from './command';
|
|
||||||
/**
|
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
|
||||||
export declare function toCommandValue(input: any): string;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param annotationProperties
|
|
||||||
* @returns The command properties to send with the actual annotation command
|
|
||||||
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
|
||||||
*/
|
|
||||||
export declare function toCommandProperties(annotationProperties: AnnotationProperties): CommandProperties;
|
|
||||||
40
node_modules/@actions/core/lib/utils.js
generated
vendored
40
node_modules/@actions/core/lib/utils.js
generated
vendored
@@ -1,40 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
// We use any as a valid input type
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.toCommandProperties = exports.toCommandValue = void 0;
|
|
||||||
/**
|
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
|
||||||
function toCommandValue(input) {
|
|
||||||
if (input === null || input === undefined) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
else if (typeof input === 'string' || input instanceof String) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
return JSON.stringify(input);
|
|
||||||
}
|
|
||||||
exports.toCommandValue = toCommandValue;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param annotationProperties
|
|
||||||
* @returns The command properties to send with the actual annotation command
|
|
||||||
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
|
||||||
*/
|
|
||||||
function toCommandProperties(annotationProperties) {
|
|
||||||
if (!Object.keys(annotationProperties).length) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
title: annotationProperties.title,
|
|
||||||
file: annotationProperties.file,
|
|
||||||
line: annotationProperties.startLine,
|
|
||||||
endLine: annotationProperties.endLine,
|
|
||||||
col: annotationProperties.startColumn,
|
|
||||||
endColumn: annotationProperties.endColumn
|
|
||||||
};
|
|
||||||
}
|
|
||||||
exports.toCommandProperties = toCommandProperties;
|
|
||||||
//# sourceMappingURL=utils.js.map
|
|
||||||
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;;AAKvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,oBAA0C;IAE1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,KAAK;QACjC,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,IAAI,EAAE,oBAAoB,CAAC,SAAS;QACpC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,GAAG,EAAE,oBAAoB,CAAC,WAAW;QACrC,SAAS,EAAE,oBAAoB,CAAC,SAAS;KAC1C,CAAA;AACH,CAAC;AAfD,kDAeC"}
|
|
||||||
73
node_modules/@actions/core/package.json
generated
vendored
73
node_modules/@actions/core/package.json
generated
vendored
@@ -1,73 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"@actions/core@1.6.0",
|
|
||||||
"/Users/bitcarrot/github/satshkd-vercel"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "@actions/core@1.6.0",
|
|
||||||
"_id": "@actions/core@1.6.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
|
|
||||||
"_location": "/@actions/core",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@actions/core@1.6.0",
|
|
||||||
"name": "@actions/core",
|
|
||||||
"escapedName": "@actions%2fcore",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "1.6.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.6.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz",
|
|
||||||
"_spec": "1.6.0",
|
|
||||||
"_where": "/Users/bitcarrot/github/satshkd-vercel",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/http-client": "^1.0.11"
|
|
||||||
},
|
|
||||||
"description": "Actions core lib",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^12.0.2"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib",
|
|
||||||
"!.DS_Store"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"core"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/core.js",
|
|
||||||
"name": "@actions/core",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git",
|
|
||||||
"directory": "packages/core"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"types": "lib/core.d.ts",
|
|
||||||
"version": "1.6.0"
|
|
||||||
}
|
|
||||||
21
node_modules/@actions/http-client/LICENSE
generated
vendored
21
node_modules/@actions/http-client/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
Actions Http Client for Node.js
|
|
||||||
|
|
||||||
Copyright (c) GitHub, Inc.
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
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.
|
|
||||||
79
node_modules/@actions/http-client/README.md
generated
vendored
79
node_modules/@actions/http-client/README.md
generated
vendored
@@ -1,79 +0,0 @@
|
|||||||
|
|
||||||
<p align="center">
|
|
||||||
<img src="actions.png">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# Actions Http-Client
|
|
||||||
|
|
||||||
[](https://github.com/actions/http-client/actions)
|
|
||||||
|
|
||||||
A lightweight HTTP client optimized for use with actions, TypeScript with generics and async await.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- HTTP client with TypeScript generics and async/await/Promises
|
|
||||||
- Typings included so no need to acquire separately (great for intellisense and no versioning drift)
|
|
||||||
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
|
||||||
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
|
||||||
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
|
||||||
- Redirects supported
|
|
||||||
|
|
||||||
Features and releases [here](./RELEASES.md)
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install @actions/http-client --save
|
|
||||||
```
|
|
||||||
|
|
||||||
## Samples
|
|
||||||
|
|
||||||
See the [HTTP](./__tests__) tests for detailed examples.
|
|
||||||
|
|
||||||
## Errors
|
|
||||||
|
|
||||||
### HTTP
|
|
||||||
|
|
||||||
The HTTP client does not throw unless truly exceptional.
|
|
||||||
|
|
||||||
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
|
||||||
* Redirects (3xx) will be followed by default.
|
|
||||||
|
|
||||||
See [HTTP tests](./__tests__) for detailed examples.
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
|
|
||||||
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
|
||||||
|
|
||||||
```
|
|
||||||
export NODE_DEBUG=http
|
|
||||||
```
|
|
||||||
|
|
||||||
## Node support
|
|
||||||
|
|
||||||
The http-client is built using the latest LTS version of Node 12. It may work on previous node LTS versions but it's tested and officially supported on Node12+.
|
|
||||||
|
|
||||||
## Support and Versioning
|
|
||||||
|
|
||||||
We follow semver and will hold compatibility between major versions and increment the minor version with new features and capabilities (while holding compat).
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
We welcome PRs. Please create an issue and if applicable, a design before proceeding with code.
|
|
||||||
|
|
||||||
once:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
To build:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
To run all tests:
|
|
||||||
```bash
|
|
||||||
$ npm test
|
|
||||||
```
|
|
||||||
26
node_modules/@actions/http-client/RELEASES.md
generated
vendored
26
node_modules/@actions/http-client/RELEASES.md
generated
vendored
@@ -1,26 +0,0 @@
|
|||||||
## Releases
|
|
||||||
|
|
||||||
## 1.0.10
|
|
||||||
|
|
||||||
Contains a bug fix where proxy is defined without a user and password. see [PR here](https://github.com/actions/http-client/pull/42)
|
|
||||||
|
|
||||||
## 1.0.9
|
|
||||||
Throw HttpClientError instead of a generic Error from the \<verb>Json() helper methods when the server responds with a non-successful status code.
|
|
||||||
|
|
||||||
## 1.0.8
|
|
||||||
Fixed security issue where a redirect (e.g. 302) to another domain would pass headers. The fix was to strip the authorization header if the hostname was different. More [details in PR #27](https://github.com/actions/http-client/pull/27)
|
|
||||||
|
|
||||||
## 1.0.7
|
|
||||||
Update NPM dependencies and add 429 to the list of HttpCodes
|
|
||||||
|
|
||||||
## 1.0.6
|
|
||||||
Automatically sends Content-Type and Accept application/json headers for \<verb>Json() helper methods if not set in the client or parameters.
|
|
||||||
|
|
||||||
## 1.0.5
|
|
||||||
Adds \<verb>Json() helper methods for json over http scenarios.
|
|
||||||
|
|
||||||
## 1.0.4
|
|
||||||
Started to add \<verb>Json() helper methods. Do not use this release for that. Use >= 1.0.5 since there was an issue with types.
|
|
||||||
|
|
||||||
## 1.0.1 to 1.0.3
|
|
||||||
Adds proxy support.
|
|
||||||
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
@@ -1,23 +0,0 @@
|
|||||||
import ifm = require('./interfaces');
|
|
||||||
export declare class BasicCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
constructor(username: string, password: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export declare class BearerCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
token: string;
|
|
||||||
constructor(token: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export declare class PersonalAccessTokenCredentialHandler implements ifm.IRequestHandler {
|
|
||||||
token: string;
|
|
||||||
constructor(token: string);
|
|
||||||
prepareRequest(options: any): void;
|
|
||||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
58
node_modules/@actions/http-client/auth.js
generated
vendored
58
node_modules/@actions/http-client/auth.js
generated
vendored
@@ -1,58 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
class BasicCredentialHandler {
|
|
||||||
constructor(username, password) {
|
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] =
|
|
||||||
'Basic ' +
|
|
||||||
Buffer.from(this.username + ':' + this.password).toString('base64');
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.BasicCredentialHandler = BasicCredentialHandler;
|
|
||||||
class BearerCredentialHandler {
|
|
||||||
constructor(token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
// currently implements pre-authorization
|
|
||||||
// TODO: support preAuth = false where it hooks on 401
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] = 'Bearer ' + this.token;
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.BearerCredentialHandler = BearerCredentialHandler;
|
|
||||||
class PersonalAccessTokenCredentialHandler {
|
|
||||||
constructor(token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
// currently implements pre-authorization
|
|
||||||
// TODO: support preAuth = false where it hooks on 401
|
|
||||||
prepareRequest(options) {
|
|
||||||
options.headers['Authorization'] =
|
|
||||||
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
|
|
||||||
}
|
|
||||||
// This handler cannot handle 401
|
|
||||||
canHandleAuthentication(response) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
handleAuthentication(httpClient, requestInfo, objs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
|
||||||
124
node_modules/@actions/http-client/index.d.ts
generated
vendored
124
node_modules/@actions/http-client/index.d.ts
generated
vendored
@@ -1,124 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import http = require('http');
|
|
||||||
import ifm = require('./interfaces');
|
|
||||||
export declare enum HttpCodes {
|
|
||||||
OK = 200,
|
|
||||||
MultipleChoices = 300,
|
|
||||||
MovedPermanently = 301,
|
|
||||||
ResourceMoved = 302,
|
|
||||||
SeeOther = 303,
|
|
||||||
NotModified = 304,
|
|
||||||
UseProxy = 305,
|
|
||||||
SwitchProxy = 306,
|
|
||||||
TemporaryRedirect = 307,
|
|
||||||
PermanentRedirect = 308,
|
|
||||||
BadRequest = 400,
|
|
||||||
Unauthorized = 401,
|
|
||||||
PaymentRequired = 402,
|
|
||||||
Forbidden = 403,
|
|
||||||
NotFound = 404,
|
|
||||||
MethodNotAllowed = 405,
|
|
||||||
NotAcceptable = 406,
|
|
||||||
ProxyAuthenticationRequired = 407,
|
|
||||||
RequestTimeout = 408,
|
|
||||||
Conflict = 409,
|
|
||||||
Gone = 410,
|
|
||||||
TooManyRequests = 429,
|
|
||||||
InternalServerError = 500,
|
|
||||||
NotImplemented = 501,
|
|
||||||
BadGateway = 502,
|
|
||||||
ServiceUnavailable = 503,
|
|
||||||
GatewayTimeout = 504
|
|
||||||
}
|
|
||||||
export declare enum Headers {
|
|
||||||
Accept = "accept",
|
|
||||||
ContentType = "content-type"
|
|
||||||
}
|
|
||||||
export declare enum MediaTypes {
|
|
||||||
ApplicationJson = "application/json"
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
export declare function getProxyUrl(serverUrl: string): string;
|
|
||||||
export declare class HttpClientError extends Error {
|
|
||||||
constructor(message: string, statusCode: number);
|
|
||||||
statusCode: number;
|
|
||||||
result?: any;
|
|
||||||
}
|
|
||||||
export declare class HttpClientResponse implements ifm.IHttpClientResponse {
|
|
||||||
constructor(message: http.IncomingMessage);
|
|
||||||
message: http.IncomingMessage;
|
|
||||||
readBody(): Promise<string>;
|
|
||||||
}
|
|
||||||
export declare function isHttps(requestUrl: string): boolean;
|
|
||||||
export declare class HttpClient {
|
|
||||||
userAgent: string | undefined;
|
|
||||||
handlers: ifm.IRequestHandler[];
|
|
||||||
requestOptions: ifm.IRequestOptions;
|
|
||||||
private _ignoreSslError;
|
|
||||||
private _socketTimeout;
|
|
||||||
private _allowRedirects;
|
|
||||||
private _allowRedirectDowngrade;
|
|
||||||
private _maxRedirects;
|
|
||||||
private _allowRetries;
|
|
||||||
private _maxRetries;
|
|
||||||
private _agent;
|
|
||||||
private _proxyAgent;
|
|
||||||
private _keepAlive;
|
|
||||||
private _disposed;
|
|
||||||
constructor(userAgent?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
|
|
||||||
options(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
get(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
del(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
post(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
patch(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
/**
|
|
||||||
* Gets a typed object from an endpoint
|
|
||||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
|
||||||
*/
|
|
||||||
getJson<T>(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
|
||||||
/**
|
|
||||||
* Makes a raw http request.
|
|
||||||
* All other methods such as get, post, patch, and request ultimately call this.
|
|
||||||
* Prefer get, del, post and patch
|
|
||||||
*/
|
|
||||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
|
||||||
/**
|
|
||||||
* Needs to be called if keepAlive is set to true in request options.
|
|
||||||
*/
|
|
||||||
dispose(): void;
|
|
||||||
/**
|
|
||||||
* Raw request.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
requestRaw(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream): Promise<ifm.IHttpClientResponse>;
|
|
||||||
/**
|
|
||||||
* Raw request with callback.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
* @param onResult
|
|
||||||
*/
|
|
||||||
requestRawWithCallback(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: ifm.IHttpClientResponse) => void): void;
|
|
||||||
/**
|
|
||||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
|
||||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
getAgent(serverUrl: string): http.Agent;
|
|
||||||
private _prepareRequest;
|
|
||||||
private _mergeHeaders;
|
|
||||||
private _getExistingOrDefaultHeader;
|
|
||||||
private _getAgent;
|
|
||||||
private _performExponentialBackoff;
|
|
||||||
private static dateTimeDeserializer;
|
|
||||||
private _processResponse;
|
|
||||||
}
|
|
||||||
537
node_modules/@actions/http-client/index.js
generated
vendored
537
node_modules/@actions/http-client/index.js
generated
vendored
@@ -1,537 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const http = require("http");
|
|
||||||
const https = require("https");
|
|
||||||
const pm = require("./proxy");
|
|
||||||
let tunnel;
|
|
||||||
var HttpCodes;
|
|
||||||
(function (HttpCodes) {
|
|
||||||
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
|
||||||
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
|
||||||
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
|
||||||
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
|
||||||
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
|
||||||
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
|
||||||
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
|
||||||
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
|
||||||
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
||||||
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
||||||
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
|
||||||
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
|
||||||
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
|
||||||
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
|
||||||
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
|
||||||
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
||||||
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
|
||||||
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
||||||
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
|
||||||
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
|
||||||
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
|
||||||
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
|
||||||
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
|
||||||
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
|
||||||
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
|
||||||
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
||||||
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
||||||
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
|
||||||
var Headers;
|
|
||||||
(function (Headers) {
|
|
||||||
Headers["Accept"] = "accept";
|
|
||||||
Headers["ContentType"] = "content-type";
|
|
||||||
})(Headers = exports.Headers || (exports.Headers = {}));
|
|
||||||
var MediaTypes;
|
|
||||||
(function (MediaTypes) {
|
|
||||||
MediaTypes["ApplicationJson"] = "application/json";
|
|
||||||
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
|
||||||
/**
|
|
||||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
function getProxyUrl(serverUrl) {
|
|
||||||
let proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
|
||||||
return proxyUrl ? proxyUrl.href : '';
|
|
||||||
}
|
|
||||||
exports.getProxyUrl = getProxyUrl;
|
|
||||||
const HttpRedirectCodes = [
|
|
||||||
HttpCodes.MovedPermanently,
|
|
||||||
HttpCodes.ResourceMoved,
|
|
||||||
HttpCodes.SeeOther,
|
|
||||||
HttpCodes.TemporaryRedirect,
|
|
||||||
HttpCodes.PermanentRedirect
|
|
||||||
];
|
|
||||||
const HttpResponseRetryCodes = [
|
|
||||||
HttpCodes.BadGateway,
|
|
||||||
HttpCodes.ServiceUnavailable,
|
|
||||||
HttpCodes.GatewayTimeout
|
|
||||||
];
|
|
||||||
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
|
||||||
const ExponentialBackoffCeiling = 10;
|
|
||||||
const ExponentialBackoffTimeSlice = 5;
|
|
||||||
class HttpClientError extends Error {
|
|
||||||
constructor(message, statusCode) {
|
|
||||||
super(message);
|
|
||||||
this.name = 'HttpClientError';
|
|
||||||
this.statusCode = statusCode;
|
|
||||||
Object.setPrototypeOf(this, HttpClientError.prototype);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClientError = HttpClientError;
|
|
||||||
class HttpClientResponse {
|
|
||||||
constructor(message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
readBody() {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
let output = Buffer.alloc(0);
|
|
||||||
this.message.on('data', (chunk) => {
|
|
||||||
output = Buffer.concat([output, chunk]);
|
|
||||||
});
|
|
||||||
this.message.on('end', () => {
|
|
||||||
resolve(output.toString());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClientResponse = HttpClientResponse;
|
|
||||||
function isHttps(requestUrl) {
|
|
||||||
let parsedUrl = new URL(requestUrl);
|
|
||||||
return parsedUrl.protocol === 'https:';
|
|
||||||
}
|
|
||||||
exports.isHttps = isHttps;
|
|
||||||
class HttpClient {
|
|
||||||
constructor(userAgent, handlers, requestOptions) {
|
|
||||||
this._ignoreSslError = false;
|
|
||||||
this._allowRedirects = true;
|
|
||||||
this._allowRedirectDowngrade = false;
|
|
||||||
this._maxRedirects = 50;
|
|
||||||
this._allowRetries = false;
|
|
||||||
this._maxRetries = 1;
|
|
||||||
this._keepAlive = false;
|
|
||||||
this._disposed = false;
|
|
||||||
this.userAgent = userAgent;
|
|
||||||
this.handlers = handlers || [];
|
|
||||||
this.requestOptions = requestOptions;
|
|
||||||
if (requestOptions) {
|
|
||||||
if (requestOptions.ignoreSslError != null) {
|
|
||||||
this._ignoreSslError = requestOptions.ignoreSslError;
|
|
||||||
}
|
|
||||||
this._socketTimeout = requestOptions.socketTimeout;
|
|
||||||
if (requestOptions.allowRedirects != null) {
|
|
||||||
this._allowRedirects = requestOptions.allowRedirects;
|
|
||||||
}
|
|
||||||
if (requestOptions.allowRedirectDowngrade != null) {
|
|
||||||
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
|
||||||
}
|
|
||||||
if (requestOptions.maxRedirects != null) {
|
|
||||||
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
|
||||||
}
|
|
||||||
if (requestOptions.keepAlive != null) {
|
|
||||||
this._keepAlive = requestOptions.keepAlive;
|
|
||||||
}
|
|
||||||
if (requestOptions.allowRetries != null) {
|
|
||||||
this._allowRetries = requestOptions.allowRetries;
|
|
||||||
}
|
|
||||||
if (requestOptions.maxRetries != null) {
|
|
||||||
this._maxRetries = requestOptions.maxRetries;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
options(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
get(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
del(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
post(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
patch(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
put(requestUrl, data, additionalHeaders) {
|
|
||||||
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
head(requestUrl, additionalHeaders) {
|
|
||||||
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
|
||||||
}
|
|
||||||
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
|
||||||
return this.request(verb, requestUrl, stream, additionalHeaders);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets a typed object from an endpoint
|
|
||||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
|
||||||
*/
|
|
||||||
async getJson(requestUrl, additionalHeaders = {}) {
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.get(requestUrl, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async postJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.post(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async putJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.put(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
async patchJson(requestUrl, obj, additionalHeaders = {}) {
|
|
||||||
let data = JSON.stringify(obj, null, 2);
|
|
||||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|
||||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|
||||||
let res = await this.patch(requestUrl, data, additionalHeaders);
|
|
||||||
return this._processResponse(res, this.requestOptions);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Makes a raw http request.
|
|
||||||
* All other methods such as get, post, patch, and request ultimately call this.
|
|
||||||
* Prefer get, del, post and patch
|
|
||||||
*/
|
|
||||||
async request(verb, requestUrl, data, headers) {
|
|
||||||
if (this._disposed) {
|
|
||||||
throw new Error('Client has already been disposed.');
|
|
||||||
}
|
|
||||||
let parsedUrl = new URL(requestUrl);
|
|
||||||
let info = this._prepareRequest(verb, parsedUrl, headers);
|
|
||||||
// Only perform retries on reads since writes may not be idempotent.
|
|
||||||
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
|
||||||
? this._maxRetries + 1
|
|
||||||
: 1;
|
|
||||||
let numTries = 0;
|
|
||||||
let response;
|
|
||||||
while (numTries < maxTries) {
|
|
||||||
response = await this.requestRaw(info, data);
|
|
||||||
// Check if it's an authentication challenge
|
|
||||||
if (response &&
|
|
||||||
response.message &&
|
|
||||||
response.message.statusCode === HttpCodes.Unauthorized) {
|
|
||||||
let authenticationHandler;
|
|
||||||
for (let i = 0; i < this.handlers.length; i++) {
|
|
||||||
if (this.handlers[i].canHandleAuthentication(response)) {
|
|
||||||
authenticationHandler = this.handlers[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (authenticationHandler) {
|
|
||||||
return authenticationHandler.handleAuthentication(this, info, data);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// We have received an unauthorized response but have no handlers to handle it.
|
|
||||||
// Let the response return to the caller.
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let redirectsRemaining = this._maxRedirects;
|
|
||||||
while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&
|
|
||||||
this._allowRedirects &&
|
|
||||||
redirectsRemaining > 0) {
|
|
||||||
const redirectUrl = response.message.headers['location'];
|
|
||||||
if (!redirectUrl) {
|
|
||||||
// if there's no location to redirect to, we won't
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let parsedRedirectUrl = new URL(redirectUrl);
|
|
||||||
if (parsedUrl.protocol == 'https:' &&
|
|
||||||
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
|
||||||
!this._allowRedirectDowngrade) {
|
|
||||||
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
|
||||||
}
|
|
||||||
// we need to finish reading the response before reassigning response
|
|
||||||
// which will leak the open socket.
|
|
||||||
await response.readBody();
|
|
||||||
// strip authorization header if redirected to a different hostname
|
|
||||||
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
|
||||||
for (let header in headers) {
|
|
||||||
// header names are case insensitive
|
|
||||||
if (header.toLowerCase() === 'authorization') {
|
|
||||||
delete headers[header];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// let's make the request with the new redirectUrl
|
|
||||||
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
|
||||||
response = await this.requestRaw(info, data);
|
|
||||||
redirectsRemaining--;
|
|
||||||
}
|
|
||||||
if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {
|
|
||||||
// If not a retry code, return immediately instead of retrying
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
numTries += 1;
|
|
||||||
if (numTries < maxTries) {
|
|
||||||
await response.readBody();
|
|
||||||
await this._performExponentialBackoff(numTries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Needs to be called if keepAlive is set to true in request options.
|
|
||||||
*/
|
|
||||||
dispose() {
|
|
||||||
if (this._agent) {
|
|
||||||
this._agent.destroy();
|
|
||||||
}
|
|
||||||
this._disposed = true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Raw request.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
requestRaw(info, data) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let callbackForResult = function (err, res) {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
resolve(res);
|
|
||||||
};
|
|
||||||
this.requestRawWithCallback(info, data, callbackForResult);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Raw request with callback.
|
|
||||||
* @param info
|
|
||||||
* @param data
|
|
||||||
* @param onResult
|
|
||||||
*/
|
|
||||||
requestRawWithCallback(info, data, onResult) {
|
|
||||||
let socket;
|
|
||||||
if (typeof data === 'string') {
|
|
||||||
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
|
||||||
}
|
|
||||||
let callbackCalled = false;
|
|
||||||
let handleResult = (err, res) => {
|
|
||||||
if (!callbackCalled) {
|
|
||||||
callbackCalled = true;
|
|
||||||
onResult(err, res);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let req = info.httpModule.request(info.options, (msg) => {
|
|
||||||
let res = new HttpClientResponse(msg);
|
|
||||||
handleResult(null, res);
|
|
||||||
});
|
|
||||||
req.on('socket', sock => {
|
|
||||||
socket = sock;
|
|
||||||
});
|
|
||||||
// If we ever get disconnected, we want the socket to timeout eventually
|
|
||||||
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
|
||||||
if (socket) {
|
|
||||||
socket.end();
|
|
||||||
}
|
|
||||||
handleResult(new Error('Request timeout: ' + info.options.path), null);
|
|
||||||
});
|
|
||||||
req.on('error', function (err) {
|
|
||||||
// err has statusCode property
|
|
||||||
// res should have headers
|
|
||||||
handleResult(err, null);
|
|
||||||
});
|
|
||||||
if (data && typeof data === 'string') {
|
|
||||||
req.write(data, 'utf8');
|
|
||||||
}
|
|
||||||
if (data && typeof data !== 'string') {
|
|
||||||
data.on('close', function () {
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
data.pipe(req);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
req.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
|
||||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
|
||||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|
||||||
*/
|
|
||||||
getAgent(serverUrl) {
|
|
||||||
let parsedUrl = new URL(serverUrl);
|
|
||||||
return this._getAgent(parsedUrl);
|
|
||||||
}
|
|
||||||
_prepareRequest(method, requestUrl, headers) {
|
|
||||||
const info = {};
|
|
||||||
info.parsedUrl = requestUrl;
|
|
||||||
const usingSsl = info.parsedUrl.protocol === 'https:';
|
|
||||||
info.httpModule = usingSsl ? https : http;
|
|
||||||
const defaultPort = usingSsl ? 443 : 80;
|
|
||||||
info.options = {};
|
|
||||||
info.options.host = info.parsedUrl.hostname;
|
|
||||||
info.options.port = info.parsedUrl.port
|
|
||||||
? parseInt(info.parsedUrl.port)
|
|
||||||
: defaultPort;
|
|
||||||
info.options.path =
|
|
||||||
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
|
||||||
info.options.method = method;
|
|
||||||
info.options.headers = this._mergeHeaders(headers);
|
|
||||||
if (this.userAgent != null) {
|
|
||||||
info.options.headers['user-agent'] = this.userAgent;
|
|
||||||
}
|
|
||||||
info.options.agent = this._getAgent(info.parsedUrl);
|
|
||||||
// gives handlers an opportunity to participate
|
|
||||||
if (this.handlers) {
|
|
||||||
this.handlers.forEach(handler => {
|
|
||||||
handler.prepareRequest(info.options);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
_mergeHeaders(headers) {
|
|
||||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|
||||||
if (this.requestOptions && this.requestOptions.headers) {
|
|
||||||
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
|
|
||||||
}
|
|
||||||
return lowercaseKeys(headers || {});
|
|
||||||
}
|
|
||||||
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
|
||||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|
||||||
let clientHeader;
|
|
||||||
if (this.requestOptions && this.requestOptions.headers) {
|
|
||||||
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
|
||||||
}
|
|
||||||
return additionalHeaders[header] || clientHeader || _default;
|
|
||||||
}
|
|
||||||
_getAgent(parsedUrl) {
|
|
||||||
let agent;
|
|
||||||
let proxyUrl = pm.getProxyUrl(parsedUrl);
|
|
||||||
let useProxy = proxyUrl && proxyUrl.hostname;
|
|
||||||
if (this._keepAlive && useProxy) {
|
|
||||||
agent = this._proxyAgent;
|
|
||||||
}
|
|
||||||
if (this._keepAlive && !useProxy) {
|
|
||||||
agent = this._agent;
|
|
||||||
}
|
|
||||||
// if agent is already assigned use that agent.
|
|
||||||
if (!!agent) {
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
const usingSsl = parsedUrl.protocol === 'https:';
|
|
||||||
let maxSockets = 100;
|
|
||||||
if (!!this.requestOptions) {
|
|
||||||
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
|
||||||
}
|
|
||||||
if (useProxy) {
|
|
||||||
// If using proxy, need tunnel
|
|
||||||
if (!tunnel) {
|
|
||||||
tunnel = require('tunnel');
|
|
||||||
}
|
|
||||||
const agentOptions = {
|
|
||||||
maxSockets: maxSockets,
|
|
||||||
keepAlive: this._keepAlive,
|
|
||||||
proxy: {
|
|
||||||
...((proxyUrl.username || proxyUrl.password) && {
|
|
||||||
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
|
||||||
}),
|
|
||||||
host: proxyUrl.hostname,
|
|
||||||
port: proxyUrl.port
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let tunnelAgent;
|
|
||||||
const overHttps = proxyUrl.protocol === 'https:';
|
|
||||||
if (usingSsl) {
|
|
||||||
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
|
||||||
}
|
|
||||||
agent = tunnelAgent(agentOptions);
|
|
||||||
this._proxyAgent = agent;
|
|
||||||
}
|
|
||||||
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
|
||||||
if (this._keepAlive && !agent) {
|
|
||||||
const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
|
||||||
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
|
||||||
this._agent = agent;
|
|
||||||
}
|
|
||||||
// if not using private agent and tunnel agent isn't setup then use global agent
|
|
||||||
if (!agent) {
|
|
||||||
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
|
||||||
}
|
|
||||||
if (usingSsl && this._ignoreSslError) {
|
|
||||||
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
|
||||||
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
|
||||||
// we have to cast it to any and change it directly
|
|
||||||
agent.options = Object.assign(agent.options || {}, {
|
|
||||||
rejectUnauthorized: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
_performExponentialBackoff(retryNumber) {
|
|
||||||
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
|
||||||
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
|
||||||
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
|
||||||
}
|
|
||||||
static dateTimeDeserializer(key, value) {
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
let a = new Date(value);
|
|
||||||
if (!isNaN(a.valueOf())) {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
async _processResponse(res, options) {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
const statusCode = res.message.statusCode;
|
|
||||||
const response = {
|
|
||||||
statusCode: statusCode,
|
|
||||||
result: null,
|
|
||||||
headers: {}
|
|
||||||
};
|
|
||||||
// not found leads to null obj returned
|
|
||||||
if (statusCode == HttpCodes.NotFound) {
|
|
||||||
resolve(response);
|
|
||||||
}
|
|
||||||
let obj;
|
|
||||||
let contents;
|
|
||||||
// get the result from the body
|
|
||||||
try {
|
|
||||||
contents = await res.readBody();
|
|
||||||
if (contents && contents.length > 0) {
|
|
||||||
if (options && options.deserializeDates) {
|
|
||||||
obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
obj = JSON.parse(contents);
|
|
||||||
}
|
|
||||||
response.result = obj;
|
|
||||||
}
|
|
||||||
response.headers = res.message.headers;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// Invalid resource (contents not json); leaving result obj null
|
|
||||||
}
|
|
||||||
// note that 3xx redirects are handled by the http layer.
|
|
||||||
if (statusCode > 299) {
|
|
||||||
let msg;
|
|
||||||
// if exception/error in body, attempt to get better error
|
|
||||||
if (obj && obj.message) {
|
|
||||||
msg = obj.message;
|
|
||||||
}
|
|
||||||
else if (contents && contents.length > 0) {
|
|
||||||
// it may be the case that the exception is in the body message as string
|
|
||||||
msg = contents;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg = 'Failed request: (' + statusCode + ')';
|
|
||||||
}
|
|
||||||
let err = new HttpClientError(msg, statusCode);
|
|
||||||
err.result = response.result;
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HttpClient = HttpClient;
|
|
||||||
49
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
49
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
@@ -1,49 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import http = require('http');
|
|
||||||
export interface IHeaders {
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
export interface IHttpClient {
|
|
||||||
options(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
get(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
del(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
post(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
patch(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
put(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: IHeaders): Promise<IHttpClientResponse>;
|
|
||||||
requestRaw(info: IRequestInfo, data: string | NodeJS.ReadableStream): Promise<IHttpClientResponse>;
|
|
||||||
requestRawWithCallback(info: IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: IHttpClientResponse) => void): void;
|
|
||||||
}
|
|
||||||
export interface IRequestHandler {
|
|
||||||
prepareRequest(options: http.RequestOptions): void;
|
|
||||||
canHandleAuthentication(response: IHttpClientResponse): boolean;
|
|
||||||
handleAuthentication(httpClient: IHttpClient, requestInfo: IRequestInfo, objs: any): Promise<IHttpClientResponse>;
|
|
||||||
}
|
|
||||||
export interface IHttpClientResponse {
|
|
||||||
message: http.IncomingMessage;
|
|
||||||
readBody(): Promise<string>;
|
|
||||||
}
|
|
||||||
export interface IRequestInfo {
|
|
||||||
options: http.RequestOptions;
|
|
||||||
parsedUrl: URL;
|
|
||||||
httpModule: any;
|
|
||||||
}
|
|
||||||
export interface IRequestOptions {
|
|
||||||
headers?: IHeaders;
|
|
||||||
socketTimeout?: number;
|
|
||||||
ignoreSslError?: boolean;
|
|
||||||
allowRedirects?: boolean;
|
|
||||||
allowRedirectDowngrade?: boolean;
|
|
||||||
maxRedirects?: number;
|
|
||||||
maxSockets?: number;
|
|
||||||
keepAlive?: boolean;
|
|
||||||
deserializeDates?: boolean;
|
|
||||||
allowRetries?: boolean;
|
|
||||||
maxRetries?: number;
|
|
||||||
}
|
|
||||||
export interface ITypedResponse<T> {
|
|
||||||
statusCode: number;
|
|
||||||
result: T | null;
|
|
||||||
headers: Object;
|
|
||||||
}
|
|
||||||
2
node_modules/@actions/http-client/interfaces.js
generated
vendored
2
node_modules/@actions/http-client/interfaces.js
generated
vendored
@@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
70
node_modules/@actions/http-client/package.json
generated
vendored
70
node_modules/@actions/http-client/package.json
generated
vendored
@@ -1,70 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"@actions/http-client@1.0.11",
|
|
||||||
"/Users/bitcarrot/github/satshkd-vercel"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "@actions/http-client@1.0.11",
|
|
||||||
"_id": "@actions/http-client@1.0.11",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
|
||||||
"_location": "/@actions/http-client",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@actions/http-client@1.0.11",
|
|
||||||
"name": "@actions/http-client",
|
|
||||||
"escapedName": "@actions%2fhttp-client",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "1.0.11",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.0.11"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/@actions/core"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
|
||||||
"_spec": "1.0.11",
|
|
||||||
"_where": "/Users/bitcarrot/github/satshkd-vercel",
|
|
||||||
"author": {
|
|
||||||
"name": "GitHub, Inc."
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/http-client/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"tunnel": "0.0.6"
|
|
||||||
},
|
|
||||||
"description": "Actions Http Client",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/jest": "^25.1.4",
|
|
||||||
"@types/node": "^12.12.31",
|
|
||||||
"jest": "^25.1.0",
|
|
||||||
"prettier": "^2.0.4",
|
|
||||||
"proxy": "^1.0.1",
|
|
||||||
"ts-jest": "^25.2.1",
|
|
||||||
"typescript": "^3.8.3"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/actions/http-client#readme",
|
|
||||||
"keywords": [
|
|
||||||
"Actions",
|
|
||||||
"Http"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "index.js",
|
|
||||||
"name": "@actions/http-client",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/http-client.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"audit-check": "npm audit --audit-level=moderate",
|
|
||||||
"build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out",
|
|
||||||
"format": "prettier --write *.ts && prettier --write **/*.ts",
|
|
||||||
"format-check": "prettier --check *.ts && prettier --check **/*.ts",
|
|
||||||
"test": "jest"
|
|
||||||
},
|
|
||||||
"version": "1.0.11"
|
|
||||||
}
|
|
||||||
2
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
2
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
|||||||
export declare function getProxyUrl(reqUrl: URL): URL | undefined;
|
|
||||||
export declare function checkBypass(reqUrl: URL): boolean;
|
|
||||||
57
node_modules/@actions/http-client/proxy.js
generated
vendored
57
node_modules/@actions/http-client/proxy.js
generated
vendored
@@ -1,57 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
function getProxyUrl(reqUrl) {
|
|
||||||
let usingSsl = reqUrl.protocol === 'https:';
|
|
||||||
let proxyUrl;
|
|
||||||
if (checkBypass(reqUrl)) {
|
|
||||||
return proxyUrl;
|
|
||||||
}
|
|
||||||
let proxyVar;
|
|
||||||
if (usingSsl) {
|
|
||||||
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
|
||||||
}
|
|
||||||
if (proxyVar) {
|
|
||||||
proxyUrl = new URL(proxyVar);
|
|
||||||
}
|
|
||||||
return proxyUrl;
|
|
||||||
}
|
|
||||||
exports.getProxyUrl = getProxyUrl;
|
|
||||||
function checkBypass(reqUrl) {
|
|
||||||
if (!reqUrl.hostname) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
|
||||||
if (!noProxy) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Determine the request port
|
|
||||||
let reqPort;
|
|
||||||
if (reqUrl.port) {
|
|
||||||
reqPort = Number(reqUrl.port);
|
|
||||||
}
|
|
||||||
else if (reqUrl.protocol === 'http:') {
|
|
||||||
reqPort = 80;
|
|
||||||
}
|
|
||||||
else if (reqUrl.protocol === 'https:') {
|
|
||||||
reqPort = 443;
|
|
||||||
}
|
|
||||||
// Format the request hostname and hostname with port
|
|
||||||
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
|
||||||
if (typeof reqPort === 'number') {
|
|
||||||
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
|
||||||
}
|
|
||||||
// Compare request host against noproxy
|
|
||||||
for (let upperNoProxyItem of noProxy
|
|
||||||
.split(',')
|
|
||||||
.map(x => x.trim().toUpperCase())
|
|
||||||
.filter(x => x)) {
|
|
||||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
exports.checkBypass = checkBypass;
|
|
||||||
243
node_modules/accepts/HISTORY.md
generated
vendored
243
node_modules/accepts/HISTORY.md
generated
vendored
@@ -1,243 +0,0 @@
|
|||||||
1.3.8 / 2022-02-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.34
|
|
||||||
- deps: mime-db@~1.51.0
|
|
||||||
* deps: negotiator@0.6.3
|
|
||||||
|
|
||||||
1.3.7 / 2019-04-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.6.2
|
|
||||||
- Fix sorting charset, encoding, and language with extra parameters
|
|
||||||
|
|
||||||
1.3.6 / 2019-04-28
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.24
|
|
||||||
- deps: mime-db@~1.40.0
|
|
||||||
|
|
||||||
1.3.5 / 2018-02-28
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.18
|
|
||||||
- deps: mime-db@~1.33.0
|
|
||||||
|
|
||||||
1.3.4 / 2017-08-22
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.16
|
|
||||||
- deps: mime-db@~1.29.0
|
|
||||||
|
|
||||||
1.3.3 / 2016-05-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.11
|
|
||||||
- deps: mime-db@~1.23.0
|
|
||||||
* deps: negotiator@0.6.1
|
|
||||||
- perf: improve `Accept` parsing speed
|
|
||||||
- perf: improve `Accept-Charset` parsing speed
|
|
||||||
- perf: improve `Accept-Encoding` parsing speed
|
|
||||||
- perf: improve `Accept-Language` parsing speed
|
|
||||||
|
|
||||||
1.3.2 / 2016-03-08
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.10
|
|
||||||
- Fix extension of `application/dash+xml`
|
|
||||||
- Update primary extension for `audio/mp4`
|
|
||||||
- deps: mime-db@~1.22.0
|
|
||||||
|
|
||||||
1.3.1 / 2016-01-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.9
|
|
||||||
- deps: mime-db@~1.21.0
|
|
||||||
|
|
||||||
1.3.0 / 2015-09-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.7
|
|
||||||
- deps: mime-db@~1.19.0
|
|
||||||
* deps: negotiator@0.6.0
|
|
||||||
- Fix including type extensions in parameters in `Accept` parsing
|
|
||||||
- Fix parsing `Accept` parameters with quoted equals
|
|
||||||
- Fix parsing `Accept` parameters with quoted semicolons
|
|
||||||
- Lazy-load modules from main entry point
|
|
||||||
- perf: delay type concatenation until needed
|
|
||||||
- perf: enable strict mode
|
|
||||||
- perf: hoist regular expressions
|
|
||||||
- perf: remove closures getting spec properties
|
|
||||||
- perf: remove a closure from media type parsing
|
|
||||||
- perf: remove property delete from media type parsing
|
|
||||||
|
|
||||||
1.2.13 / 2015-09-06
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.6
|
|
||||||
- deps: mime-db@~1.18.0
|
|
||||||
|
|
||||||
1.2.12 / 2015-07-30
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.4
|
|
||||||
- deps: mime-db@~1.16.0
|
|
||||||
|
|
||||||
1.2.11 / 2015-07-16
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.3
|
|
||||||
- deps: mime-db@~1.15.0
|
|
||||||
|
|
||||||
1.2.10 / 2015-07-01
|
|
||||||
===================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.2
|
|
||||||
- deps: mime-db@~1.14.0
|
|
||||||
|
|
||||||
1.2.9 / 2015-06-08
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.1
|
|
||||||
- perf: fix deopt during mapping
|
|
||||||
|
|
||||||
1.2.8 / 2015-06-07
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.1.0
|
|
||||||
- deps: mime-db@~1.13.0
|
|
||||||
* perf: avoid argument reassignment & argument slice
|
|
||||||
* perf: avoid negotiator recursive construction
|
|
||||||
* perf: enable strict mode
|
|
||||||
* perf: remove unnecessary bitwise operator
|
|
||||||
|
|
||||||
1.2.7 / 2015-05-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.5.3
|
|
||||||
- Fix media type parameter matching to be case-insensitive
|
|
||||||
|
|
||||||
1.2.6 / 2015-05-07
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.11
|
|
||||||
- deps: mime-db@~1.9.1
|
|
||||||
* deps: negotiator@0.5.2
|
|
||||||
- Fix comparing media types with quoted values
|
|
||||||
- Fix splitting media types with quoted commas
|
|
||||||
|
|
||||||
1.2.5 / 2015-03-13
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.10
|
|
||||||
- deps: mime-db@~1.8.0
|
|
||||||
|
|
||||||
1.2.4 / 2015-02-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Support Node.js 0.6
|
|
||||||
* deps: mime-types@~2.0.9
|
|
||||||
- deps: mime-db@~1.7.0
|
|
||||||
* deps: negotiator@0.5.1
|
|
||||||
- Fix preference sorting to be stable for long acceptable lists
|
|
||||||
|
|
||||||
1.2.3 / 2015-01-31
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.8
|
|
||||||
- deps: mime-db@~1.6.0
|
|
||||||
|
|
||||||
1.2.2 / 2014-12-30
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.7
|
|
||||||
- deps: mime-db@~1.5.0
|
|
||||||
|
|
||||||
1.2.1 / 2014-12-30
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.5
|
|
||||||
- deps: mime-db@~1.3.1
|
|
||||||
|
|
||||||
1.2.0 / 2014-12-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.5.0
|
|
||||||
- Fix list return order when large accepted list
|
|
||||||
- Fix missing identity encoding when q=0 exists
|
|
||||||
- Remove dynamic building of Negotiator class
|
|
||||||
|
|
||||||
1.1.4 / 2014-12-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.4
|
|
||||||
- deps: mime-db@~1.3.0
|
|
||||||
|
|
||||||
1.1.3 / 2014-11-09
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.3
|
|
||||||
- deps: mime-db@~1.2.0
|
|
||||||
|
|
||||||
1.1.2 / 2014-10-14
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.4.9
|
|
||||||
- Fix error when media type has invalid parameter
|
|
||||||
|
|
||||||
1.1.1 / 2014-09-28
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: mime-types@~2.0.2
|
|
||||||
- deps: mime-db@~1.1.0
|
|
||||||
* deps: negotiator@0.4.8
|
|
||||||
- Fix all negotiations to be case-insensitive
|
|
||||||
- Stable sort preferences of same quality according to client order
|
|
||||||
|
|
||||||
1.1.0 / 2014-09-02
|
|
||||||
==================
|
|
||||||
|
|
||||||
* update `mime-types`
|
|
||||||
|
|
||||||
1.0.7 / 2014-07-04
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix wrong type returned from `type` when match after unknown extension
|
|
||||||
|
|
||||||
1.0.6 / 2014-06-24
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.4.7
|
|
||||||
|
|
||||||
1.0.5 / 2014-06-20
|
|
||||||
==================
|
|
||||||
|
|
||||||
* fix crash when unknown extension given
|
|
||||||
|
|
||||||
1.0.4 / 2014-06-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* use `mime-types`
|
|
||||||
|
|
||||||
1.0.3 / 2014-06-11
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: negotiator@0.4.6
|
|
||||||
- Order by specificity when quality is the same
|
|
||||||
|
|
||||||
1.0.2 / 2014-05-29
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix interpretation when header not in request
|
|
||||||
* deps: pin negotiator@0.4.5
|
|
||||||
|
|
||||||
1.0.1 / 2014-01-18
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Identity encoding isn't always acceptable
|
|
||||||
* deps: negotiator@~0.4.0
|
|
||||||
|
|
||||||
1.0.0 / 2013-12-27
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Genesis
|
|
||||||
23
node_modules/accepts/LICENSE
generated
vendored
23
node_modules/accepts/LICENSE
generated
vendored
@@ -1,23 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
|
||||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
|
||||||
|
|
||||||
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.
|
|
||||||
140
node_modules/accepts/README.md
generated
vendored
140
node_modules/accepts/README.md
generated
vendored
@@ -1,140 +0,0 @@
|
|||||||
# accepts
|
|
||||||
|
|
||||||
[![NPM Version][npm-version-image]][npm-url]
|
|
||||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
|
||||||
[![Node.js Version][node-version-image]][node-version-url]
|
|
||||||
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
|
||||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
|
||||||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
|
||||||
|
|
||||||
In addition to negotiator, it allows:
|
|
||||||
|
|
||||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
|
||||||
as well as `('text/html', 'application/json')`.
|
|
||||||
- Allows type shorthands such as `json`.
|
|
||||||
- Returns `false` when no types match
|
|
||||||
- Treats non-existent headers as `*`
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
||||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
||||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install accepts
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
```js
|
|
||||||
var accepts = require('accepts')
|
|
||||||
```
|
|
||||||
|
|
||||||
### accepts(req)
|
|
||||||
|
|
||||||
Create a new `Accepts` object for the given `req`.
|
|
||||||
|
|
||||||
#### .charset(charsets)
|
|
||||||
|
|
||||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
|
||||||
then `false` is returned.
|
|
||||||
|
|
||||||
#### .charsets()
|
|
||||||
|
|
||||||
Return the charsets that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
#### .encoding(encodings)
|
|
||||||
|
|
||||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
|
||||||
then `false` is returned.
|
|
||||||
|
|
||||||
#### .encodings()
|
|
||||||
|
|
||||||
Return the encodings that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
#### .language(languages)
|
|
||||||
|
|
||||||
Return the first accepted language. If nothing in `languages` is accepted,
|
|
||||||
then `false` is returned.
|
|
||||||
|
|
||||||
#### .languages()
|
|
||||||
|
|
||||||
Return the languages that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
#### .type(types)
|
|
||||||
|
|
||||||
Return the first accepted type (and it is returned as the same text as what
|
|
||||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
|
||||||
is returned.
|
|
||||||
|
|
||||||
The `types` array can contain full MIME types or file extensions. Any value
|
|
||||||
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
|
||||||
|
|
||||||
#### .types()
|
|
||||||
|
|
||||||
Return the types that the request accepts, in the order of the client's
|
|
||||||
preference (most preferred first).
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Simple type negotiation
|
|
||||||
|
|
||||||
This simple example shows how to use `accepts` to return a different typed
|
|
||||||
respond body based on what the client wants to accept. The server lists it's
|
|
||||||
preferences in order and will get back the best match between the client and
|
|
||||||
server.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var accepts = require('accepts')
|
|
||||||
var http = require('http')
|
|
||||||
|
|
||||||
function app (req, res) {
|
|
||||||
var accept = accepts(req)
|
|
||||||
|
|
||||||
// the order of this list is significant; should be server preferred order
|
|
||||||
switch (accept.type(['json', 'html'])) {
|
|
||||||
case 'json':
|
|
||||||
res.setHeader('Content-Type', 'application/json')
|
|
||||||
res.write('{"hello":"world!"}')
|
|
||||||
break
|
|
||||||
case 'html':
|
|
||||||
res.setHeader('Content-Type', 'text/html')
|
|
||||||
res.write('<b>hello, world!</b>')
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
// the fallback is text/plain, so no need to specify it above
|
|
||||||
res.setHeader('Content-Type', 'text/plain')
|
|
||||||
res.write('hello, world!')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
res.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
http.createServer(app).listen(3000)
|
|
||||||
```
|
|
||||||
|
|
||||||
You can test this out with the cURL program:
|
|
||||||
```sh
|
|
||||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
|
||||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
|
||||||
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
|
||||||
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
|
||||||
[node-version-image]: https://badgen.net/npm/node/accepts
|
|
||||||
[node-version-url]: https://nodejs.org/en/download
|
|
||||||
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
|
||||||
[npm-url]: https://npmjs.org/package/accepts
|
|
||||||
[npm-version-image]: https://badgen.net/npm/v/accepts
|
|
||||||
238
node_modules/accepts/index.js
generated
vendored
238
node_modules/accepts/index.js
generated
vendored
@@ -1,238 +0,0 @@
|
|||||||
/*!
|
|
||||||
* accepts
|
|
||||||
* Copyright(c) 2014 Jonathan Ong
|
|
||||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Negotiator = require('negotiator')
|
|
||||||
var mime = require('mime-types')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = Accepts
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new Accepts object for the given req.
|
|
||||||
*
|
|
||||||
* @param {object} req
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function Accepts (req) {
|
|
||||||
if (!(this instanceof Accepts)) {
|
|
||||||
return new Accepts(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.headers = req.headers
|
|
||||||
this.negotiator = new Negotiator(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given `type(s)` is acceptable, returning
|
|
||||||
* the best match when true, otherwise `undefined`, in which
|
|
||||||
* case you should respond with 406 "Not Acceptable".
|
|
||||||
*
|
|
||||||
* The `type` value may be a single mime type string
|
|
||||||
* such as "application/json", the extension name
|
|
||||||
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
|
||||||
* or array is given the _best_ match, if any is returned.
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
*
|
|
||||||
* // Accept: text/html
|
|
||||||
* this.types('html');
|
|
||||||
* // => "html"
|
|
||||||
*
|
|
||||||
* // Accept: text/*, application/json
|
|
||||||
* this.types('html');
|
|
||||||
* // => "html"
|
|
||||||
* this.types('text/html');
|
|
||||||
* // => "text/html"
|
|
||||||
* this.types('json', 'text');
|
|
||||||
* // => "json"
|
|
||||||
* this.types('application/json');
|
|
||||||
* // => "application/json"
|
|
||||||
*
|
|
||||||
* // Accept: text/*, application/json
|
|
||||||
* this.types('image/png');
|
|
||||||
* this.types('png');
|
|
||||||
* // => undefined
|
|
||||||
*
|
|
||||||
* // Accept: text/*;q=.5, application/json
|
|
||||||
* this.types(['html', 'json']);
|
|
||||||
* this.types('html', 'json');
|
|
||||||
* // => "json"
|
|
||||||
*
|
|
||||||
* @param {String|Array} types...
|
|
||||||
* @return {String|Array|Boolean}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.type =
|
|
||||||
Accepts.prototype.types = function (types_) {
|
|
||||||
var types = types_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (types && !Array.isArray(types)) {
|
|
||||||
types = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < types.length; i++) {
|
|
||||||
types[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no types, return all requested types
|
|
||||||
if (!types || types.length === 0) {
|
|
||||||
return this.negotiator.mediaTypes()
|
|
||||||
}
|
|
||||||
|
|
||||||
// no accept header, return first given type
|
|
||||||
if (!this.headers.accept) {
|
|
||||||
return types[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
var mimes = types.map(extToMime)
|
|
||||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
|
||||||
var first = accepts[0]
|
|
||||||
|
|
||||||
return first
|
|
||||||
? types[mimes.indexOf(first)]
|
|
||||||
: false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return accepted encodings or best fit based on `encodings`.
|
|
||||||
*
|
|
||||||
* Given `Accept-Encoding: gzip, deflate`
|
|
||||||
* an array sorted by quality is returned:
|
|
||||||
*
|
|
||||||
* ['gzip', 'deflate']
|
|
||||||
*
|
|
||||||
* @param {String|Array} encodings...
|
|
||||||
* @return {String|Array}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.encoding =
|
|
||||||
Accepts.prototype.encodings = function (encodings_) {
|
|
||||||
var encodings = encodings_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (encodings && !Array.isArray(encodings)) {
|
|
||||||
encodings = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < encodings.length; i++) {
|
|
||||||
encodings[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no encodings, return all requested encodings
|
|
||||||
if (!encodings || encodings.length === 0) {
|
|
||||||
return this.negotiator.encodings()
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.negotiator.encodings(encodings)[0] || false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return accepted charsets or best fit based on `charsets`.
|
|
||||||
*
|
|
||||||
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
|
||||||
* an array sorted by quality is returned:
|
|
||||||
*
|
|
||||||
* ['utf-8', 'utf-7', 'iso-8859-1']
|
|
||||||
*
|
|
||||||
* @param {String|Array} charsets...
|
|
||||||
* @return {String|Array}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.charset =
|
|
||||||
Accepts.prototype.charsets = function (charsets_) {
|
|
||||||
var charsets = charsets_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (charsets && !Array.isArray(charsets)) {
|
|
||||||
charsets = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < charsets.length; i++) {
|
|
||||||
charsets[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no charsets, return all requested charsets
|
|
||||||
if (!charsets || charsets.length === 0) {
|
|
||||||
return this.negotiator.charsets()
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.negotiator.charsets(charsets)[0] || false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return accepted languages or best fit based on `langs`.
|
|
||||||
*
|
|
||||||
* Given `Accept-Language: en;q=0.8, es, pt`
|
|
||||||
* an array sorted by quality is returned:
|
|
||||||
*
|
|
||||||
* ['es', 'pt', 'en']
|
|
||||||
*
|
|
||||||
* @param {String|Array} langs...
|
|
||||||
* @return {Array|String}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
Accepts.prototype.lang =
|
|
||||||
Accepts.prototype.langs =
|
|
||||||
Accepts.prototype.language =
|
|
||||||
Accepts.prototype.languages = function (languages_) {
|
|
||||||
var languages = languages_
|
|
||||||
|
|
||||||
// support flattened arguments
|
|
||||||
if (languages && !Array.isArray(languages)) {
|
|
||||||
languages = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < languages.length; i++) {
|
|
||||||
languages[i] = arguments[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no languages, return all requested languages
|
|
||||||
if (!languages || languages.length === 0) {
|
|
||||||
return this.negotiator.languages()
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.negotiator.languages(languages)[0] || false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert extnames to mime.
|
|
||||||
*
|
|
||||||
* @param {String} type
|
|
||||||
* @return {String}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function extToMime (type) {
|
|
||||||
return type.indexOf('/') === -1
|
|
||||||
? mime.lookup(type)
|
|
||||||
: type
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if mime is valid.
|
|
||||||
*
|
|
||||||
* @param {String} type
|
|
||||||
* @return {String}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function validMime (type) {
|
|
||||||
return typeof type === 'string'
|
|
||||||
}
|
|
||||||
89
node_modules/accepts/package.json
generated
vendored
89
node_modules/accepts/package.json
generated
vendored
@@ -1,89 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"accepts@1.3.8",
|
|
||||||
"/Users/bitcarrot/github/satshkd-vercel"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "accepts@1.3.8",
|
|
||||||
"_id": "accepts@1.3.8",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
|
||||||
"_location": "/accepts",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "accepts@1.3.8",
|
|
||||||
"name": "accepts",
|
|
||||||
"escapedName": "accepts",
|
|
||||||
"rawSpec": "1.3.8",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.3.8"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/express"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
|
||||||
"_spec": "1.3.8",
|
|
||||||
"_where": "/Users/bitcarrot/github/satshkd-vercel",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jshttp/accepts/issues"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Douglas Christopher Wilson",
|
|
||||||
"email": "doug@somethingdoug.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Jonathan Ong",
|
|
||||||
"email": "me@jongleberry.com",
|
|
||||||
"url": "http://jongleberry.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"mime-types": "~2.1.34",
|
|
||||||
"negotiator": "0.6.3"
|
|
||||||
},
|
|
||||||
"description": "Higher-level content negotiation",
|
|
||||||
"devDependencies": {
|
|
||||||
"deep-equal": "1.0.1",
|
|
||||||
"eslint": "7.32.0",
|
|
||||||
"eslint-config-standard": "14.1.1",
|
|
||||||
"eslint-plugin-import": "2.25.4",
|
|
||||||
"eslint-plugin-markdown": "2.2.1",
|
|
||||||
"eslint-plugin-node": "11.1.0",
|
|
||||||
"eslint-plugin-promise": "4.3.1",
|
|
||||||
"eslint-plugin-standard": "4.1.0",
|
|
||||||
"mocha": "9.2.0",
|
|
||||||
"nyc": "15.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"LICENSE",
|
|
||||||
"HISTORY.md",
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/jshttp/accepts#readme",
|
|
||||||
"keywords": [
|
|
||||||
"content",
|
|
||||||
"negotiation",
|
|
||||||
"accept",
|
|
||||||
"accepts"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"name": "accepts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jshttp/accepts.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"lint": "eslint .",
|
|
||||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
|
||||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
|
||||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
|
||||||
},
|
|
||||||
"version": "1.3.8"
|
|
||||||
}
|
|
||||||
21
node_modules/array-flatten/LICENSE
generated
vendored
21
node_modules/array-flatten/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
|
||||||
|
|
||||||
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.
|
|
||||||
43
node_modules/array-flatten/README.md
generated
vendored
43
node_modules/array-flatten/README.md
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
# Array Flatten
|
|
||||||
|
|
||||||
[![NPM version][npm-image]][npm-url]
|
|
||||||
[![NPM downloads][downloads-image]][downloads-url]
|
|
||||||
[![Build status][travis-image]][travis-url]
|
|
||||||
[![Test coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install array-flatten --save
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var flatten = require('array-flatten')
|
|
||||||
|
|
||||||
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
|
|
||||||
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
||||||
|
|
||||||
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
|
|
||||||
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
flatten(arguments) //=> [1, 2, 3]
|
|
||||||
})(1, [2, 3])
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT
|
|
||||||
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
|
|
||||||
[npm-url]: https://npmjs.org/package/array-flatten
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
|
|
||||||
[downloads-url]: https://npmjs.org/package/array-flatten
|
|
||||||
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
|
|
||||||
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
|
|
||||||
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
|
|
||||||
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
|
|
||||||
64
node_modules/array-flatten/array-flatten.js
generated
vendored
64
node_modules/array-flatten/array-flatten.js
generated
vendored
@@ -1,64 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose `arrayFlatten`.
|
|
||||||
*/
|
|
||||||
module.exports = arrayFlatten
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursive flatten function with depth.
|
|
||||||
*
|
|
||||||
* @param {Array} array
|
|
||||||
* @param {Array} result
|
|
||||||
* @param {Number} depth
|
|
||||||
* @return {Array}
|
|
||||||
*/
|
|
||||||
function flattenWithDepth (array, result, depth) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
var value = array[i]
|
|
||||||
|
|
||||||
if (depth > 0 && Array.isArray(value)) {
|
|
||||||
flattenWithDepth(value, result, depth - 1)
|
|
||||||
} else {
|
|
||||||
result.push(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursive flatten function. Omitting depth is slightly faster.
|
|
||||||
*
|
|
||||||
* @param {Array} array
|
|
||||||
* @param {Array} result
|
|
||||||
* @return {Array}
|
|
||||||
*/
|
|
||||||
function flattenForever (array, result) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
var value = array[i]
|
|
||||||
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
flattenForever(value, result)
|
|
||||||
} else {
|
|
||||||
result.push(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flatten an array, with the ability to define a depth.
|
|
||||||
*
|
|
||||||
* @param {Array} array
|
|
||||||
* @param {Number} depth
|
|
||||||
* @return {Array}
|
|
||||||
*/
|
|
||||||
function arrayFlatten (array, depth) {
|
|
||||||
if (depth == null) {
|
|
||||||
return flattenForever(array, [])
|
|
||||||
}
|
|
||||||
|
|
||||||
return flattenWithDepth(array, [], depth)
|
|
||||||
}
|
|
||||||
67
node_modules/array-flatten/package.json
generated
vendored
67
node_modules/array-flatten/package.json
generated
vendored
@@ -1,67 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"array-flatten@1.1.1",
|
|
||||||
"/Users/bitcarrot/github/satshkd-vercel"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "array-flatten@1.1.1",
|
|
||||||
"_id": "array-flatten@1.1.1",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
|
|
||||||
"_location": "/array-flatten",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "array-flatten@1.1.1",
|
|
||||||
"name": "array-flatten",
|
|
||||||
"escapedName": "array-flatten",
|
|
||||||
"rawSpec": "1.1.1",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.1.1"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/express"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
|
||||||
"_spec": "1.1.1",
|
|
||||||
"_where": "/Users/bitcarrot/github/satshkd-vercel",
|
|
||||||
"author": {
|
|
||||||
"name": "Blake Embrey",
|
|
||||||
"email": "hello@blakeembrey.com",
|
|
||||||
"url": "http://blakeembrey.me"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/blakeembrey/array-flatten/issues"
|
|
||||||
},
|
|
||||||
"description": "Flatten an array of nested arrays into a single flat array",
|
|
||||||
"devDependencies": {
|
|
||||||
"istanbul": "^0.3.13",
|
|
||||||
"mocha": "^2.2.4",
|
|
||||||
"pre-commit": "^1.0.7",
|
|
||||||
"standard": "^3.7.3"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"array-flatten.js",
|
|
||||||
"LICENSE"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/blakeembrey/array-flatten",
|
|
||||||
"keywords": [
|
|
||||||
"array",
|
|
||||||
"flatten",
|
|
||||||
"arguments",
|
|
||||||
"depth"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "array-flatten.js",
|
|
||||||
"name": "array-flatten",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/blakeembrey/array-flatten.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "istanbul cover _mocha -- -R spec"
|
|
||||||
},
|
|
||||||
"version": "1.1.1"
|
|
||||||
}
|
|
||||||
906
node_modules/axios/CHANGELOG.md
generated
vendored
906
node_modules/axios/CHANGELOG.md
generated
vendored
@@ -1,906 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
### 0.26.1 (March 9, 2022)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
- Refactored project file structure to avoid circular imports ([##4220](https://github.com/axios/axios/pull/#4220))
|
|
||||||
|
|
||||||
### 0.26.0 (February 13, 2022)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
- Fixed The timeoutErrorMessage property in config not work with Node.js ([#3581](https://github.com/axios/axios/pull/3581))
|
|
||||||
- Added errors to be displayed when the query parsing process itself fails ([#3961](https://github.com/axios/axios/pull/3961))
|
|
||||||
- Fix/remove url required ([#4426](https://github.com/axios/axios/pull/4426))
|
|
||||||
- Update follow-redirects dependency due to Vurnerbility ([#4462](https://github.com/axios/axios/pull/4462))
|
|
||||||
- Bump karma from 6.3.11 to 6.3.14 ([#4461](https://github.com/axios/axios/pull/4461))
|
|
||||||
- Bump follow-redirects from 1.14.7 to 1.14.8 ([#4473](https://github.com/axios/axios/pull/4473))
|
|
||||||
|
|
||||||
### 0.25.0 (January 18, 2022)
|
|
||||||
|
|
||||||
Breaking changes:
|
|
||||||
- Fixing maxBodyLength enforcement ([#3786](https://github.com/axios/axios/pull/3786))
|
|
||||||
- Don't rely on strict mode behaviour for arguments ([#3470](https://github.com/axios/axios/pull/3470))
|
|
||||||
- Adding error handling when missing url ([#3791](https://github.com/axios/axios/pull/3791))
|
|
||||||
- Update isAbsoluteURL.js removing escaping of non-special characters ([#3809](https://github.com/axios/axios/pull/3809))
|
|
||||||
- Use native Array.isArray() in utils.js ([#3836](https://github.com/axios/axios/pull/3836))
|
|
||||||
- Adding error handling inside stream end callback ([#3967](https://github.com/axios/axios/pull/3967))
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
- Added aborted even handler ([#3916](https://github.com/axios/axios/pull/3916))
|
|
||||||
- Header types expanded allowing `boolean` and `number` types ([#4144](https://github.com/axios/axios/pull/4144))
|
|
||||||
- Fix cancel signature allowing cancel message to be `undefined` ([#3153](https://github.com/axios/axios/pull/3153))
|
|
||||||
- Updated type checks to be formulated better ([#3342](https://github.com/axios/axios/pull/3342))
|
|
||||||
- Avoid unnecessary buffer allocations ([#3321](https://github.com/axios/axios/pull/3321))
|
|
||||||
- Adding a socket handler to keep TCP connection live when processing long living requests ([#3422](https://github.com/axios/axios/pull/3422))
|
|
||||||
- Added toFormData helper function ([#3757](https://github.com/axios/axios/pull/3757))
|
|
||||||
- Adding responseEncoding prop type in AxiosRequestConfig ([#3918](https://github.com/axios/axios/pull/3918))
|
|
||||||
|
|
||||||
Internal and Tests:
|
|
||||||
- Adding axios-test-instance to ecosystem ([#3786](https://github.com/axios/axios/pull/3786))
|
|
||||||
- Optimize the logic of isAxiosError ([#3546](https://github.com/axios/axios/pull/3546))
|
|
||||||
- Add tests and documentation to display how multiple inceptors work ([#3564](https://github.com/axios/axios/pull/3564))
|
|
||||||
- Updating follow-redirects to version 1.14.7 ([#4379](https://github.com/axios/axios/pull/4379))
|
|
||||||
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
- Fixing changelog to show corrext pull request ([#4219](https://github.com/axios/axios/pull/4219))
|
|
||||||
- Update upgrade guide for https proxy setting ([#3604](https://github.com/axios/axios/pull/3604))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- [Jay](mailto:jasonsaayman@gmail.com)
|
|
||||||
- [Rijk van Zanten](https://github.com/rijkvanzanten)
|
|
||||||
- [Kohta Ito](https://github.com/koh110)
|
|
||||||
- [Brandon Faulkner](https://github.com/bfaulk96)
|
|
||||||
- [Stefano Magni](https://github.com/NoriSte)
|
|
||||||
- [enofan](https://github.com/fanguangyi)
|
|
||||||
- [Andrey Pechkurov](https://github.com/puzpuzpuz)
|
|
||||||
- [Doowonee](https://github.com/doowonee)
|
|
||||||
- [Emil Broman](https://github.com/emilbroman-eqt)
|
|
||||||
- [Remco Haszing](https://github.com/remcohaszing)
|
|
||||||
- [Black-Hole](https://github.com/BlackHole1)
|
|
||||||
- [Wolfram Kriesing](https://github.com/wolframkriesing)
|
|
||||||
- [Andrew Ovens](https://github.com/repl-andrew-ovens)
|
|
||||||
- [Paulo Renato](https://github.com/PauloRSF)
|
|
||||||
- [Ben Carp](https://github.com/carpben)
|
|
||||||
- [Hirotaka Tagawa](https://github.com/wafuwafu13)
|
|
||||||
- [狼族小狈](https://github.com/lzxb)
|
|
||||||
- [C. Lewis](https://github.com/ctjlewis)
|
|
||||||
- [Felipe Carvalho](https://github.com/FCarvalhoVII)
|
|
||||||
- [Daniel](https://github.com/djs113)
|
|
||||||
- [Gustavo Sales](https://github.com/gussalesdev)
|
|
||||||
|
|
||||||
### 0.24.0 (October 25, 2021)
|
|
||||||
|
|
||||||
Breaking changes:
|
|
||||||
- Revert: change type of AxiosResponse to any, please read lengthy discussion here: ([#4141](https://github.com/axios/axios/issues/4141)) pull request: ([#4186](https://github.com/axios/axios/pull/4186))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- [Jay](mailto:jasonsaayman@gmail.com)
|
|
||||||
- [Rodry](https://github.com/ImRodry)
|
|
||||||
- [Remco Haszing](https://github.com/remcohaszing)
|
|
||||||
- [Isaiah Thomason](https://github.com/ITenthusiasm)
|
|
||||||
|
|
||||||
### 0.23.0 (October 12, 2021)
|
|
||||||
|
|
||||||
Breaking changes:
|
|
||||||
- Distinguish request and response data types ([#4116](https://github.com/axios/axios/pull/4116))
|
|
||||||
- Change never type to unknown ([#4142](https://github.com/axios/axios/pull/4142))
|
|
||||||
- Fixed TransitionalOptions typings ([#4147](https://github.com/axios/axios/pull/4147))
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
- Adding globalObject: 'this' to webpack config ([#3176](https://github.com/axios/axios/pull/3176))
|
|
||||||
- Adding insecureHTTPParser type to AxiosRequestConfig ([#4066](https://github.com/axios/axios/pull/4066))
|
|
||||||
- Fix missing semicolon in typings ([#4115](https://github.com/axios/axios/pull/4115))
|
|
||||||
- Fix response headers types ([#4136](https://github.com/axios/axios/pull/4136))
|
|
||||||
|
|
||||||
Internal and Tests:
|
|
||||||
- Improve timeout error when timeout is browser default ([#3209](https://github.com/axios/axios/pull/3209))
|
|
||||||
- Fix node version on CI ([#4069](https://github.com/axios/axios/pull/4069))
|
|
||||||
- Added testing to TypeScript portion of project ([#4140](https://github.com/axios/axios/pull/4140))
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
- Rename Angular to AngularJS ([#4114](https://github.com/axios/axios/pull/4114))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- [Jay](mailto:jasonsaayman@gmail.com)
|
|
||||||
- [Evan-Finkelstein](https://github.com/Evan-Finkelstein)
|
|
||||||
- [Paweł Szymański](https://github.com/Jezorko)
|
|
||||||
- [Dobes Vandermeer](https://github.com/dobesv)
|
|
||||||
- [Claas Augner](https://github.com/caugner)
|
|
||||||
- [Remco Haszing](https://github.com/remcohaszing)
|
|
||||||
- [Evgeniy](https://github.com/egmen)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
|
|
||||||
### 0.22.0 (October 01, 2021)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
- Caseless header comparing in HTTP adapter ([#2880](https://github.com/axios/axios/pull/2880))
|
|
||||||
- Avoid package.json import fixing issues and warnings related to this ([#4041](https://github.com/axios/axios/pull/4041)), ([#4065](https://github.com/axios/axios/pull/4065))
|
|
||||||
- Fixed cancelToken leakage and added AbortController support ([#3305](https://github.com/axios/axios/pull/3305))
|
|
||||||
- Updating CI to run on release branches
|
|
||||||
- Bump follow redirects version
|
|
||||||
- Fixed default transitional config for custom Axios instance; ([#4052](https://github.com/axios/axios/pull/4052))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- [Jay](mailto:jasonsaayman@gmail.com)
|
|
||||||
- [Matt R. Wilson](https://github.com/mastermatt)
|
|
||||||
- [Xianming Zhong](https://github.com/chinesedfan)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
|
|
||||||
### 0.21.4 (September 6, 2021)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
- Fixing JSON transform when data is stringified. Providing backward compatability and complying to the JSON RFC standard ([#4020](https://github.com/axios/axios/pull/4020))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- [Jay](mailto:jasonsaayman@gmail.com)
|
|
||||||
- [Guillaume Fortaine](https://github.com/gfortaine)
|
|
||||||
- [Yusuke Kawasaki](https://github.com/kawanet)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
|
|
||||||
### 0.21.3 (September 4, 2021)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
- Fixing response interceptor not being called when request interceptor is attached ([#4013](https://github.com/axios/axios/pull/4013))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- [Jay](mailto:jasonsaayman@gmail.com)
|
|
||||||
- [Julian Hollmann](https://github.com/nerdbeere)
|
|
||||||
|
|
||||||
### 0.21.2 (September 4, 2021)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
|
|
||||||
- Updating axios requests to be delayed by pre-emptive promise creation ([#2702](https://github.com/axios/axios/pull/2702))
|
|
||||||
- Adding "synchronous" and "runWhen" options to interceptors api ([#2702](https://github.com/axios/axios/pull/2702))
|
|
||||||
- Updating of transformResponse ([#3377](https://github.com/axios/axios/pull/3377))
|
|
||||||
- Adding ability to omit User-Agent header ([#3703](https://github.com/axios/axios/pull/3703))
|
|
||||||
- Adding multiple JSON improvements ([#3688](https://github.com/axios/axios/pull/3688), [#3763](https://github.com/axios/axios/pull/3763))
|
|
||||||
- Fixing quadratic runtime and extra memory usage when setting a maxContentLength ([#3738](https://github.com/axios/axios/pull/3738))
|
|
||||||
- Adding parseInt to config.timeout ([#3781](https://github.com/axios/axios/pull/3781))
|
|
||||||
- Adding custom return type support to interceptor ([#3783](https://github.com/axios/axios/pull/3783))
|
|
||||||
- Adding security fix for ReDoS vulnerability ([#3980](https://github.com/axios/axios/pull/3980))
|
|
||||||
|
|
||||||
Internal and Tests:
|
|
||||||
|
|
||||||
- Updating build dev dependancies ([#3401](https://github.com/axios/axios/pull/3401))
|
|
||||||
- Fixing builds running on Travis CI ([#3538](https://github.com/axios/axios/pull/3538))
|
|
||||||
- Updating follow rediect version ([#3694](https://github.com/axios/axios/pull/3694), [#3771](https://github.com/axios/axios/pull/3771))
|
|
||||||
- Updating karma sauce launcher to fix failing sauce tests ([#3712](https://github.com/axios/axios/pull/3712), [#3717](https://github.com/axios/axios/pull/3717))
|
|
||||||
- Updating content-type header for application/json to not contain charset field, according do RFC 8259 ([#2154](https://github.com/axios/axios/pull/2154))
|
|
||||||
- Fixing tests by bumping karma-sauce-launcher version ([#3813](https://github.com/axios/axios/pull/3813))
|
|
||||||
- Changing testing process from Travis CI to GitHub Actions ([#3938](https://github.com/axios/axios/pull/3938))
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
|
|
||||||
- Updating documentation around the use of `AUTH_TOKEN` with multiple domain endpoints ([#3539](https://github.com/axios/axios/pull/3539))
|
|
||||||
- Remove duplication of item in changelog ([#3523](https://github.com/axios/axios/pull/3523))
|
|
||||||
- Fixing gramatical errors ([#2642](https://github.com/axios/axios/pull/2642))
|
|
||||||
- Fixing spelling error ([#3567](https://github.com/axios/axios/pull/3567))
|
|
||||||
- Moving gitpod metion ([#2637](https://github.com/axios/axios/pull/2637))
|
|
||||||
- Adding new axios documentation website link ([#3681](https://github.com/axios/axios/pull/3681), [#3707](https://github.com/axios/axios/pull/3707))
|
|
||||||
- Updating documentation around dispatching requests ([#3772](https://github.com/axios/axios/pull/3772))
|
|
||||||
- Adding documentation for the type guard isAxiosError ([#3767](https://github.com/axios/axios/pull/3767))
|
|
||||||
- Adding explanation of cancel token ([#3803](https://github.com/axios/axios/pull/3803))
|
|
||||||
- Updating CI status badge ([#3953](https://github.com/axios/axios/pull/3953))
|
|
||||||
- Fixing errors with JSON documentation ([#3936](https://github.com/axios/axios/pull/3936))
|
|
||||||
- Fixing README typo under Request Config ([#3825](https://github.com/axios/axios/pull/3825))
|
|
||||||
- Adding axios-multi-api to the ecosystem file ([#3817](https://github.com/axios/axios/pull/3817))
|
|
||||||
- Adding SECURITY.md to properly disclose security vulnerabilities ([#3981](https://github.com/axios/axios/pull/3981))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- [Jay](mailto:jasonsaayman@gmail.com)
|
|
||||||
- [Sasha Korotkov](https://github.com/SashaKoro)
|
|
||||||
- [Daniel Lopretto](https://github.com/timemachine3030)
|
|
||||||
- [Mike Bishop](https://github.com/MikeBishop)
|
|
||||||
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
|
||||||
- [Mark](https://github.com/bimbiltu)
|
|
||||||
- [Philipe Gouveia Paixão](https://github.com/piiih)
|
|
||||||
- [hippo](https://github.com/hippo2cat)
|
|
||||||
- [ready-research](https://github.com/ready-research)
|
|
||||||
- [Xianming Zhong](https://github.com/chinesedfan)
|
|
||||||
- [Christopher Chrapka](https://github.com/OJezu)
|
|
||||||
- [Brian Anglin](https://github.com/anglinb)
|
|
||||||
- [Kohta Ito](https://github.com/koh110)
|
|
||||||
- [Ali Clark](https://github.com/aliclark)
|
|
||||||
- [caikan](https://github.com/caikan)
|
|
||||||
- [Elina Gorshkova](https://github.com/elinagorshkova)
|
|
||||||
- [Ryota Ikezawa](https://github.com/paveg)
|
|
||||||
- [Nisar Hassan Naqvi](https://github.com/nisarhassan12)
|
|
||||||
- [Jake](https://github.com/codemaster138)
|
|
||||||
- [TagawaHirotaka](https://github.com/wafuwafu13)
|
|
||||||
- [Johannes Jarbratt](https://github.com/johachi)
|
|
||||||
- [Mo Sattler](https://github.com/MoSattler)
|
|
||||||
- [Sam Carlton](https://github.com/ThatGuySam)
|
|
||||||
- [Matt Czapliński](https://github.com/MattCCC)
|
|
||||||
- [Ziding Zhang](https://github.com/zidingz)
|
|
||||||
|
|
||||||
### 0.21.1 (December 21, 2020)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
|
|
||||||
- Hotfix: Prevent SSRF ([#3410](https://github.com/axios/axios/pull/3410))
|
|
||||||
- Protocol not parsed when setting proxy config from env vars ([#3070](https://github.com/axios/axios/pull/3070))
|
|
||||||
- Updating axios in types to be lower case ([#2797](https://github.com/axios/axios/pull/2797))
|
|
||||||
- Adding a type guard for `AxiosError` ([#2949](https://github.com/axios/axios/pull/2949))
|
|
||||||
|
|
||||||
Internal and Tests:
|
|
||||||
|
|
||||||
- Remove the skipping of the `socket` http test ([#3364](https://github.com/axios/axios/pull/3364))
|
|
||||||
- Use different socket for Win32 test ([#3375](https://github.com/axios/axios/pull/3375))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- Daniel Lopretto <timemachine3030@users.noreply.github.com>
|
|
||||||
- Jason Kwok <JasonHK@users.noreply.github.com>
|
|
||||||
- Jay <jasonsaayman@gmail.com>
|
|
||||||
- Jonathan Foster <jonathan@jonathanfoster.io>
|
|
||||||
- Remco Haszing <remcohaszing@gmail.com>
|
|
||||||
- Xianming Zhong <chinesedfan@qq.com>
|
|
||||||
|
|
||||||
### 0.21.0 (October 23, 2020)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
|
|
||||||
- Fixing requestHeaders.Authorization ([#3287](https://github.com/axios/axios/pull/3287))
|
|
||||||
- Fixing node types ([#3237](https://github.com/axios/axios/pull/3237))
|
|
||||||
- Fixing axios.delete ignores config.data ([#3282](https://github.com/axios/axios/pull/3282))
|
|
||||||
- Revert "Fixing overwrite Blob/File type as Content-Type in browser. (#1773)" ([#3289](https://github.com/axios/axios/pull/3289))
|
|
||||||
- Fixing an issue that type 'null' and 'undefined' is not assignable to validateStatus when typescript strict option is enabled ([#3200](https://github.com/axios/axios/pull/3200))
|
|
||||||
|
|
||||||
Internal and Tests:
|
|
||||||
|
|
||||||
- Lock travis to not use node v15 ([#3361](https://github.com/axios/axios/pull/3361))
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
|
|
||||||
- Fixing simple typo, existant -> existent ([#3252](https://github.com/axios/axios/pull/3252))
|
|
||||||
- Fixing typos ([#3309](https://github.com/axios/axios/pull/3309))
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- Allan Cruz <57270969+Allanbcruz@users.noreply.github.com>
|
|
||||||
- George Cheng <Gerhut@GMail.com>
|
|
||||||
- Jay <jasonsaayman@gmail.com>
|
|
||||||
- Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com>
|
|
||||||
- Remco Haszing <remcohaszing@gmail.com>
|
|
||||||
- Taemin Shin <cprayer13@gmail.com>
|
|
||||||
- Tim Gates <tim.gates@iress.com>
|
|
||||||
- Xianming Zhong <chinesedfan@qq.com>
|
|
||||||
|
|
||||||
### 0.20.0 (August 20, 2020)
|
|
||||||
|
|
||||||
Release of 0.20.0-pre as a full release with no other changes.
|
|
||||||
|
|
||||||
### 0.20.0-pre (July 15, 2020)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
|
|
||||||
- Fixing response with utf-8 BOM can not parse to json ([#2419](https://github.com/axios/axios/pull/2419))
|
|
||||||
- fix: remove byte order marker (UTF-8 BOM) when transform response
|
|
||||||
- fix: remove BOM only utf-8
|
|
||||||
- test: utf-8 BOM
|
|
||||||
- fix: incorrect param name
|
|
||||||
- Refactor mergeConfig without utils.deepMerge ([#2844](https://github.com/axios/axios/pull/2844))
|
|
||||||
- Adding failing test
|
|
||||||
- Fixing #2587 default custom config persisting
|
|
||||||
- Adding Concat keys and filter duplicates
|
|
||||||
- Fixed value from CPE
|
|
||||||
- update for review feedbacks
|
|
||||||
- no deepMerge
|
|
||||||
- only merge between plain objects
|
|
||||||
- fix rename
|
|
||||||
- always merge config by mergeConfig
|
|
||||||
- extract function mergeDeepProperties
|
|
||||||
- refactor mergeConfig with all keys, and add special logic for validateStatus
|
|
||||||
- add test for resetting headers
|
|
||||||
- add lots of tests and fix a bug
|
|
||||||
- should not inherit `data`
|
|
||||||
- use simple toString
|
|
||||||
- Fixing overwrite Blob/File type as Content-Type in browser. ([#1773](https://github.com/axios/axios/pull/1773))
|
|
||||||
- Fixing an issue that type 'null' is not assignable to validateStatus ([#2773](https://github.com/axios/axios/pull/2773))
|
|
||||||
- Fixing special char encoding ([#1671](https://github.com/axios/axios/pull/1671))
|
|
||||||
- removing @ character from replacement list since it is a reserved character
|
|
||||||
- Updating buildURL test to not include the @ character
|
|
||||||
- Removing console logs
|
|
||||||
- Fixing password encoding with special characters in basic authentication ([#1492](https://github.com/axios/axios/pull/1492))
|
|
||||||
- Fixing password encoding with special characters in basic authentication
|
|
||||||
- Adding test to check if password with non-Latin1 characters pass
|
|
||||||
- Fixing 'Network Error' in react native android ([#1487](https://github.com/axios/axios/pull/1487))
|
|
||||||
There is a bug in react native Android platform when using get method. It will trigger a 'Network Error' when passing the requestData which is an empty string to request.send function. So if the requestData is an empty string we can set it to null as well to fix the bug.
|
|
||||||
- Fixing Cookie Helper with Async Components ([#1105](https://github.com/axios/axios/pull/1105)) ([#1107](https://github.com/axios/axios/pull/1107))
|
|
||||||
- Fixing 'progressEvent' type ([#2851](https://github.com/axios/axios/pull/2851))
|
|
||||||
- Fix 'progressEvent' type
|
|
||||||
- Update axios.ts
|
|
||||||
- Fixing getting local files (file://) failed ([#2470](https://github.com/axios/axios/pull/2470))
|
|
||||||
- fix issue #2416, #2396
|
|
||||||
- fix Eslint warn
|
|
||||||
- Modify judgment conditions
|
|
||||||
- add unit test
|
|
||||||
- update unit test
|
|
||||||
- update unit test
|
|
||||||
- Allow PURGE method in typings ([#2191](https://github.com/axios/axios/pull/2191))
|
|
||||||
- Adding option to disable automatic decompression ([#2661](https://github.com/axios/axios/pull/2661))
|
|
||||||
- Adding ability to disable auto decompression
|
|
||||||
- Updating decompress documentation in README
|
|
||||||
- Fixing test\unit\adapters\http.js lint errors
|
|
||||||
- Adding test for disabling auto decompression
|
|
||||||
- Removing changes that fixed lint errors in tests
|
|
||||||
- Removing formatting change to unit test
|
|
||||||
- Add independent `maxBodyLength` option ([#2781](https://github.com/axios/axios/pull/2781))
|
|
||||||
- Add independent option to set the maximum size of the request body
|
|
||||||
- Remove maxBodyLength check
|
|
||||||
- Update README
|
|
||||||
- Assert for error code and message
|
|
||||||
- Adding responseEncoding to mergeConfig ([#1745](https://github.com/axios/axios/pull/1745))
|
|
||||||
- Compatible with follow-redirect aborts the request ([#2689](https://github.com/axios/axios/pull/2689))
|
|
||||||
- Compatible with follow-redirect aborts the request
|
|
||||||
- Use the error code
|
|
||||||
- Fix merging of params ([#2656](https://github.com/axios/axios/pull/2656))
|
|
||||||
- Name function to avoid ESLint func-names warning
|
|
||||||
- Switch params config to merge list and update tests
|
|
||||||
- Restore testing of both false and null
|
|
||||||
- Restore test cases for keys without defaults
|
|
||||||
- Include test for non-object values that aren't false-y.
|
|
||||||
- Revert `finally` as `then` ([#2683](https://github.com/axios/axios/pull/2683))
|
|
||||||
|
|
||||||
Internal and Tests:
|
|
||||||
|
|
||||||
- Fix stale bot config ([#3049](https://github.com/axios/axios/pull/3049))
|
|
||||||
- fix stale bot config
|
|
||||||
- fix multiple lines
|
|
||||||
- Add days and change name to work ([#3035](https://github.com/axios/axios/pull/3035))
|
|
||||||
- Update close-issues.yml ([#3031](https://github.com/axios/axios/pull/3031))
|
|
||||||
- Update close-issues.yml
|
|
||||||
Update close message to read better 😄
|
|
||||||
- Fix use of quotations
|
|
||||||
Use single quotes as per other .yml files
|
|
||||||
- Remove user name form message
|
|
||||||
- Add GitHub actions to close stale issues/prs ([#3029](https://github.com/axios/axios/pull/3029))
|
|
||||||
- prepare stale actions
|
|
||||||
- update messages
|
|
||||||
- Add exempt labels and lighten up comments
|
|
||||||
- Add GitHub actions to close invalid issues ([#3022](https://github.com/axios/axios/pull/3022))
|
|
||||||
- add close actions
|
|
||||||
- fix with checkout
|
|
||||||
- update issue templates
|
|
||||||
- add reminder
|
|
||||||
- update close message
|
|
||||||
- Add test with Node.js 12 ([#2860](https://github.com/axios/axios/pull/2860))
|
|
||||||
- test with Node.js 12
|
|
||||||
- test with latest
|
|
||||||
- Adding console log on sandbox server startup ([#2210](https://github.com/axios/axios/pull/2210))
|
|
||||||
- Adding console log on sandbox server startup
|
|
||||||
- Update server.js
|
|
||||||
Add server error handling
|
|
||||||
- Update server.js
|
|
||||||
Better error message, remove retry.
|
|
||||||
- Adding tests for method `options` type definitions ([#1996](https://github.com/axios/axios/pull/1996))
|
|
||||||
Update tests.
|
|
||||||
- Add test for redirecting with too large response ([#2695](https://github.com/axios/axios/pull/2695))
|
|
||||||
- Fixing unit test failure in Windows OS ([#2601](https://github.com/axios/axios/pull/2601))
|
|
||||||
- Fixing issue for HEAD method and gzipped response ([#2666](https://github.com/axios/axios/pull/2666))
|
|
||||||
- Fix tests in browsers ([#2748](https://github.com/axios/axios/pull/2748))
|
|
||||||
- chore: add `jsdelivr` and `unpkg` support ([#2443](https://github.com/axios/axios/pull/2443))
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
|
|
||||||
- Adding support for URLSearchParams in node ([#1900](https://github.com/axios/axios/pull/1900))
|
|
||||||
- Adding support for URLSearchParams in node
|
|
||||||
- Remove un-needed code
|
|
||||||
- Update utils.js
|
|
||||||
- Make changes as suggested
|
|
||||||
- Adding table of content (preview) ([#3050](https://github.com/axios/axios/pull/3050))
|
|
||||||
- add toc (preview)
|
|
||||||
- remove toc in toc
|
|
||||||
Signed-off-by: Moni <usmoni@gmail.com>
|
|
||||||
- fix sublinks
|
|
||||||
- fix indentation
|
|
||||||
- remove redundant table links
|
|
||||||
- update caps and indent
|
|
||||||
- remove axios
|
|
||||||
- Replace 'blacklist' with 'blocklist' ([#3006](https://github.com/axios/axios/pull/3006))
|
|
||||||
- docs(): Detailed config options environment. ([#2088](https://github.com/axios/axios/pull/2088))
|
|
||||||
- docs(): Detailed config options environment.
|
|
||||||
- Update README.md
|
|
||||||
- Include axios-data-unpacker in ECOSYSTEM.md ([#2080](https://github.com/axios/axios/pull/2080))
|
|
||||||
- Allow opening examples in Gitpod ([#1958](https://github.com/axios/axios/pull/1958))
|
|
||||||
- Remove axios.all() and axios.spread() from Readme.md ([#2727](https://github.com/axios/axios/pull/2727))
|
|
||||||
- remove axios.all(), axios.spread()
|
|
||||||
- replace example
|
|
||||||
- axios.all() -> Promise.all()
|
|
||||||
- axios.spread(function (acct, perms)) -> function (acct, perms)
|
|
||||||
- add deprecated mark
|
|
||||||
- Update README.md ([#2887](https://github.com/axios/axios/pull/2887))
|
|
||||||
Small change to the data attribute doc of the config. A request body can also be set for DELETE methods but this wasn't mentioned in the documentation (it only mentioned POST, PUT and PATCH). Took my some 10-20 minutes until I realized that I don't need to manipulate the request body with transformRequest in the case of DELETE.
|
|
||||||
- Include swagger-taxos-codegen in ECOSYSTEM.md ([#2162](https://github.com/axios/axios/pull/2162))
|
|
||||||
- Add CDNJS version badge in README.md ([#878](https://github.com/axios/axios/pull/878))
|
|
||||||
This badge will show the version on CDNJS!
|
|
||||||
- Documentation update to clear up ambiguity in code examples ([#2928](https://github.com/axios/axios/pull/2928))
|
|
||||||
- Made an adjustment to the documentation to clear up any ambiguity around the use of "fs". This should help clear up that the code examples with "fs" cannot be used on the client side.
|
|
||||||
- Update README.md about validateStatus ([#2912](https://github.com/axios/axios/pull/2912))
|
|
||||||
Rewrote the comment from "Reject only if the status code is greater than or equal to 500" to "Resolve only if the status code is less than 500"
|
|
||||||
- Updating documentation for usage form-data ([#2805](https://github.com/axios/axios/pull/2805))
|
|
||||||
Closes #2049
|
|
||||||
- Fixing CHANGELOG.md issue link ([#2784](https://github.com/axios/axios/pull/2784))
|
|
||||||
- Include axios-hooks in ECOSYSTEM.md ([#2003](https://github.com/axios/axios/pull/2003))
|
|
||||||
- Added Response header access instructions ([#1901](https://github.com/axios/axios/pull/1901))
|
|
||||||
- Added Response header access instructions
|
|
||||||
- Added note about using bracket notation
|
|
||||||
- Add `onUploadProgress` and `onDownloadProgress` are browser only ([#2763](https://github.com/axios/axios/pull/2763))
|
|
||||||
Saw in #928 and #1966 that `onUploadProgress` and `onDownloadProgress` only work in the browser and was missing that from the README.
|
|
||||||
- Update ' sign to ` in proxy spec ([#2778](https://github.com/axios/axios/pull/2778))
|
|
||||||
- Adding jsDelivr link in README ([#1110](https://github.com/axios/axios/pull/1110))
|
|
||||||
- Adding jsDelivr link
|
|
||||||
- Add SRI
|
|
||||||
- Remove SRI
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed
|
|
||||||
below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- Alan Wang <wp_scut@163.com>
|
|
||||||
- Alexandru Ungureanu <khakcarot@gmail.com>
|
|
||||||
- Anubhav Srivastava <anubhav.srivastava00@gmail.com>
|
|
||||||
- Benny Neugebauer <bn@bennyn.de>
|
|
||||||
- Cr <631807682@qq.com>
|
|
||||||
- David <cygnidavid@gmail.com>
|
|
||||||
- David Ko <david.ko@pvtmethod.com>
|
|
||||||
- David Tanner <david.tanner@lifeomic.com>
|
|
||||||
- Emily Morehouse <emilyemorehouse@gmail.com>
|
|
||||||
- Felipe Martins <felipewmartins@gmail.com>
|
|
||||||
- Fonger <5862369+Fonger@users.noreply.github.com>
|
|
||||||
- Frostack <soulburn007@gmail.com>
|
|
||||||
- George Cheng <Gerhut@GMail.com>
|
|
||||||
- grumblerchester <grumblerchester@users.noreply.github.com>
|
|
||||||
- Gustavo López <gualopezb@gmail.com>
|
|
||||||
- hexaez <45806662+hexaez@users.noreply.github.com>
|
|
||||||
- huangzuizui <huangzuizui@gmail.com>
|
|
||||||
- Ian Wijma <ian@wij.ma>
|
|
||||||
- Jay <jasonsaayman@gmail.com>
|
|
||||||
- jeffjing <zgayjjf@qq.com>
|
|
||||||
- jennynju <46782518+jennynju@users.noreply.github.com>
|
|
||||||
- Jimmy Liao <52391190+jimmy-liao-gogoro@users.noreply.github.com>
|
|
||||||
- Jonathan Sharpe <j.r.sharpe@gmail.com>
|
|
||||||
- JounQin <admin@1stg.me>
|
|
||||||
- Justin Beckwith <justin.beckwith@gmail.com>
|
|
||||||
- Kamil Posiadała <3dcreator.pl@gmail.com>
|
|
||||||
- Lukas Drgon <lukas.drgon@gmail.com>
|
|
||||||
- marcinx <mail@marcinx.com>
|
|
||||||
- Martti Laine <martti@codeclown.net>
|
|
||||||
- Michał Zarach <michal.m.zarach@gmail.com>
|
|
||||||
- Moni <usmoni@gmail.com>
|
|
||||||
- Motonori Iwata <121048+iwata@users.noreply.github.com>
|
|
||||||
- Nikita Galkin <nikita@galk.in>
|
|
||||||
- Petr Mares <petr@mares.tw>
|
|
||||||
- Philippe Recto <precto1285@gmal.com>
|
|
||||||
- Remco Haszing <remcohaszing@gmail.com>
|
|
||||||
- rockcs1992 <chengshi1219@gmail.com>
|
|
||||||
- Ryan Bown <rbown@niftee.com.au>
|
|
||||||
- Samina Fu <sufuf3@gmail.com>
|
|
||||||
- Simone Busoli <simone.busoli@gmail.com>
|
|
||||||
- Spencer von der Ohe <s.vonderohe40@gmail.com>
|
|
||||||
- Sven Efftinge <sven.efftinge@typefox.io>
|
|
||||||
- Taegyeoung Oh <otk1090@naver.com>
|
|
||||||
- Taemin Shin <cprayer13@gmail.com>
|
|
||||||
- Thibault Ehrhart <1208424+ehrhart@users.noreply.github.com>
|
|
||||||
- Xianming Zhong <chinesedfan@qq.com>
|
|
||||||
- Yasu Flores <carlosyasu91@gmail.com>
|
|
||||||
- Zac Delventhal <delventhalz@gmail.com>
|
|
||||||
|
|
||||||
### 0.19.2 (Jan 20, 2020)
|
|
||||||
|
|
||||||
- Remove unnecessary XSS check ([#2679](https://github.com/axios/axios/pull/2679)) (see ([#2646](https://github.com/axios/axios/issues/2646)) for discussion)
|
|
||||||
|
|
||||||
### 0.19.1 (Jan 7, 2020)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
|
|
||||||
- Fixing invalid agent issue ([#1904](https://github.com/axios/axios/pull/1904))
|
|
||||||
- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582))
|
|
||||||
- Delete useless default to hash ([#2458](https://github.com/axios/axios/pull/2458))
|
|
||||||
- Fix HTTP/HTTPs agents passing to follow-redirect ([#1904](https://github.com/axios/axios/pull/1904))
|
|
||||||
- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582))
|
|
||||||
- Fix CI build failure ([#2570](https://github.com/axios/axios/pull/2570))
|
|
||||||
- Remove dependency on is-buffer from package.json ([#1816](https://github.com/axios/axios/pull/1816))
|
|
||||||
- Adding options typings ([#2341](https://github.com/axios/axios/pull/2341))
|
|
||||||
- Adding Typescript HTTP method definition for LINK and UNLINK. ([#2444](https://github.com/axios/axios/pull/2444))
|
|
||||||
- Update dist with newest changes, fixes Custom Attributes issue
|
|
||||||
- Change syntax to see if build passes ([#2488](https://github.com/axios/axios/pull/2488))
|
|
||||||
- Update Webpack + deps, remove now unnecessary polyfills ([#2410](https://github.com/axios/axios/pull/2410))
|
|
||||||
- Fix to prevent XSS, throw an error when the URL contains a JS script ([#2464](https://github.com/axios/axios/pull/2464))
|
|
||||||
- Add custom timeout error copy in config ([#2275](https://github.com/axios/axios/pull/2275))
|
|
||||||
- Add error toJSON example ([#2466](https://github.com/axios/axios/pull/2466))
|
|
||||||
- Fixing Vulnerability A Fortify Scan finds a critical Cross-Site Scrip… ([#2451](https://github.com/axios/axios/pull/2451))
|
|
||||||
- Fixing subdomain handling on no_proxy ([#2442](https://github.com/axios/axios/pull/2442))
|
|
||||||
- Make redirection from HTTP to HTTPS work ([#2426](https://github.com/axios/axios/pull/2426)) and ([#2547](https://github.com/axios/axios/pull/2547))
|
|
||||||
- Add toJSON property to AxiosError type ([#2427](https://github.com/axios/axios/pull/2427))
|
|
||||||
- Fixing socket hang up error on node side for slow response. ([#1752](https://github.com/axios/axios/pull/1752))
|
|
||||||
- Alternative syntax to send data into the body ([#2317](https://github.com/axios/axios/pull/2317))
|
|
||||||
- Fixing custom config options ([#2207](https://github.com/axios/axios/pull/2207))
|
|
||||||
- Fixing set `config.method` after mergeConfig for Axios.prototype.request ([#2383](https://github.com/axios/axios/pull/2383))
|
|
||||||
- Axios create url bug ([#2290](https://github.com/axios/axios/pull/2290))
|
|
||||||
- Do not modify config.url when using a relative baseURL (resolves [#1628](https://github.com/axios/axios/issues/1098)) ([#2391](https://github.com/axios/axios/pull/2391))
|
|
||||||
|
|
||||||
Internal:
|
|
||||||
|
|
||||||
- Revert "Update Webpack + deps, remove now unnecessary polyfills" ([#2479](https://github.com/axios/axios/pull/2479))
|
|
||||||
- Order of if/else blocks is causing unit tests mocking XHR. ([#2201](https://github.com/axios/axios/pull/2201))
|
|
||||||
- Add license badge ([#2446](https://github.com/axios/axios/pull/2446))
|
|
||||||
- Fix travis CI build [#2386](https://github.com/axios/axios/pull/2386)
|
|
||||||
- Fix cancellation error on build master. #2290 #2207 ([#2407](https://github.com/axios/axios/pull/2407))
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
|
|
||||||
- Fixing typo in CHANGELOG.md: s/Functionallity/Functionality ([#2639](https://github.com/axios/axios/pull/2639))
|
|
||||||
- Fix badge, use master branch ([#2538](https://github.com/axios/axios/pull/2538))
|
|
||||||
- Fix typo in changelog [#2193](https://github.com/axios/axios/pull/2193)
|
|
||||||
- Document fix ([#2514](https://github.com/axios/axios/pull/2514))
|
|
||||||
- Update docs with no_proxy change, issue #2484 ([#2513](https://github.com/axios/axios/pull/2513))
|
|
||||||
- Fixing missing words in docs template ([#2259](https://github.com/axios/axios/pull/2259))
|
|
||||||
- 🐛Fix request finally documentation in README ([#2189](https://github.com/axios/axios/pull/2189))
|
|
||||||
- updating spelling and adding link to docs ([#2212](https://github.com/axios/axios/pull/2212))
|
|
||||||
- docs: minor tweak ([#2404](https://github.com/axios/axios/pull/2404))
|
|
||||||
- Update response interceptor docs ([#2399](https://github.com/axios/axios/pull/2399))
|
|
||||||
- Update README.md ([#2504](https://github.com/axios/axios/pull/2504))
|
|
||||||
- Fix word 'sintaxe' to 'syntax' in README.md ([#2432](https://github.com/axios/axios/pull/2432))
|
|
||||||
- updating README: notes on CommonJS autocomplete ([#2256](https://github.com/axios/axios/pull/2256))
|
|
||||||
- Fix grammar in README.md ([#2271](https://github.com/axios/axios/pull/2271))
|
|
||||||
- Doc fixes, minor examples cleanup ([#2198](https://github.com/axios/axios/pull/2198))
|
|
||||||
|
|
||||||
### 0.19.0 (May 30, 2019)
|
|
||||||
|
|
||||||
Fixes and Functionality:
|
|
||||||
|
|
||||||
- Added support for no_proxy env variable ([#1693](https://github.com/axios/axios/pull/1693/files)) - Chance Dickson
|
|
||||||
- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski
|
|
||||||
- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issues/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev
|
|
||||||
- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama
|
|
||||||
- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester
|
|
||||||
- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers
|
|
||||||
- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov
|
|
||||||
- This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#`
|
|
||||||
- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson
|
|
||||||
- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi
|
|
||||||
- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta
|
|
||||||
|
|
||||||
Internal:
|
|
||||||
|
|
||||||
- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel
|
|
||||||
- Fix failing SauceLabs tests by updating configuration - Emily Morehouse
|
|
||||||
- Add issue templates - Emily Morehouse
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
|
|
||||||
- Consistent coding style in README ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez
|
|
||||||
- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna
|
|
||||||
- Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho
|
|
||||||
- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan
|
|
||||||
- Add r2curl in ECOSYSTEM ([#2141](https://github.com/axios/axios/pull/2141)) - 유용우 / CX
|
|
||||||
- Update README.md - Add instructions for installing with yarn ([#2036](https://github.com/axios/axios/pull/2036)) - Victor Hermes
|
|
||||||
- Fixing spacing for README.md ([#2066](https://github.com/axios/axios/pull/2066)) - Josh McCarty
|
|
||||||
- Update README.md. - Change `.then` to `.finally` in example code ([#2090](https://github.com/axios/axios/pull/2090)) - Omar Cai
|
|
||||||
- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher
|
|
||||||
- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe
|
|
||||||
- It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser
|
|
||||||
- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko
|
|
||||||
- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan
|
|
||||||
- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer
|
|
||||||
|
|
||||||
### 0.19.0-beta.1 (Aug 9, 2018)
|
|
||||||
|
|
||||||
**NOTE:** This is a beta version of this release. There may be functionality that is broken in
|
|
||||||
certain browsers, though we suspect that builds are hanging and not erroring. See
|
|
||||||
https://saucelabs.com/u/axios for the most up-to-date information.
|
|
||||||
|
|
||||||
New Functionality:
|
|
||||||
|
|
||||||
- Add getUri method ([#1712](https://github.com/axios/axios/issues/1712))
|
|
||||||
- Add support for no_proxy env variable ([#1693](https://github.com/axios/axios/issues/1693))
|
|
||||||
- Add toJSON to decorated Axios errors to facilitate serialization ([#1625](https://github.com/axios/axios/issues/1625))
|
|
||||||
- Add second then on axios call ([#1623](https://github.com/axios/axios/issues/1623))
|
|
||||||
- Typings: allow custom return types
|
|
||||||
- Add option to specify character set in responses (with http adapter)
|
|
||||||
|
|
||||||
Fixes:
|
|
||||||
|
|
||||||
- Fix Keep defaults local to instance ([#385](https://github.com/axios/axios/issues/385))
|
|
||||||
- Correctly catch exception in http test ([#1475](https://github.com/axios/axios/issues/1475))
|
|
||||||
- Fix accept header normalization ([#1698](https://github.com/axios/axios/issues/1698))
|
|
||||||
- Fix http adapter to allow HTTPS connections via HTTP ([#959](https://github.com/axios/axios/issues/959))
|
|
||||||
- Fix Removes usage of deprecated Buffer constructor. ([#1555](https://github.com/axios/axios/issues/1555), [#1622](https://github.com/axios/axios/issues/1622))
|
|
||||||
- Fix defaults to use httpAdapter if available ([#1285](https://github.com/axios/axios/issues/1285))
|
|
||||||
- Fixing defaults to use httpAdapter if available
|
|
||||||
- Use a safer, cross-platform method to detect the Node environment
|
|
||||||
- Fix Reject promise if request is cancelled by the browser ([#537](https://github.com/axios/axios/issues/537))
|
|
||||||
- [Typescript] Fix missing type parameters on delete/head methods
|
|
||||||
- [NS]: Send `false` flag isStandardBrowserEnv for Nativescript
|
|
||||||
- Fix missing type parameters on delete/head
|
|
||||||
- Fix Default method for an instance always overwritten by get
|
|
||||||
- Fix type error when socketPath option in AxiosRequestConfig
|
|
||||||
- Capture errors on request data streams
|
|
||||||
- Decorate resolve and reject to clear timeout in all cases
|
|
||||||
|
|
||||||
Huge thanks to everyone who contributed to this release via code (authors listed
|
|
||||||
below) or via reviews and triaging on GitHub:
|
|
||||||
|
|
||||||
- Andrew Scott <ascott18@gmail.com>
|
|
||||||
- Anthony Gauthier <antho325@hotmail.com>
|
|
||||||
- arpit <arpit2438735@gmail.com>
|
|
||||||
- ascott18
|
|
||||||
- Benedikt Rötsch <axe312ger@users.noreply.github.com>
|
|
||||||
- Chance Dickson <me@chancedickson.com>
|
|
||||||
- Dave Stewart <info@davestewart.co.uk>
|
|
||||||
- Deric Cain <deric.cain@gmail.com>
|
|
||||||
- Guillaume Briday <guillaumebriday@gmail.com>
|
|
||||||
- Jacob Wejendorp <jacob@wejendorp.dk>
|
|
||||||
- Jim Lynch <mrdotjim@gmail.com>
|
|
||||||
- johntron
|
|
||||||
- Justin Beckwith <beckwith@google.com>
|
|
||||||
- Justin Beckwith <justin.beckwith@gmail.com>
|
|
||||||
- Khaled Garbaya <khaledgarbaya@gmail.com>
|
|
||||||
- Lim Jing Rong <jjingrong@users.noreply.github.com>
|
|
||||||
- Mark van den Broek <mvdnbrk@gmail.com>
|
|
||||||
- Martti Laine <martti@codeclown.net>
|
|
||||||
- mattridley
|
|
||||||
- mattridley <matt.r@joinblink.com>
|
|
||||||
- Nicolas Del Valle <nicolas.delvalle@gmail.com>
|
|
||||||
- Nilegfx
|
|
||||||
- pbarbiero
|
|
||||||
- Rikki Gibson <rikkigibson@gmail.com>
|
|
||||||
- Sako Hartounian <sakohartounian@yahoo.com>
|
|
||||||
- Shane Fitzpatrick <fitzpasd@gmail.com>
|
|
||||||
- Stephan Schneider <stephanschndr@gmail.com>
|
|
||||||
- Steven <steven@ceriously.com>
|
|
||||||
- Tim Garthwaite <tim.garthwaite@jibo.com>
|
|
||||||
- Tim Johns <timjohns@yahoo.com>
|
|
||||||
- Yutaro Miyazaki <yutaro@studio-rubbish.com>
|
|
||||||
|
|
||||||
### 0.18.0 (Feb 19, 2018)
|
|
||||||
|
|
||||||
- Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070))
|
|
||||||
- Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)):
|
|
||||||
- AxiosRequestConfig.proxy: allows type false
|
|
||||||
- AxiosProxyConfig: added auth field
|
|
||||||
- Adding function signature in AxiosInstance interface so AxiosInstance can be invoked ([#1192](https://github.com/axios/axios/pull/1192), [#1254](https://github.com/axios/axios/pull/1254))
|
|
||||||
- Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287))
|
|
||||||
- Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342))
|
|
||||||
|
|
||||||
### 0.17.1 (Nov 11, 2017)
|
|
||||||
|
|
||||||
- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))
|
|
||||||
- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080))
|
|
||||||
- Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131))
|
|
||||||
|
|
||||||
### 0.17.0 (Oct 21, 2017)
|
|
||||||
|
|
||||||
- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))
|
|
||||||
- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874))
|
|
||||||
- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691))
|
|
||||||
- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061))
|
|
||||||
|
|
||||||
### 0.16.2 (Jun 3, 2017)
|
|
||||||
|
|
||||||
- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))
|
|
||||||
- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830))
|
|
||||||
- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930))
|
|
||||||
|
|
||||||
### 0.16.1 (Apr 8, 2017)
|
|
||||||
|
|
||||||
- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))
|
|
||||||
- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829))
|
|
||||||
- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773))
|
|
||||||
|
|
||||||
### 0.16.0 (Mar 31, 2017)
|
|
||||||
|
|
||||||
- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))
|
|
||||||
- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461))
|
|
||||||
- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654))
|
|
||||||
- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731))
|
|
||||||
- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581))
|
|
||||||
- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561))
|
|
||||||
|
|
||||||
### 0.15.3 (Nov 27, 2016)
|
|
||||||
|
|
||||||
- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))
|
|
||||||
- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519))
|
|
||||||
- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509))
|
|
||||||
- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507))
|
|
||||||
- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483))
|
|
||||||
- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493))
|
|
||||||
- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491))
|
|
||||||
|
|
||||||
### 0.15.2 (Oct 17, 2016)
|
|
||||||
|
|
||||||
- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482))
|
|
||||||
|
|
||||||
### 0.15.1 (Oct 14, 2016)
|
|
||||||
|
|
||||||
- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
|
|
||||||
|
|
||||||
### 0.15.0 (Oct 10, 2016)
|
|
||||||
|
|
||||||
- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))
|
|
||||||
- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437))
|
|
||||||
- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440))
|
|
||||||
- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445))
|
|
||||||
|
|
||||||
### 0.14.0 (Aug 27, 2016)
|
|
||||||
|
|
||||||
- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))
|
|
||||||
- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387))
|
|
||||||
- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423))
|
|
||||||
- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366))
|
|
||||||
- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397))
|
|
||||||
- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406))
|
|
||||||
|
|
||||||
### 0.13.1 (Jul 16, 2016)
|
|
||||||
|
|
||||||
- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378))
|
|
||||||
|
|
||||||
### 0.13.0 (Jul 13, 2016)
|
|
||||||
|
|
||||||
- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))
|
|
||||||
- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
|
|
||||||
- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
|
|
||||||
- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343))
|
|
||||||
- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352))
|
|
||||||
- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341))
|
|
||||||
- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217))
|
|
||||||
|
|
||||||
### 0.12.0 (May 31, 2016)
|
|
||||||
|
|
||||||
- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))
|
|
||||||
- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307))
|
|
||||||
|
|
||||||
### 0.11.1 (May 17, 2016)
|
|
||||||
|
|
||||||
- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))
|
|
||||||
- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325))
|
|
||||||
- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321))
|
|
||||||
|
|
||||||
### 0.11.0 (Apr 26, 2016)
|
|
||||||
|
|
||||||
- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))
|
|
||||||
- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308))
|
|
||||||
- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299))
|
|
||||||
|
|
||||||
### 0.10.0 (Apr 20, 2016)
|
|
||||||
|
|
||||||
- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))
|
|
||||||
- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252))
|
|
||||||
- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227))
|
|
||||||
- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249))
|
|
||||||
- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251))
|
|
||||||
- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275))
|
|
||||||
- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279))
|
|
||||||
- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200))
|
|
||||||
|
|
||||||
### 0.9.1 (Jan 24, 2016)
|
|
||||||
|
|
||||||
- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))
|
|
||||||
- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205))
|
|
||||||
- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201))
|
|
||||||
- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198))
|
|
||||||
|
|
||||||
### 0.9.0 (Jan 18, 2016)
|
|
||||||
|
|
||||||
- Adding support for custom adapters
|
|
||||||
- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195))
|
|
||||||
- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185))
|
|
||||||
- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183))
|
|
||||||
- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182))
|
|
||||||
|
|
||||||
### 0.8.1 (Dec 14, 2015)
|
|
||||||
|
|
||||||
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))
|
|
||||||
- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173))
|
|
||||||
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174))
|
|
||||||
|
|
||||||
### 0.8.0 (Dec 11, 2015)
|
|
||||||
|
|
||||||
- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))
|
|
||||||
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128))
|
|
||||||
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121))
|
|
||||||
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127))
|
|
||||||
- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146))
|
|
||||||
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149))
|
|
||||||
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140))
|
|
||||||
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167))
|
|
||||||
- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160))
|
|
||||||
|
|
||||||
### 0.7.0 (Sep 29, 2015)
|
|
||||||
|
|
||||||
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))
|
|
||||||
- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102))
|
|
||||||
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106))
|
|
||||||
- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105))
|
|
||||||
- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112))
|
|
||||||
- Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98))
|
|
||||||
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116))
|
|
||||||
|
|
||||||
### 0.6.0 (Sep 21, 2015)
|
|
||||||
|
|
||||||
- Removing deprecated success/error aliases
|
|
||||||
- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49))
|
|
||||||
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69))
|
|
||||||
- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56))
|
|
||||||
- Removing es6-promise dependency
|
|
||||||
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91))
|
|
||||||
- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85))
|
|
||||||
- Converting build to UMD
|
|
||||||
|
|
||||||
### 0.5.4 (Apr 08, 2015)
|
|
||||||
|
|
||||||
- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53))
|
|
||||||
|
|
||||||
### 0.5.3 (Apr 07, 2015)
|
|
||||||
|
|
||||||
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
|
|
||||||
|
|
||||||
### 0.5.2 (Mar 13, 2015)
|
|
||||||
|
|
||||||
- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46))
|
|
||||||
|
|
||||||
### 0.5.1 (Mar 10, 2015)
|
|
||||||
|
|
||||||
- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))
|
|
||||||
- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47))
|
|
||||||
|
|
||||||
### 0.5.0 (Jan 23, 2015)
|
|
||||||
|
|
||||||
- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))
|
|
||||||
- Updating es6-promise dependency
|
|
||||||
|
|
||||||
### 0.4.2 (Dec 10, 2014)
|
|
||||||
|
|
||||||
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))
|
|
||||||
- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25))
|
|
||||||
- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29))
|
|
||||||
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30))
|
|
||||||
|
|
||||||
### 0.4.1 (Oct 15, 2014)
|
|
||||||
|
|
||||||
- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18))
|
|
||||||
|
|
||||||
### 0.4.0 (Oct 03, 2014)
|
|
||||||
|
|
||||||
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))
|
|
||||||
- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13))
|
|
||||||
- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12))
|
|
||||||
- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9))
|
|
||||||
- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11))
|
|
||||||
- Deprecating `success`/`error` in favor of `then`/`catch`
|
|
||||||
|
|
||||||
### 0.3.1 (Sep 16, 2014)
|
|
||||||
|
|
||||||
- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3))
|
|
||||||
|
|
||||||
### 0.3.0 (Sep 16, 2014)
|
|
||||||
|
|
||||||
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))
|
|
||||||
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6))
|
|
||||||
- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7))
|
|
||||||
|
|
||||||
### 0.2.2 (Sep 14, 2014)
|
|
||||||
|
|
||||||
- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
|
|
||||||
|
|
||||||
### 0.2.1 (Sep 12, 2014)
|
|
||||||
|
|
||||||
- Fixing build problem causing ridiculous file sizes
|
|
||||||
|
|
||||||
### 0.2.0 (Sep 12, 2014)
|
|
||||||
|
|
||||||
- Adding support for `all` and `spread`
|
|
||||||
- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1))
|
|
||||||
|
|
||||||
### 0.1.0 (Aug 29, 2014)
|
|
||||||
|
|
||||||
- Initial release
|
|
||||||
19
node_modules/axios/LICENSE
generated
vendored
19
node_modules/axios/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
|||||||
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.
|
|
||||||
909
node_modules/axios/README.md
generated
vendored
909
node_modules/axios/README.md
generated
vendored
@@ -1,909 +0,0 @@
|
|||||||
# axios
|
|
||||||
|
|
||||||
[](https://www.npmjs.org/package/axios)
|
|
||||||
[](https://cdnjs.com/libraries/axios)
|
|
||||||

|
|
||||||
[](https://gitpod.io/#https://github.com/axios/axios)
|
|
||||||
[](https://coveralls.io/r/mzabriskie/axios)
|
|
||||||
[](https://packagephobia.now.sh/result?p=axios)
|
|
||||||
[](http://npm-stat.com/charts.html?package=axios)
|
|
||||||
[](https://gitter.im/mzabriskie/axios)
|
|
||||||
[](https://www.codetriage.com/axios/axios)
|
|
||||||
[](https://snyk.io/test/npm/axios)
|
|
||||||
|
|
||||||
Promise based HTTP client for the browser and node.js
|
|
||||||
|
|
||||||
> New axios docs website: [click here](https://axios-http.com/)
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Features](#features)
|
|
||||||
- [Browser Support](#browser-support)
|
|
||||||
- [Installing](#installing)
|
|
||||||
- [Example](#example)
|
|
||||||
- [Axios API](#axios-api)
|
|
||||||
- [Request method aliases](#request-method-aliases)
|
|
||||||
- [Concurrency (Deprecated)](#concurrency-deprecated)
|
|
||||||
- [Creating an instance](#creating-an-instance)
|
|
||||||
- [Instance methods](#instance-methods)
|
|
||||||
- [Request Config](#request-config)
|
|
||||||
- [Response Schema](#response-schema)
|
|
||||||
- [Config Defaults](#config-defaults)
|
|
||||||
- [Global axios defaults](#global-axios-defaults)
|
|
||||||
- [Custom instance defaults](#custom-instance-defaults)
|
|
||||||
- [Config order of precedence](#config-order-of-precedence)
|
|
||||||
- [Interceptors](#interceptors)
|
|
||||||
- [Multiple Interceptors](#multiple-interceptors)
|
|
||||||
- [Handling Errors](#handling-errors)
|
|
||||||
- [Cancellation](#cancellation)
|
|
||||||
- [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
|
|
||||||
- [Browser](#browser)
|
|
||||||
- [Node.js](#nodejs)
|
|
||||||
- [Query string](#query-string)
|
|
||||||
- [Form data](#form-data)
|
|
||||||
- [Semver](#semver)
|
|
||||||
- [Promises](#promises)
|
|
||||||
- [TypeScript](#typescript)
|
|
||||||
- [Resources](#resources)
|
|
||||||
- [Credits](#credits)
|
|
||||||
- [License](#license)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
|
|
||||||
- Make [http](http://nodejs.org/api/http.html) requests from node.js
|
|
||||||
- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
|
|
||||||
- Intercept request and response
|
|
||||||
- Transform request and response data
|
|
||||||
- Cancel requests
|
|
||||||
- Automatic transforms for JSON data
|
|
||||||
- Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
|
|
||||||
|
|
||||||
## Browser Support
|
|
||||||
|
|
||||||
 |  |  |  |  |  |
|
|
||||||
--- | --- | --- | --- | --- | --- |
|
|
||||||
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
|
|
||||||
|
|
||||||
[](https://saucelabs.com/u/axios)
|
|
||||||
|
|
||||||
## Installing
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm install axios
|
|
||||||
```
|
|
||||||
|
|
||||||
Using bower:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ bower install axios
|
|
||||||
```
|
|
||||||
|
|
||||||
Using yarn:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ yarn add axios
|
|
||||||
```
|
|
||||||
|
|
||||||
Using jsDelivr CDN:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Using unpkg CDN:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
### note: CommonJS usage
|
|
||||||
In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const axios = require('axios').default;
|
|
||||||
|
|
||||||
// axios.<method> will now provide autocomplete and parameter typings
|
|
||||||
```
|
|
||||||
|
|
||||||
Performing a `GET` request
|
|
||||||
|
|
||||||
```js
|
|
||||||
const axios = require('axios');
|
|
||||||
|
|
||||||
// Make a request for a user with a given ID
|
|
||||||
axios.get('/user?ID=12345')
|
|
||||||
.then(function (response) {
|
|
||||||
// handle success
|
|
||||||
console.log(response);
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
// handle error
|
|
||||||
console.log(error);
|
|
||||||
})
|
|
||||||
.then(function () {
|
|
||||||
// always executed
|
|
||||||
});
|
|
||||||
|
|
||||||
// Optionally the request above could also be done as
|
|
||||||
axios.get('/user', {
|
|
||||||
params: {
|
|
||||||
ID: 12345
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (response) {
|
|
||||||
console.log(response);
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
})
|
|
||||||
.then(function () {
|
|
||||||
// always executed
|
|
||||||
});
|
|
||||||
|
|
||||||
// Want to use async/await? Add the `async` keyword to your outer function/method.
|
|
||||||
async function getUser() {
|
|
||||||
try {
|
|
||||||
const response = await axios.get('/user?ID=12345');
|
|
||||||
console.log(response);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
|
|
||||||
> Explorer and older browsers, so use with caution.
|
|
||||||
|
|
||||||
Performing a `POST` request
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.post('/user', {
|
|
||||||
firstName: 'Fred',
|
|
||||||
lastName: 'Flintstone'
|
|
||||||
})
|
|
||||||
.then(function (response) {
|
|
||||||
console.log(response);
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
Performing multiple concurrent requests
|
|
||||||
|
|
||||||
```js
|
|
||||||
function getUserAccount() {
|
|
||||||
return axios.get('/user/12345');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getUserPermissions() {
|
|
||||||
return axios.get('/user/12345/permissions');
|
|
||||||
}
|
|
||||||
|
|
||||||
Promise.all([getUserAccount(), getUserPermissions()])
|
|
||||||
.then(function (results) {
|
|
||||||
const acct = results[0];
|
|
||||||
const perm = results[1];
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## axios API
|
|
||||||
|
|
||||||
Requests can be made by passing the relevant config to `axios`.
|
|
||||||
|
|
||||||
##### axios(config)
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Send a POST request
|
|
||||||
axios({
|
|
||||||
method: 'post',
|
|
||||||
url: '/user/12345',
|
|
||||||
data: {
|
|
||||||
firstName: 'Fred',
|
|
||||||
lastName: 'Flintstone'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
// GET request for remote image in node.js
|
|
||||||
axios({
|
|
||||||
method: 'get',
|
|
||||||
url: 'http://bit.ly/2mTM3nY',
|
|
||||||
responseType: 'stream'
|
|
||||||
})
|
|
||||||
.then(function (response) {
|
|
||||||
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
##### axios(url[, config])
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Send a GET request (default method)
|
|
||||||
axios('/user/12345');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Request method aliases
|
|
||||||
|
|
||||||
For convenience aliases have been provided for all supported request methods.
|
|
||||||
|
|
||||||
##### axios.request(config)
|
|
||||||
##### axios.get(url[, config])
|
|
||||||
##### axios.delete(url[, config])
|
|
||||||
##### axios.head(url[, config])
|
|
||||||
##### axios.options(url[, config])
|
|
||||||
##### axios.post(url[, data[, config]])
|
|
||||||
##### axios.put(url[, data[, config]])
|
|
||||||
##### axios.patch(url[, data[, config]])
|
|
||||||
|
|
||||||
###### NOTE
|
|
||||||
When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
|
|
||||||
|
|
||||||
### Concurrency (Deprecated)
|
|
||||||
Please use `Promise.all` to replace the below functions.
|
|
||||||
|
|
||||||
Helper functions for dealing with concurrent requests.
|
|
||||||
|
|
||||||
axios.all(iterable)
|
|
||||||
axios.spread(callback)
|
|
||||||
|
|
||||||
### Creating an instance
|
|
||||||
|
|
||||||
You can create a new instance of axios with a custom config.
|
|
||||||
|
|
||||||
##### axios.create([config])
|
|
||||||
|
|
||||||
```js
|
|
||||||
const instance = axios.create({
|
|
||||||
baseURL: 'https://some-domain.com/api/',
|
|
||||||
timeout: 1000,
|
|
||||||
headers: {'X-Custom-Header': 'foobar'}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Instance methods
|
|
||||||
|
|
||||||
The available instance methods are listed below. The specified config will be merged with the instance config.
|
|
||||||
|
|
||||||
##### axios#request(config)
|
|
||||||
##### axios#get(url[, config])
|
|
||||||
##### axios#delete(url[, config])
|
|
||||||
##### axios#head(url[, config])
|
|
||||||
##### axios#options(url[, config])
|
|
||||||
##### axios#post(url[, data[, config]])
|
|
||||||
##### axios#put(url[, data[, config]])
|
|
||||||
##### axios#patch(url[, data[, config]])
|
|
||||||
##### axios#getUri([config])
|
|
||||||
|
|
||||||
## Request Config
|
|
||||||
|
|
||||||
These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
// `url` is the server URL that will be used for the request
|
|
||||||
url: '/user',
|
|
||||||
|
|
||||||
// `method` is the request method to be used when making the request
|
|
||||||
method: 'get', // default
|
|
||||||
|
|
||||||
// `baseURL` will be prepended to `url` unless `url` is absolute.
|
|
||||||
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
|
||||||
// to methods of that instance.
|
|
||||||
baseURL: 'https://some-domain.com/api/',
|
|
||||||
|
|
||||||
// `transformRequest` allows changes to the request data before it is sent to the server
|
|
||||||
// This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
|
|
||||||
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
|
||||||
// FormData or Stream
|
|
||||||
// You may modify the headers object.
|
|
||||||
transformRequest: [function (data, headers) {
|
|
||||||
// Do whatever you want to transform the data
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}],
|
|
||||||
|
|
||||||
// `transformResponse` allows changes to the response data to be made before
|
|
||||||
// it is passed to then/catch
|
|
||||||
transformResponse: [function (data) {
|
|
||||||
// Do whatever you want to transform the data
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}],
|
|
||||||
|
|
||||||
// `headers` are custom headers to be sent
|
|
||||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
|
||||||
|
|
||||||
// `params` are the URL parameters to be sent with the request
|
|
||||||
// Must be a plain object or a URLSearchParams object
|
|
||||||
params: {
|
|
||||||
ID: 12345
|
|
||||||
},
|
|
||||||
|
|
||||||
// `paramsSerializer` is an optional function in charge of serializing `params`
|
|
||||||
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
|
|
||||||
paramsSerializer: function (params) {
|
|
||||||
return Qs.stringify(params, {arrayFormat: 'brackets'})
|
|
||||||
},
|
|
||||||
|
|
||||||
// `data` is the data to be sent as the request body
|
|
||||||
// Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH'
|
|
||||||
// When no `transformRequest` is set, must be of one of the following types:
|
|
||||||
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
|
|
||||||
// - Browser only: FormData, File, Blob
|
|
||||||
// - Node only: Stream, Buffer
|
|
||||||
data: {
|
|
||||||
firstName: 'Fred'
|
|
||||||
},
|
|
||||||
|
|
||||||
// syntax alternative to send data into the body
|
|
||||||
// method post
|
|
||||||
// only the value is sent, not the key
|
|
||||||
data: 'Country=Brasil&City=Belo Horizonte',
|
|
||||||
|
|
||||||
// `timeout` specifies the number of milliseconds before the request times out.
|
|
||||||
// If the request takes longer than `timeout`, the request will be aborted.
|
|
||||||
timeout: 1000, // default is `0` (no timeout)
|
|
||||||
|
|
||||||
// `withCredentials` indicates whether or not cross-site Access-Control requests
|
|
||||||
// should be made using credentials
|
|
||||||
withCredentials: false, // default
|
|
||||||
|
|
||||||
// `adapter` allows custom handling of requests which makes testing easier.
|
|
||||||
// Return a promise and supply a valid response (see lib/adapters/README.md).
|
|
||||||
adapter: function (config) {
|
|
||||||
/* ... */
|
|
||||||
},
|
|
||||||
|
|
||||||
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
|
||||||
// This will set an `Authorization` header, overwriting any existing
|
|
||||||
// `Authorization` custom headers you have set using `headers`.
|
|
||||||
// Please note that only HTTP Basic auth is configurable through this parameter.
|
|
||||||
// For Bearer tokens and such, use `Authorization` custom headers instead.
|
|
||||||
auth: {
|
|
||||||
username: 'janedoe',
|
|
||||||
password: 's00pers3cret'
|
|
||||||
},
|
|
||||||
|
|
||||||
// `responseType` indicates the type of data that the server will respond with
|
|
||||||
// options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
|
|
||||||
// browser only: 'blob'
|
|
||||||
responseType: 'json', // default
|
|
||||||
|
|
||||||
// `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
|
|
||||||
// Note: Ignored for `responseType` of 'stream' or client-side requests
|
|
||||||
responseEncoding: 'utf8', // default
|
|
||||||
|
|
||||||
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
|
|
||||||
xsrfCookieName: 'XSRF-TOKEN', // default
|
|
||||||
|
|
||||||
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value
|
|
||||||
xsrfHeaderName: 'X-XSRF-TOKEN', // default
|
|
||||||
|
|
||||||
// `onUploadProgress` allows handling of progress events for uploads
|
|
||||||
// browser only
|
|
||||||
onUploadProgress: function (progressEvent) {
|
|
||||||
// Do whatever you want with the native progress event
|
|
||||||
},
|
|
||||||
|
|
||||||
// `onDownloadProgress` allows handling of progress events for downloads
|
|
||||||
// browser only
|
|
||||||
onDownloadProgress: function (progressEvent) {
|
|
||||||
// Do whatever you want with the native progress event
|
|
||||||
},
|
|
||||||
|
|
||||||
// `maxContentLength` defines the max size of the http response content in bytes allowed in node.js
|
|
||||||
maxContentLength: 2000,
|
|
||||||
|
|
||||||
// `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
|
|
||||||
maxBodyLength: 2000,
|
|
||||||
|
|
||||||
// `validateStatus` defines whether to resolve or reject the promise for a given
|
|
||||||
// HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
|
|
||||||
// or `undefined`), the promise will be resolved; otherwise, the promise will be
|
|
||||||
// rejected.
|
|
||||||
validateStatus: function (status) {
|
|
||||||
return status >= 200 && status < 300; // default
|
|
||||||
},
|
|
||||||
|
|
||||||
// `maxRedirects` defines the maximum number of redirects to follow in node.js.
|
|
||||||
// If set to 0, no redirects will be followed.
|
|
||||||
maxRedirects: 5, // default
|
|
||||||
|
|
||||||
// `socketPath` defines a UNIX Socket to be used in node.js.
|
|
||||||
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
|
|
||||||
// Only either `socketPath` or `proxy` can be specified.
|
|
||||||
// If both are specified, `socketPath` is used.
|
|
||||||
socketPath: null, // default
|
|
||||||
|
|
||||||
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
|
||||||
// and https requests, respectively, in node.js. This allows options to be added like
|
|
||||||
// `keepAlive` that are not enabled by default.
|
|
||||||
httpAgent: new http.Agent({ keepAlive: true }),
|
|
||||||
httpsAgent: new https.Agent({ keepAlive: true }),
|
|
||||||
|
|
||||||
// `proxy` defines the hostname, port, and protocol of the proxy server.
|
|
||||||
// You can also define your proxy using the conventional `http_proxy` and
|
|
||||||
// `https_proxy` environment variables. If you are using environment variables
|
|
||||||
// for your proxy configuration, you can also define a `no_proxy` environment
|
|
||||||
// variable as a comma-separated list of domains that should not be proxied.
|
|
||||||
// Use `false` to disable proxies, ignoring environment variables.
|
|
||||||
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
|
|
||||||
// supplies credentials.
|
|
||||||
// This will set an `Proxy-Authorization` header, overwriting any existing
|
|
||||||
// `Proxy-Authorization` custom headers you have set using `headers`.
|
|
||||||
// If the proxy server uses HTTPS, then you must set the protocol to `https`.
|
|
||||||
proxy: {
|
|
||||||
protocol: 'https',
|
|
||||||
host: '127.0.0.1',
|
|
||||||
port: 9000,
|
|
||||||
auth: {
|
|
||||||
username: 'mikeymike',
|
|
||||||
password: 'rapunz3l'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// `cancelToken` specifies a cancel token that can be used to cancel the request
|
|
||||||
// (see Cancellation section below for details)
|
|
||||||
cancelToken: new CancelToken(function (cancel) {
|
|
||||||
}),
|
|
||||||
|
|
||||||
// an alternative way to cancel Axios requests using AbortController
|
|
||||||
signal: new AbortController().signal,
|
|
||||||
|
|
||||||
// `decompress` indicates whether or not the response body should be decompressed
|
|
||||||
// automatically. If set to `true` will also remove the 'content-encoding' header
|
|
||||||
// from the responses objects of all decompressed responses
|
|
||||||
// - Node only (XHR cannot turn off decompression)
|
|
||||||
decompress: true // default
|
|
||||||
|
|
||||||
// `insecureHTTPParser` boolean.
|
|
||||||
// Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
|
|
||||||
// This may allow interoperability with non-conformant HTTP implementations.
|
|
||||||
// Using the insecure parser should be avoided.
|
|
||||||
// see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
|
|
||||||
// see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
|
|
||||||
insecureHTTPParser: undefined // default
|
|
||||||
|
|
||||||
// transitional options for backward compatibility that may be removed in the newer versions
|
|
||||||
transitional: {
|
|
||||||
// silent JSON parsing mode
|
|
||||||
// `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour)
|
|
||||||
// `false` - throw SyntaxError if JSON parsing failed (Note: responseType must be set to 'json')
|
|
||||||
silentJSONParsing: true, // default value for the current Axios version
|
|
||||||
|
|
||||||
// try to parse the response string as JSON even if `responseType` is not 'json'
|
|
||||||
forcedJSONParsing: true,
|
|
||||||
|
|
||||||
// throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
|
|
||||||
clarifyTimeoutError: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Response Schema
|
|
||||||
|
|
||||||
The response for a request contains the following information.
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
// `data` is the response that was provided by the server
|
|
||||||
data: {},
|
|
||||||
|
|
||||||
// `status` is the HTTP status code from the server response
|
|
||||||
status: 200,
|
|
||||||
|
|
||||||
// `statusText` is the HTTP status message from the server response
|
|
||||||
statusText: 'OK',
|
|
||||||
|
|
||||||
// `headers` the HTTP headers that the server responded with
|
|
||||||
// All header names are lower cased and can be accessed using the bracket notation.
|
|
||||||
// Example: `response.headers['content-type']`
|
|
||||||
headers: {},
|
|
||||||
|
|
||||||
// `config` is the config that was provided to `axios` for the request
|
|
||||||
config: {},
|
|
||||||
|
|
||||||
// `request` is the request that generated this response
|
|
||||||
// It is the last ClientRequest instance in node.js (in redirects)
|
|
||||||
// and an XMLHttpRequest instance in the browser
|
|
||||||
request: {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
When using `then`, you will receive the response as follows:
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.get('/user/12345')
|
|
||||||
.then(function (response) {
|
|
||||||
console.log(response.data);
|
|
||||||
console.log(response.status);
|
|
||||||
console.log(response.statusText);
|
|
||||||
console.log(response.headers);
|
|
||||||
console.log(response.config);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
|
|
||||||
|
|
||||||
## Config Defaults
|
|
||||||
|
|
||||||
You can specify config defaults that will be applied to every request.
|
|
||||||
|
|
||||||
### Global axios defaults
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.defaults.baseURL = 'https://api.example.com';
|
|
||||||
|
|
||||||
// Important: If axios is used with multiple domains, the AUTH_TOKEN will be sent to all of them.
|
|
||||||
// See below for an example using Custom instance defaults instead.
|
|
||||||
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
|
||||||
|
|
||||||
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Custom instance defaults
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Set config defaults when creating the instance
|
|
||||||
const instance = axios.create({
|
|
||||||
baseURL: 'https://api.example.com'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Alter defaults after instance has been created
|
|
||||||
instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Config order of precedence
|
|
||||||
|
|
||||||
Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Create an instance using the config defaults provided by the library
|
|
||||||
// At this point the timeout config value is `0` as is the default for the library
|
|
||||||
const instance = axios.create();
|
|
||||||
|
|
||||||
// Override timeout default for the library
|
|
||||||
// Now all requests using this instance will wait 2.5 seconds before timing out
|
|
||||||
instance.defaults.timeout = 2500;
|
|
||||||
|
|
||||||
// Override timeout for this request as it's known to take a long time
|
|
||||||
instance.get('/longRequest', {
|
|
||||||
timeout: 5000
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Interceptors
|
|
||||||
|
|
||||||
You can intercept requests or responses before they are handled by `then` or `catch`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Add a request interceptor
|
|
||||||
axios.interceptors.request.use(function (config) {
|
|
||||||
// Do something before request is sent
|
|
||||||
return config;
|
|
||||||
}, function (error) {
|
|
||||||
// Do something with request error
|
|
||||||
return Promise.reject(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add a response interceptor
|
|
||||||
axios.interceptors.response.use(function (response) {
|
|
||||||
// Any status code that lie within the range of 2xx cause this function to trigger
|
|
||||||
// Do something with response data
|
|
||||||
return response;
|
|
||||||
}, function (error) {
|
|
||||||
// Any status codes that falls outside the range of 2xx cause this function to trigger
|
|
||||||
// Do something with response error
|
|
||||||
return Promise.reject(error);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
If you need to remove an interceptor later you can.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
|
|
||||||
axios.interceptors.request.eject(myInterceptor);
|
|
||||||
```
|
|
||||||
|
|
||||||
You can add interceptors to a custom instance of axios.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const instance = axios.create();
|
|
||||||
instance.interceptors.request.use(function () {/*...*/});
|
|
||||||
```
|
|
||||||
|
|
||||||
When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay
|
|
||||||
in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
|
|
||||||
the interceptor and your request gets put on the bottom of the call stack). If your request interceptors are synchronous you can add a flag
|
|
||||||
to the options object that will tell axios to run the code synchronously and avoid any delays in request execution.
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.interceptors.request.use(function (config) {
|
|
||||||
config.headers.test = 'I am only a header!';
|
|
||||||
return config;
|
|
||||||
}, null, { synchronous: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to execute a particular interceptor based on a runtime check,
|
|
||||||
you can add a `runWhen` function to the options object. The interceptor will not be executed **if and only if** the return
|
|
||||||
of `runWhen` is `false`. The function will be called with the config
|
|
||||||
object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
|
|
||||||
asynchronous request interceptor that only needs to run at certain times.
|
|
||||||
|
|
||||||
```js
|
|
||||||
function onGetCall(config) {
|
|
||||||
return config.method === 'get';
|
|
||||||
}
|
|
||||||
axios.interceptors.request.use(function (config) {
|
|
||||||
config.headers.test = 'special get headers';
|
|
||||||
return config;
|
|
||||||
}, null, { runWhen: onGetCall });
|
|
||||||
```
|
|
||||||
|
|
||||||
### Multiple Interceptors
|
|
||||||
|
|
||||||
Given you add multiple response interceptors
|
|
||||||
and when the response was fulfilled
|
|
||||||
- then each interceptor is executed
|
|
||||||
- then they are executed in the order they were added
|
|
||||||
- then only the last interceptor's result is returned
|
|
||||||
- then every interceptor receives the result of it's predecessor
|
|
||||||
- and when the fulfillment-interceptor throws
|
|
||||||
- then the following fulfillment-interceptor is not called
|
|
||||||
- then the following rejection-interceptor is called
|
|
||||||
- once caught, another following fulfill-interceptor is called again (just like in a promise chain).
|
|
||||||
|
|
||||||
Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code.
|
|
||||||
|
|
||||||
## Handling Errors
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.get('/user/12345')
|
|
||||||
.catch(function (error) {
|
|
||||||
if (error.response) {
|
|
||||||
// The request was made and the server responded with a status code
|
|
||||||
// that falls out of the range of 2xx
|
|
||||||
console.log(error.response.data);
|
|
||||||
console.log(error.response.status);
|
|
||||||
console.log(error.response.headers);
|
|
||||||
} else if (error.request) {
|
|
||||||
// The request was made but no response was received
|
|
||||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
||||||
// http.ClientRequest in node.js
|
|
||||||
console.log(error.request);
|
|
||||||
} else {
|
|
||||||
// Something happened in setting up the request that triggered an Error
|
|
||||||
console.log('Error', error.message);
|
|
||||||
}
|
|
||||||
console.log(error.config);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error.
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.get('/user/12345', {
|
|
||||||
validateStatus: function (status) {
|
|
||||||
return status < 500; // Resolve only if the status code is less than 500
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
Using `toJSON` you get an object with more information about the HTTP error.
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.get('/user/12345')
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error.toJSON());
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cancellation
|
|
||||||
|
|
||||||
You can cancel a request using a *cancel token*.
|
|
||||||
|
|
||||||
> The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
|
|
||||||
|
|
||||||
You can create a cancel token using the `CancelToken.source` factory as shown below:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const CancelToken = axios.CancelToken;
|
|
||||||
const source = CancelToken.source();
|
|
||||||
|
|
||||||
axios.get('/user/12345', {
|
|
||||||
cancelToken: source.token
|
|
||||||
}).catch(function (thrown) {
|
|
||||||
if (axios.isCancel(thrown)) {
|
|
||||||
console.log('Request canceled', thrown.message);
|
|
||||||
} else {
|
|
||||||
// handle error
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
axios.post('/user/12345', {
|
|
||||||
name: 'new name'
|
|
||||||
}, {
|
|
||||||
cancelToken: source.token
|
|
||||||
})
|
|
||||||
|
|
||||||
// cancel the request (the message parameter is optional)
|
|
||||||
source.cancel('Operation canceled by the user.');
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const CancelToken = axios.CancelToken;
|
|
||||||
let cancel;
|
|
||||||
|
|
||||||
axios.get('/user/12345', {
|
|
||||||
cancelToken: new CancelToken(function executor(c) {
|
|
||||||
// An executor function receives a cancel function as a parameter
|
|
||||||
cancel = c;
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// cancel the request
|
|
||||||
cancel();
|
|
||||||
```
|
|
||||||
|
|
||||||
Axios supports AbortController to abort requests in [`fetch API`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#aborting_a_fetch) way:
|
|
||||||
```js
|
|
||||||
const controller = new AbortController();
|
|
||||||
|
|
||||||
axios.get('/foo/bar', {
|
|
||||||
signal: controller.signal
|
|
||||||
}).then(function(response) {
|
|
||||||
//...
|
|
||||||
});
|
|
||||||
// cancel the request
|
|
||||||
controller.abort()
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note: you can cancel several requests with the same cancel token/abort controller.
|
|
||||||
> If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make real request.
|
|
||||||
|
|
||||||
## Using application/x-www-form-urlencoded format
|
|
||||||
|
|
||||||
By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
|
|
||||||
|
|
||||||
### Browser
|
|
||||||
|
|
||||||
In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const params = new URLSearchParams();
|
|
||||||
params.append('param1', 'value1');
|
|
||||||
params.append('param2', 'value2');
|
|
||||||
axios.post('/foo', params);
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
|
|
||||||
|
|
||||||
Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const qs = require('qs');
|
|
||||||
axios.post('/foo', qs.stringify({ 'bar': 123 }));
|
|
||||||
```
|
|
||||||
|
|
||||||
Or in another way (ES6),
|
|
||||||
|
|
||||||
```js
|
|
||||||
import qs from 'qs';
|
|
||||||
const data = { 'bar': 123 };
|
|
||||||
const options = {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
||||||
data: qs.stringify(data),
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
axios(options);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Node.js
|
|
||||||
|
|
||||||
#### Query string
|
|
||||||
|
|
||||||
In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const querystring = require('querystring');
|
|
||||||
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
|
|
||||||
```
|
|
||||||
|
|
||||||
or ['URLSearchParams'](https://nodejs.org/api/url.html#url_class_urlsearchparams) from ['url module'](https://nodejs.org/api/url.html) as follows:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const url = require('url');
|
|
||||||
const params = new url.URLSearchParams({ foo: 'bar' });
|
|
||||||
axios.post('http://something.com/', params.toString());
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also use the [`qs`](https://github.com/ljharb/qs) library.
|
|
||||||
|
|
||||||
###### NOTE
|
|
||||||
The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has known issues with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665).
|
|
||||||
|
|
||||||
#### Form data
|
|
||||||
|
|
||||||
In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const FormData = require('form-data');
|
|
||||||
|
|
||||||
const form = new FormData();
|
|
||||||
form.append('my_field', 'my value');
|
|
||||||
form.append('my_buffer', new Buffer(10));
|
|
||||||
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
|
||||||
|
|
||||||
axios.post('https://example.com', form, { headers: form.getHeaders() })
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, use an interceptor:
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.interceptors.request.use(config => {
|
|
||||||
if (config.data instanceof FormData) {
|
|
||||||
Object.assign(config.headers, config.data.getHeaders());
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Semver
|
|
||||||
|
|
||||||
Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
|
|
||||||
|
|
||||||
## Promises
|
|
||||||
|
|
||||||
axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
|
|
||||||
If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
|
|
||||||
|
|
||||||
## TypeScript
|
|
||||||
|
|
||||||
axios includes [TypeScript](http://typescriptlang.org) definitions and a type guard for axios errors.
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
let user: User = null;
|
|
||||||
try {
|
|
||||||
const { data } = await axios.get('/user?ID=12345');
|
|
||||||
user = data.userDetails;
|
|
||||||
} catch (error) {
|
|
||||||
if (axios.isAxiosError(error)) {
|
|
||||||
handleAxiosError(error);
|
|
||||||
} else {
|
|
||||||
handleUnexpectedError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Online one-click setup
|
|
||||||
|
|
||||||
You can use Gitpod an online IDE(which is free for Open Source) for contributing or running the examples online.
|
|
||||||
|
|
||||||
[](https://gitpod.io/#https://github.com/axios/axios/blob/master/examples/server.js)
|
|
||||||
|
|
||||||
|
|
||||||
## Resources
|
|
||||||
|
|
||||||
* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
|
|
||||||
* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
|
|
||||||
* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
|
|
||||||
* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
|
|
||||||
* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [AngularJS](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of AngularJS.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
5
node_modules/axios/SECURITY.md
generated
vendored
5
node_modules/axios/SECURITY.md
generated
vendored
@@ -1,5 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
|
||||||
|
|
||||||
Please report security issues to jasonsaayman@gmail.com
|
|
||||||
168
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
168
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
@@ -1,168 +0,0 @@
|
|||||||
# Upgrade Guide
|
|
||||||
|
|
||||||
### 0.18.x -> 0.19.0
|
|
||||||
|
|
||||||
#### HTTPS Proxies
|
|
||||||
|
|
||||||
Routing through an https proxy now requires setting the `protocol` attribute of the proxy configuration to `https`
|
|
||||||
|
|
||||||
### 0.15.x -> 0.16.0
|
|
||||||
|
|
||||||
#### `Promise` Type Declarations
|
|
||||||
|
|
||||||
The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
|
|
||||||
|
|
||||||
### 0.13.x -> 0.14.0
|
|
||||||
|
|
||||||
#### TypeScript Definitions
|
|
||||||
|
|
||||||
The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
|
|
||||||
|
|
||||||
Please use the following `import` statement to import axios in TypeScript:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
axios.get('/foo')
|
|
||||||
.then(response => console.log(response))
|
|
||||||
.catch(error => console.log(error));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `agent` Config Option
|
|
||||||
|
|
||||||
The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
// Define a custom agent for HTTP
|
|
||||||
httpAgent: new http.Agent({ keepAlive: true }),
|
|
||||||
// Define a custom agent for HTTPS
|
|
||||||
httpsAgent: new https.Agent({ keepAlive: true })
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `progress` Config Option
|
|
||||||
|
|
||||||
The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
// Define a handler for upload progress events
|
|
||||||
onUploadProgress: function (progressEvent) {
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
|
|
||||||
// Define a handler for download progress events
|
|
||||||
onDownloadProgress: function (progressEvent) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 0.12.x -> 0.13.0
|
|
||||||
|
|
||||||
The `0.13.0` release contains several changes to custom adapters and error handling.
|
|
||||||
|
|
||||||
#### Error Handling
|
|
||||||
|
|
||||||
Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.get('/user/12345')
|
|
||||||
.catch((error) => {
|
|
||||||
console.log(error.message);
|
|
||||||
console.log(error.code); // Not always specified
|
|
||||||
console.log(error.config); // The config that was used to make the request
|
|
||||||
console.log(error.response); // Only available if response was received from the server
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Request Adapters
|
|
||||||
|
|
||||||
This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
|
|
||||||
|
|
||||||
1. Response transformer is now called outside of adapter.
|
|
||||||
2. Request adapter returns a `Promise`.
|
|
||||||
|
|
||||||
This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter.
|
|
||||||
|
|
||||||
Previous code:
|
|
||||||
|
|
||||||
```js
|
|
||||||
function myAdapter(resolve, reject, config) {
|
|
||||||
var response = {
|
|
||||||
data: transformData(
|
|
||||||
responseData,
|
|
||||||
responseHeaders,
|
|
||||||
config.transformResponse
|
|
||||||
),
|
|
||||||
status: request.status,
|
|
||||||
statusText: request.statusText,
|
|
||||||
headers: responseHeaders
|
|
||||||
};
|
|
||||||
settle(resolve, reject, response);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
New code:
|
|
||||||
|
|
||||||
```js
|
|
||||||
function myAdapter(config) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var response = {
|
|
||||||
data: responseData,
|
|
||||||
status: request.status,
|
|
||||||
statusText: request.statusText,
|
|
||||||
headers: responseHeaders
|
|
||||||
};
|
|
||||||
settle(resolve, reject, response);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
See the related commits for more details:
|
|
||||||
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
|
|
||||||
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
|
|
||||||
|
|
||||||
### 0.5.x -> 0.6.0
|
|
||||||
|
|
||||||
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
|
|
||||||
|
|
||||||
#### ES6 Promise Polyfill
|
|
||||||
|
|
||||||
Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.
|
|
||||||
|
|
||||||
```js
|
|
||||||
require('es6-promise').polyfill();
|
|
||||||
var axios = require('axios');
|
|
||||||
```
|
|
||||||
|
|
||||||
This will polyfill the global environment, and only needs to be done once.
|
|
||||||
|
|
||||||
#### `axios.success`/`axios.error`
|
|
||||||
|
|
||||||
The `success`, and `error` aliases were deprecated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
|
|
||||||
|
|
||||||
```js
|
|
||||||
axios.get('some/url')
|
|
||||||
.then(function (res) {
|
|
||||||
/* ... */
|
|
||||||
})
|
|
||||||
.catch(function (err) {
|
|
||||||
/* ... */
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### UMD
|
|
||||||
|
|
||||||
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// AMD
|
|
||||||
require(['bower_components/axios/dist/axios'], function (axios) {
|
|
||||||
/* ... */
|
|
||||||
});
|
|
||||||
|
|
||||||
// CommonJS
|
|
||||||
var axios = require('axios/dist/axios');
|
|
||||||
```
|
|
||||||
221
node_modules/axios/index.d.ts
generated
vendored
221
node_modules/axios/index.d.ts
generated
vendored
@@ -1,221 +0,0 @@
|
|||||||
// TypeScript Version: 3.0
|
|
||||||
|
|
||||||
export type AxiosRequestHeaders = Record<string, string | number | boolean>;
|
|
||||||
|
|
||||||
export type AxiosResponseHeaders = Record<string, string> & {
|
|
||||||
"set-cookie"?: string[]
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface AxiosRequestTransformer {
|
|
||||||
(data: any, headers?: AxiosRequestHeaders): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosResponseTransformer {
|
|
||||||
(data: any, headers?: AxiosResponseHeaders): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosAdapter {
|
|
||||||
(config: AxiosRequestConfig): AxiosPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosBasicCredentials {
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosProxyConfig {
|
|
||||||
host: string;
|
|
||||||
port: number;
|
|
||||||
auth?: {
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
};
|
|
||||||
protocol?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Method =
|
|
||||||
| 'get' | 'GET'
|
|
||||||
| 'delete' | 'DELETE'
|
|
||||||
| 'head' | 'HEAD'
|
|
||||||
| 'options' | 'OPTIONS'
|
|
||||||
| 'post' | 'POST'
|
|
||||||
| 'put' | 'PUT'
|
|
||||||
| 'patch' | 'PATCH'
|
|
||||||
| 'purge' | 'PURGE'
|
|
||||||
| 'link' | 'LINK'
|
|
||||||
| 'unlink' | 'UNLINK';
|
|
||||||
|
|
||||||
export type ResponseType =
|
|
||||||
| 'arraybuffer'
|
|
||||||
| 'blob'
|
|
||||||
| 'document'
|
|
||||||
| 'json'
|
|
||||||
| 'text'
|
|
||||||
| 'stream';
|
|
||||||
|
|
||||||
export type responseEncoding =
|
|
||||||
| 'ascii' | 'ASCII'
|
|
||||||
| 'ansi' | 'ANSI'
|
|
||||||
| 'binary' | 'BINARY'
|
|
||||||
| 'base64' | 'BASE64'
|
|
||||||
| 'base64url' | 'BASE64URL'
|
|
||||||
| 'hex' | 'HEX'
|
|
||||||
| 'latin1' | 'LATIN1'
|
|
||||||
| 'ucs-2' | 'UCS-2'
|
|
||||||
| 'ucs2' | 'UCS2'
|
|
||||||
| 'utf-8' | 'UTF-8'
|
|
||||||
| 'utf8' | 'UTF8'
|
|
||||||
| 'utf16le' | 'UTF16LE';
|
|
||||||
|
|
||||||
export interface TransitionalOptions {
|
|
||||||
silentJSONParsing?: boolean;
|
|
||||||
forcedJSONParsing?: boolean;
|
|
||||||
clarifyTimeoutError?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosRequestConfig<D = any> {
|
|
||||||
url?: string;
|
|
||||||
method?: Method;
|
|
||||||
baseURL?: string;
|
|
||||||
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
|
||||||
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
|
||||||
headers?: AxiosRequestHeaders;
|
|
||||||
params?: any;
|
|
||||||
paramsSerializer?: (params: any) => string;
|
|
||||||
data?: D;
|
|
||||||
timeout?: number;
|
|
||||||
timeoutErrorMessage?: string;
|
|
||||||
withCredentials?: boolean;
|
|
||||||
adapter?: AxiosAdapter;
|
|
||||||
auth?: AxiosBasicCredentials;
|
|
||||||
responseType?: ResponseType;
|
|
||||||
responseEncoding?: responseEncoding | string;
|
|
||||||
xsrfCookieName?: string;
|
|
||||||
xsrfHeaderName?: string;
|
|
||||||
onUploadProgress?: (progressEvent: any) => void;
|
|
||||||
onDownloadProgress?: (progressEvent: any) => void;
|
|
||||||
maxContentLength?: number;
|
|
||||||
validateStatus?: ((status: number) => boolean) | null;
|
|
||||||
maxBodyLength?: number;
|
|
||||||
maxRedirects?: number;
|
|
||||||
socketPath?: string | null;
|
|
||||||
httpAgent?: any;
|
|
||||||
httpsAgent?: any;
|
|
||||||
proxy?: AxiosProxyConfig | false;
|
|
||||||
cancelToken?: CancelToken;
|
|
||||||
decompress?: boolean;
|
|
||||||
transitional?: TransitionalOptions;
|
|
||||||
signal?: AbortSignal;
|
|
||||||
insecureHTTPParser?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HeadersDefaults {
|
|
||||||
common: AxiosRequestHeaders;
|
|
||||||
delete: AxiosRequestHeaders;
|
|
||||||
get: AxiosRequestHeaders;
|
|
||||||
head: AxiosRequestHeaders;
|
|
||||||
post: AxiosRequestHeaders;
|
|
||||||
put: AxiosRequestHeaders;
|
|
||||||
patch: AxiosRequestHeaders;
|
|
||||||
options?: AxiosRequestHeaders;
|
|
||||||
purge?: AxiosRequestHeaders;
|
|
||||||
link?: AxiosRequestHeaders;
|
|
||||||
unlink?: AxiosRequestHeaders;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
|
||||||
headers: HeadersDefaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosResponse<T = any, D = any> {
|
|
||||||
data: T;
|
|
||||||
status: number;
|
|
||||||
statusText: string;
|
|
||||||
headers: AxiosResponseHeaders;
|
|
||||||
config: AxiosRequestConfig<D>;
|
|
||||||
request?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosError<T = any, D = any> extends Error {
|
|
||||||
config: AxiosRequestConfig<D>;
|
|
||||||
code?: string;
|
|
||||||
request?: any;
|
|
||||||
response?: AxiosResponse<T, D>;
|
|
||||||
isAxiosError: boolean;
|
|
||||||
toJSON: () => object;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CancelStatic {
|
|
||||||
new (message?: string): Cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Cancel {
|
|
||||||
message: string | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Canceler {
|
|
||||||
(message?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CancelTokenStatic {
|
|
||||||
new (executor: (cancel: Canceler) => void): CancelToken;
|
|
||||||
source(): CancelTokenSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CancelToken {
|
|
||||||
promise: Promise<Cancel>;
|
|
||||||
reason?: Cancel;
|
|
||||||
throwIfRequested(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CancelTokenSource {
|
|
||||||
token: CancelToken;
|
|
||||||
cancel: Canceler;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosInterceptorManager<V> {
|
|
||||||
use<T = V>(onFulfilled?: (value: V) => T | Promise<T>, onRejected?: (error: any) => any): number;
|
|
||||||
eject(id: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Axios {
|
|
||||||
constructor(config?: AxiosRequestConfig);
|
|
||||||
defaults: AxiosDefaults;
|
|
||||||
interceptors: {
|
|
||||||
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
|
||||||
response: AxiosInterceptorManager<AxiosResponse>;
|
|
||||||
};
|
|
||||||
getUri(config?: AxiosRequestConfig): string;
|
|
||||||
request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosInstance extends Axios {
|
|
||||||
(config: AxiosRequestConfig): AxiosPromise;
|
|
||||||
(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AxiosStatic extends AxiosInstance {
|
|
||||||
create(config?: AxiosRequestConfig): AxiosInstance;
|
|
||||||
Cancel: CancelStatic;
|
|
||||||
CancelToken: CancelTokenStatic;
|
|
||||||
Axios: typeof Axios;
|
|
||||||
readonly VERSION: string;
|
|
||||||
isCancel(value: any): boolean;
|
|
||||||
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
|
||||||
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
|
||||||
isAxiosError(payload: any): payload is AxiosError;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare const axios: AxiosStatic;
|
|
||||||
|
|
||||||
export default axios;
|
|
||||||
1
node_modules/axios/index.js
generated
vendored
1
node_modules/axios/index.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
module.exports = require('./lib/axios');
|
|
||||||
37
node_modules/axios/lib/adapters/README.md
generated
vendored
37
node_modules/axios/lib/adapters/README.md
generated
vendored
@@ -1,37 +0,0 @@
|
|||||||
# axios // adapters
|
|
||||||
|
|
||||||
The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```js
|
|
||||||
var settle = require('./../core/settle');
|
|
||||||
|
|
||||||
module.exports = function myAdapter(config) {
|
|
||||||
// At this point:
|
|
||||||
// - config has been merged with defaults
|
|
||||||
// - request transformers have already run
|
|
||||||
// - request interceptors have already run
|
|
||||||
|
|
||||||
// Make the request using config provided
|
|
||||||
// Upon response settle the Promise
|
|
||||||
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
|
|
||||||
var response = {
|
|
||||||
data: responseData,
|
|
||||||
status: request.status,
|
|
||||||
statusText: request.statusText,
|
|
||||||
headers: responseHeaders,
|
|
||||||
config: config,
|
|
||||||
request: request
|
|
||||||
};
|
|
||||||
|
|
||||||
settle(resolve, reject, response);
|
|
||||||
|
|
||||||
// From here:
|
|
||||||
// - response transformers will run
|
|
||||||
// - response interceptors will run
|
|
||||||
});
|
|
||||||
}
|
|
||||||
```
|
|
||||||
404
node_modules/axios/lib/adapters/http.js
generated
vendored
404
node_modules/axios/lib/adapters/http.js
generated
vendored
@@ -1,404 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./../utils');
|
|
||||||
var settle = require('./../core/settle');
|
|
||||||
var buildFullPath = require('../core/buildFullPath');
|
|
||||||
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 VERSION = require('./../env/data').version;
|
|
||||||
var createError = require('../core/createError');
|
|
||||||
var enhanceError = require('../core/enhanceError');
|
|
||||||
var transitionalDefaults = require('../defaults/transitional');
|
|
||||||
var Cancel = require('../cancel/Cancel');
|
|
||||||
|
|
||||||
var isHttps = /https:?/;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {http.ClientRequestArgs} options
|
|
||||||
* @param {AxiosProxyConfig} proxy
|
|
||||||
* @param {string} location
|
|
||||||
*/
|
|
||||||
function setProxy(options, proxy, location) {
|
|
||||||
options.hostname = proxy.host;
|
|
||||||
options.host = proxy.host;
|
|
||||||
options.port = proxy.port;
|
|
||||||
options.path = location;
|
|
||||||
|
|
||||||
// Basic proxy authorization
|
|
||||||
if (proxy.auth) {
|
|
||||||
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
|
||||||
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a proxy is used, any redirects must also pass through the proxy
|
|
||||||
options.beforeRedirect = function beforeRedirect(redirection) {
|
|
||||||
redirection.headers.host = redirection.host;
|
|
||||||
setProxy(redirection, proxy, redirection.href);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*eslint consistent-return:0*/
|
|
||||||
module.exports = function httpAdapter(config) {
|
|
||||||
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|
||||||
var onCanceled;
|
|
||||||
function done() {
|
|
||||||
if (config.cancelToken) {
|
|
||||||
config.cancelToken.unsubscribe(onCanceled);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.signal) {
|
|
||||||
config.signal.removeEventListener('abort', onCanceled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var resolve = function resolve(value) {
|
|
||||||
done();
|
|
||||||
resolvePromise(value);
|
|
||||||
};
|
|
||||||
var rejected = false;
|
|
||||||
var reject = function reject(value) {
|
|
||||||
done();
|
|
||||||
rejected = true;
|
|
||||||
rejectPromise(value);
|
|
||||||
};
|
|
||||||
var data = config.data;
|
|
||||||
var headers = config.headers;
|
|
||||||
var headerNames = {};
|
|
||||||
|
|
||||||
Object.keys(headers).forEach(function storeLowerName(name) {
|
|
||||||
headerNames[name.toLowerCase()] = name;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set User-Agent (required by some servers)
|
|
||||||
// See https://github.com/axios/axios/issues/69
|
|
||||||
if ('user-agent' in headerNames) {
|
|
||||||
// User-Agent is specified; handle case where no UA header is desired
|
|
||||||
if (!headers[headerNames['user-agent']]) {
|
|
||||||
delete headers[headerNames['user-agent']];
|
|
||||||
}
|
|
||||||
// Otherwise, use specified value
|
|
||||||
} else {
|
|
||||||
// Only set header if it hasn't been set in config
|
|
||||||
headers['User-Agent'] = 'axios/' + VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data && !utils.isStream(data)) {
|
|
||||||
if (Buffer.isBuffer(data)) {
|
|
||||||
// Nothing to do...
|
|
||||||
} else if (utils.isArrayBuffer(data)) {
|
|
||||||
data = Buffer.from(new Uint8Array(data));
|
|
||||||
} else if (utils.isString(data)) {
|
|
||||||
data = Buffer.from(data, 'utf-8');
|
|
||||||
} else {
|
|
||||||
return reject(createError(
|
|
||||||
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
|
||||||
config
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
|
||||||
return reject(createError('Request body larger than maxBodyLength limit', config));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Content-Length header if data exists
|
|
||||||
if (!headerNames['content-length']) {
|
|
||||||
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 fullPath = buildFullPath(config.baseURL, config.url);
|
|
||||||
var parsed = url.parse(fullPath);
|
|
||||||
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 && headerNames.authorization) {
|
|
||||||
delete headers[headerNames.authorization];
|
|
||||||
}
|
|
||||||
|
|
||||||
var isHttpsRequest = isHttps.test(protocol);
|
|
||||||
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
|
||||||
|
|
||||||
try {
|
|
||||||
buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, '');
|
|
||||||
} catch (err) {
|
|
||||||
var customErr = new Error(err.message);
|
|
||||||
customErr.config = config;
|
|
||||||
customErr.url = config.url;
|
|
||||||
customErr.exists = true;
|
|
||||||
reject(customErr);
|
|
||||||
}
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
|
||||||
method: config.method.toUpperCase(),
|
|
||||||
headers: headers,
|
|
||||||
agent: agent,
|
|
||||||
agents: { http: config.httpAgent, https: config.httpsAgent },
|
|
||||||
auth: auth
|
|
||||||
};
|
|
||||||
|
|
||||||
if (config.socketPath) {
|
|
||||||
options.socketPath = config.socketPath;
|
|
||||||
} else {
|
|
||||||
options.hostname = parsed.hostname;
|
|
||||||
options.port = parsed.port;
|
|
||||||
}
|
|
||||||
|
|
||||||
var proxy = config.proxy;
|
|
||||||
if (!proxy && proxy !== false) {
|
|
||||||
var proxyEnv = protocol.slice(0, -1) + '_proxy';
|
|
||||||
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
|
|
||||||
if (proxyUrl) {
|
|
||||||
var parsedProxyUrl = url.parse(proxyUrl);
|
|
||||||
var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
|
|
||||||
var shouldProxy = true;
|
|
||||||
|
|
||||||
if (noProxyEnv) {
|
|
||||||
var noProxy = noProxyEnv.split(',').map(function trim(s) {
|
|
||||||
return s.trim();
|
|
||||||
});
|
|
||||||
|
|
||||||
shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
|
|
||||||
if (!proxyElement) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (proxyElement === '*') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (proxyElement[0] === '.' &&
|
|
||||||
parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parsed.hostname === proxyElement;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldProxy) {
|
|
||||||
proxy = {
|
|
||||||
host: parsedProxyUrl.hostname,
|
|
||||||
port: parsedProxyUrl.port,
|
|
||||||
protocol: parsedProxyUrl.protocol
|
|
||||||
};
|
|
||||||
|
|
||||||
if (parsedProxyUrl.auth) {
|
|
||||||
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
|
|
||||||
proxy.auth = {
|
|
||||||
username: proxyUrlAuth[0],
|
|
||||||
password: proxyUrlAuth[1]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (proxy) {
|
|
||||||
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
|
|
||||||
setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
|
||||||
}
|
|
||||||
|
|
||||||
var transport;
|
|
||||||
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
|
|
||||||
if (config.transport) {
|
|
||||||
transport = config.transport;
|
|
||||||
} else if (config.maxRedirects === 0) {
|
|
||||||
transport = isHttpsProxy ? https : http;
|
|
||||||
} else {
|
|
||||||
if (config.maxRedirects) {
|
|
||||||
options.maxRedirects = config.maxRedirects;
|
|
||||||
}
|
|
||||||
transport = isHttpsProxy ? httpsFollow : httpFollow;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.maxBodyLength > -1) {
|
|
||||||
options.maxBodyLength = config.maxBodyLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.insecureHTTPParser) {
|
|
||||||
options.insecureHTTPParser = config.insecureHTTPParser;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the request
|
|
||||||
var req = transport.request(options, function handleResponse(res) {
|
|
||||||
if (req.aborted) return;
|
|
||||||
|
|
||||||
// uncompress the response body transparently if required
|
|
||||||
var stream = res;
|
|
||||||
|
|
||||||
// return the last request in case of redirects
|
|
||||||
var lastRequest = res.req || req;
|
|
||||||
|
|
||||||
|
|
||||||
// if no content, is HEAD request or decompress disabled we should not decompress
|
|
||||||
if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = [];
|
|
||||||
var totalResponseBytes = 0;
|
|
||||||
stream.on('data', function handleStreamData(chunk) {
|
|
||||||
responseBuffer.push(chunk);
|
|
||||||
totalResponseBytes += chunk.length;
|
|
||||||
|
|
||||||
// make sure the content length is not over the maxContentLength if specified
|
|
||||||
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
|
|
||||||
// stream.destoy() emit aborted event before calling reject() on Node.js v16
|
|
||||||
rejected = true;
|
|
||||||
stream.destroy();
|
|
||||||
reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
||||||
config, null, lastRequest));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
stream.on('aborted', function handlerStreamAborted() {
|
|
||||||
if (rejected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
stream.destroy();
|
|
||||||
reject(createError('error request aborted', config, 'ERR_REQUEST_ABORTED', lastRequest));
|
|
||||||
});
|
|
||||||
|
|
||||||
stream.on('error', function handleStreamError(err) {
|
|
||||||
if (req.aborted) return;
|
|
||||||
reject(enhanceError(err, config, null, lastRequest));
|
|
||||||
});
|
|
||||||
|
|
||||||
stream.on('end', function handleStreamEnd() {
|
|
||||||
try {
|
|
||||||
var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
|
||||||
if (config.responseType !== 'arraybuffer') {
|
|
||||||
responseData = responseData.toString(config.responseEncoding);
|
|
||||||
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
|
|
||||||
responseData = utils.stripBOM(responseData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
response.data = responseData;
|
|
||||||
} catch (err) {
|
|
||||||
reject(enhanceError(err, config, err.code, response.request, response));
|
|
||||||
}
|
|
||||||
settle(resolve, reject, response);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle errors
|
|
||||||
req.on('error', function handleRequestError(err) {
|
|
||||||
if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
|
|
||||||
reject(enhanceError(err, config, null, req));
|
|
||||||
});
|
|
||||||
|
|
||||||
// set tcp keep alive to prevent drop connection by peer
|
|
||||||
req.on('socket', function handleRequestSocket(socket) {
|
|
||||||
// default interval of sending ack packet is 1 minute
|
|
||||||
socket.setKeepAlive(true, 1000 * 60);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle request timeout
|
|
||||||
if (config.timeout) {
|
|
||||||
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
|
||||||
var timeout = parseInt(config.timeout, 10);
|
|
||||||
|
|
||||||
if (isNaN(timeout)) {
|
|
||||||
reject(createError(
|
|
||||||
'error trying to parse `config.timeout` to int',
|
|
||||||
config,
|
|
||||||
'ERR_PARSE_TIMEOUT',
|
|
||||||
req
|
|
||||||
));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
|
|
||||||
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
|
|
||||||
// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
|
|
||||||
// And then these socket which be hang up will devoring CPU little by little.
|
|
||||||
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
|
||||||
req.setTimeout(timeout, function handleRequestTimeout() {
|
|
||||||
req.abort();
|
|
||||||
var timeoutErrorMessage = '';
|
|
||||||
if (config.timeoutErrorMessage) {
|
|
||||||
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
||||||
} else {
|
|
||||||
timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
|
||||||
}
|
|
||||||
var transitional = config.transitional || transitionalDefaults;
|
|
||||||
reject(createError(
|
|
||||||
timeoutErrorMessage,
|
|
||||||
config,
|
|
||||||
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
||||||
req
|
|
||||||
));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.cancelToken || config.signal) {
|
|
||||||
// Handle cancellation
|
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
onCanceled = function(cancel) {
|
|
||||||
if (req.aborted) return;
|
|
||||||
|
|
||||||
req.abort();
|
|
||||||
reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
|
|
||||||
};
|
|
||||||
|
|
||||||
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
||||||
if (config.signal) {
|
|
||||||
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Send the request
|
|
||||||
if (utils.isStream(data)) {
|
|
||||||
data.on('error', function handleStreamError(err) {
|
|
||||||
reject(enhanceError(err, config, null, req));
|
|
||||||
}).pipe(req);
|
|
||||||
} else {
|
|
||||||
req.end(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
212
node_modules/axios/lib/adapters/xhr.js
generated
vendored
212
node_modules/axios/lib/adapters/xhr.js
generated
vendored
@@ -1,212 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./../utils');
|
|
||||||
var settle = require('./../core/settle');
|
|
||||||
var cookies = require('./../helpers/cookies');
|
|
||||||
var buildURL = require('./../helpers/buildURL');
|
|
||||||
var buildFullPath = require('../core/buildFullPath');
|
|
||||||
var parseHeaders = require('./../helpers/parseHeaders');
|
|
||||||
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
|
||||||
var createError = require('../core/createError');
|
|
||||||
var transitionalDefaults = require('../defaults/transitional');
|
|
||||||
var Cancel = require('../cancel/Cancel');
|
|
||||||
|
|
||||||
module.exports = function xhrAdapter(config) {
|
|
||||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
||||||
var requestData = config.data;
|
|
||||||
var requestHeaders = config.headers;
|
|
||||||
var responseType = config.responseType;
|
|
||||||
var onCanceled;
|
|
||||||
function done() {
|
|
||||||
if (config.cancelToken) {
|
|
||||||
config.cancelToken.unsubscribe(onCanceled);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.signal) {
|
|
||||||
config.signal.removeEventListener('abort', onCanceled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (utils.isFormData(requestData)) {
|
|
||||||
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
||||||
}
|
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
|
||||||
|
|
||||||
// HTTP basic authentication
|
|
||||||
if (config.auth) {
|
|
||||||
var username = config.auth.username || '';
|
|
||||||
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
||||||
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
||||||
}
|
|
||||||
|
|
||||||
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
||||||
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
||||||
|
|
||||||
// Set the request timeout in MS
|
|
||||||
request.timeout = config.timeout;
|
|
||||||
|
|
||||||
function onloadend() {
|
|
||||||
if (!request) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Prepare the response
|
|
||||||
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|
||||||
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
||||||
request.responseText : request.response;
|
|
||||||
var response = {
|
|
||||||
data: responseData,
|
|
||||||
status: request.status,
|
|
||||||
statusText: request.statusText,
|
|
||||||
headers: responseHeaders,
|
|
||||||
config: config,
|
|
||||||
request: request
|
|
||||||
};
|
|
||||||
|
|
||||||
settle(function _resolve(value) {
|
|
||||||
resolve(value);
|
|
||||||
done();
|
|
||||||
}, function _reject(err) {
|
|
||||||
reject(err);
|
|
||||||
done();
|
|
||||||
}, response);
|
|
||||||
|
|
||||||
// Clean up request
|
|
||||||
request = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('onloadend' in request) {
|
|
||||||
// Use onloadend if available
|
|
||||||
request.onloadend = onloadend;
|
|
||||||
} else {
|
|
||||||
// Listen for ready state to emulate onloadend
|
|
||||||
request.onreadystatechange = function handleLoad() {
|
|
||||||
if (!request || request.readyState !== 4) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The request errored out and we didn't get a response, this will be
|
|
||||||
// handled by onerror instead
|
|
||||||
// With one exception: request that using file: protocol, most browsers
|
|
||||||
// will return status as 0 even though it's a successful request
|
|
||||||
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// readystate handler is calling before onerror or ontimeout handlers,
|
|
||||||
// so we should call onloadend on the next 'tick'
|
|
||||||
setTimeout(onloadend);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
||||||
request.onabort = function handleAbort() {
|
|
||||||
if (!request) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
|
||||||
|
|
||||||
// Clean up request
|
|
||||||
request = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Handle low level network errors
|
|
||||||
request.onerror = function handleError() {
|
|
||||||
// Real errors are hidden from us by the browser
|
|
||||||
// onerror should only fire if it's a network error
|
|
||||||
reject(createError('Network Error', config, null, request));
|
|
||||||
|
|
||||||
// Clean up request
|
|
||||||
request = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Handle timeout
|
|
||||||
request.ontimeout = function handleTimeout() {
|
|
||||||
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
||||||
var transitional = config.transitional || transitionalDefaults;
|
|
||||||
if (config.timeoutErrorMessage) {
|
|
||||||
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
||||||
}
|
|
||||||
reject(createError(
|
|
||||||
timeoutErrorMessage,
|
|
||||||
config,
|
|
||||||
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : '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()) {
|
|
||||||
// Add xsrf header
|
|
||||||
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && 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 (!utils.isUndefined(config.withCredentials)) {
|
|
||||||
request.withCredentials = !!config.withCredentials;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add responseType to request if needed
|
|
||||||
if (responseType && responseType !== 'json') {
|
|
||||||
request.responseType = config.responseType;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 || config.signal) {
|
|
||||||
// Handle cancellation
|
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
onCanceled = function(cancel) {
|
|
||||||
if (!request) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
|
|
||||||
request.abort();
|
|
||||||
request = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
||||||
if (config.signal) {
|
|
||||||
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!requestData) {
|
|
||||||
requestData = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the request
|
|
||||||
request.send(requestData);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
57
node_modules/axios/lib/axios.js
generated
vendored
57
node_modules/axios/lib/axios.js
generated
vendored
@@ -1,57 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./utils');
|
|
||||||
var bind = require('./helpers/bind');
|
|
||||||
var Axios = require('./core/Axios');
|
|
||||||
var mergeConfig = require('./core/mergeConfig');
|
|
||||||
var defaults = require('./defaults');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an instance of Axios
|
|
||||||
*
|
|
||||||
* @param {Object} defaultConfig The default config for the instance
|
|
||||||
* @return {Axios} A new instance of Axios
|
|
||||||
*/
|
|
||||||
function createInstance(defaultConfig) {
|
|
||||||
var context = new Axios(defaultConfig);
|
|
||||||
var instance = bind(Axios.prototype.request, context);
|
|
||||||
|
|
||||||
// Copy axios.prototype to instance
|
|
||||||
utils.extend(instance, Axios.prototype, context);
|
|
||||||
|
|
||||||
// Copy context to instance
|
|
||||||
utils.extend(instance, context);
|
|
||||||
|
|
||||||
// Factory for creating new instances
|
|
||||||
instance.create = function create(instanceConfig) {
|
|
||||||
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
||||||
};
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the default instance to be exported
|
|
||||||
var axios = createInstance(defaults);
|
|
||||||
|
|
||||||
// Expose Axios class to allow class inheritance
|
|
||||||
axios.Axios = Axios;
|
|
||||||
|
|
||||||
// Expose Cancel & CancelToken
|
|
||||||
axios.Cancel = require('./cancel/Cancel');
|
|
||||||
axios.CancelToken = require('./cancel/CancelToken');
|
|
||||||
axios.isCancel = require('./cancel/isCancel');
|
|
||||||
axios.VERSION = require('./env/data').version;
|
|
||||||
|
|
||||||
// Expose all/spread
|
|
||||||
axios.all = function all(promises) {
|
|
||||||
return Promise.all(promises);
|
|
||||||
};
|
|
||||||
axios.spread = require('./helpers/spread');
|
|
||||||
|
|
||||||
// Expose isAxiosError
|
|
||||||
axios.isAxiosError = require('./helpers/isAxiosError');
|
|
||||||
|
|
||||||
module.exports = axios;
|
|
||||||
|
|
||||||
// Allow use of default import syntax in TypeScript
|
|
||||||
module.exports.default = axios;
|
|
||||||
19
node_modules/axios/lib/cancel/Cancel.js
generated
vendored
19
node_modules/axios/lib/cancel/Cancel.js
generated
vendored
@@ -1,19 +0,0 @@
|
|||||||
'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;
|
|
||||||
119
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
119
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
@@ -1,119 +0,0 @@
|
|||||||
'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;
|
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
this.promise.then(function(cancel) {
|
|
||||||
if (!token._listeners) return;
|
|
||||||
|
|
||||||
var i;
|
|
||||||
var l = token._listeners.length;
|
|
||||||
|
|
||||||
for (i = 0; i < l; i++) {
|
|
||||||
token._listeners[i](cancel);
|
|
||||||
}
|
|
||||||
token._listeners = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
this.promise.then = function(onfulfilled) {
|
|
||||||
var _resolve;
|
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
var promise = new Promise(function(resolve) {
|
|
||||||
token.subscribe(resolve);
|
|
||||||
_resolve = resolve;
|
|
||||||
}).then(onfulfilled);
|
|
||||||
|
|
||||||
promise.cancel = function reject() {
|
|
||||||
token.unsubscribe(_resolve);
|
|
||||||
};
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subscribe to the cancel signal
|
|
||||||
*/
|
|
||||||
|
|
||||||
CancelToken.prototype.subscribe = function subscribe(listener) {
|
|
||||||
if (this.reason) {
|
|
||||||
listener(this.reason);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._listeners) {
|
|
||||||
this._listeners.push(listener);
|
|
||||||
} else {
|
|
||||||
this._listeners = [listener];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unsubscribe from the cancel signal
|
|
||||||
*/
|
|
||||||
|
|
||||||
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
|
||||||
if (!this._listeners) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var index = this._listeners.indexOf(listener);
|
|
||||||
if (index !== -1) {
|
|
||||||
this._listeners.splice(index, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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/axios/lib/cancel/isCancel.js
generated
vendored
5
node_modules/axios/lib/cancel/isCancel.js
generated
vendored
@@ -1,5 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = function isCancel(value) {
|
|
||||||
return !!(value && value.__CANCEL__);
|
|
||||||
};
|
|
||||||
148
node_modules/axios/lib/core/Axios.js
generated
vendored
148
node_modules/axios/lib/core/Axios.js
generated
vendored
@@ -1,148 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./../utils');
|
|
||||||
var buildURL = require('../helpers/buildURL');
|
|
||||||
var InterceptorManager = require('./InterceptorManager');
|
|
||||||
var dispatchRequest = require('./dispatchRequest');
|
|
||||||
var mergeConfig = require('./mergeConfig');
|
|
||||||
var validator = require('../helpers/validator');
|
|
||||||
|
|
||||||
var validators = validator.validators;
|
|
||||||
/**
|
|
||||||
* 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(configOrUrl, config) {
|
|
||||||
/*eslint no-param-reassign:0*/
|
|
||||||
// Allow for axios('example/url'[, config]) a la fetch API
|
|
||||||
if (typeof configOrUrl === 'string') {
|
|
||||||
config = config || {};
|
|
||||||
config.url = configOrUrl;
|
|
||||||
} else {
|
|
||||||
config = configOrUrl || {};
|
|
||||||
}
|
|
||||||
|
|
||||||
config = mergeConfig(this.defaults, config);
|
|
||||||
|
|
||||||
// Set config.method
|
|
||||||
if (config.method) {
|
|
||||||
config.method = config.method.toLowerCase();
|
|
||||||
} else if (this.defaults.method) {
|
|
||||||
config.method = this.defaults.method.toLowerCase();
|
|
||||||
} else {
|
|
||||||
config.method = 'get';
|
|
||||||
}
|
|
||||||
|
|
||||||
var transitional = config.transitional;
|
|
||||||
|
|
||||||
if (transitional !== undefined) {
|
|
||||||
validator.assertOptions(transitional, {
|
|
||||||
silentJSONParsing: validators.transitional(validators.boolean),
|
|
||||||
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
||||||
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// filter out skipped interceptors
|
|
||||||
var requestInterceptorChain = [];
|
|
||||||
var synchronousRequestInterceptors = true;
|
|
||||||
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
||||||
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
||||||
|
|
||||||
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
||||||
});
|
|
||||||
|
|
||||||
var responseInterceptorChain = [];
|
|
||||||
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
||||||
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
||||||
});
|
|
||||||
|
|
||||||
var promise;
|
|
||||||
|
|
||||||
if (!synchronousRequestInterceptors) {
|
|
||||||
var chain = [dispatchRequest, undefined];
|
|
||||||
|
|
||||||
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
||||||
chain = chain.concat(responseInterceptorChain);
|
|
||||||
|
|
||||||
promise = Promise.resolve(config);
|
|
||||||
while (chain.length) {
|
|
||||||
promise = promise.then(chain.shift(), chain.shift());
|
|
||||||
}
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var newConfig = config;
|
|
||||||
while (requestInterceptorChain.length) {
|
|
||||||
var onFulfilled = requestInterceptorChain.shift();
|
|
||||||
var onRejected = requestInterceptorChain.shift();
|
|
||||||
try {
|
|
||||||
newConfig = onFulfilled(newConfig);
|
|
||||||
} catch (error) {
|
|
||||||
onRejected(error);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
promise = dispatchRequest(newConfig);
|
|
||||||
} catch (error) {
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (responseInterceptorChain.length) {
|
|
||||||
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
||||||
}
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
Axios.prototype.getUri = function getUri(config) {
|
|
||||||
config = mergeConfig(this.defaults, config);
|
|
||||||
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
|
||||||
};
|
|
||||||
|
|
||||||
// Provide aliases for supported request methods
|
|
||||||
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
||||||
/*eslint func-names:0*/
|
|
||||||
Axios.prototype[method] = function(url, config) {
|
|
||||||
return this.request(mergeConfig(config || {}, {
|
|
||||||
method: method,
|
|
||||||
url: url,
|
|
||||||
data: (config || {}).data
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
||||||
/*eslint func-names:0*/
|
|
||||||
Axios.prototype[method] = function(url, data, config) {
|
|
||||||
return this.request(mergeConfig(config || {}, {
|
|
||||||
method: method,
|
|
||||||
url: url,
|
|
||||||
data: data
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = Axios;
|
|
||||||
54
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
54
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
@@ -1,54 +0,0 @@
|
|||||||
'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, options) {
|
|
||||||
this.handlers.push({
|
|
||||||
fulfilled: fulfilled,
|
|
||||||
rejected: rejected,
|
|
||||||
synchronous: options ? options.synchronous : false,
|
|
||||||
runWhen: options ? options.runWhen : null
|
|
||||||
});
|
|
||||||
return this.handlers.length - 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove an interceptor from the stack
|
|
||||||
*
|
|
||||||
* @param {Number} id The ID that was returned by `use`
|
|
||||||
*/
|
|
||||||
InterceptorManager.prototype.eject = function eject(id) {
|
|
||||||
if (this.handlers[id]) {
|
|
||||||
this.handlers[id] = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterate over all the registered interceptors
|
|
||||||
*
|
|
||||||
* This method is particularly useful for skipping over any
|
|
||||||
* interceptors that may have become `null` calling `eject`.
|
|
||||||
*
|
|
||||||
* @param {Function} fn The function to call for each interceptor
|
|
||||||
*/
|
|
||||||
InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
||||||
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
||||||
if (h !== null) {
|
|
||||||
fn(h);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = InterceptorManager;
|
|
||||||
8
node_modules/axios/lib/core/README.md
generated
vendored
8
node_modules/axios/lib/core/README.md
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
# axios // core
|
|
||||||
|
|
||||||
The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:
|
|
||||||
|
|
||||||
- Dispatching requests
|
|
||||||
- Requests sent via `adapters/` (see lib/adapters/README.md)
|
|
||||||
- Managing interceptors
|
|
||||||
- Handling config
|
|
||||||
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
@@ -1,20 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var isAbsoluteURL = require('../helpers/isAbsoluteURL');
|
|
||||||
var combineURLs = require('../helpers/combineURLs');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
||||||
* only when the requestedURL is not already an absolute URL.
|
|
||||||
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
||||||
*
|
|
||||||
* @param {string} baseURL The base URL
|
|
||||||
* @param {string} requestedURL Absolute or relative URL to combine
|
|
||||||
* @returns {string} The combined full path
|
|
||||||
*/
|
|
||||||
module.exports = function buildFullPath(baseURL, requestedURL) {
|
|
||||||
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
||||||
return combineURLs(baseURL, requestedURL);
|
|
||||||
}
|
|
||||||
return requestedURL;
|
|
||||||
};
|
|
||||||
18
node_modules/axios/lib/core/createError.js
generated
vendored
18
node_modules/axios/lib/core/createError.js
generated
vendored
@@ -1,18 +0,0 @@
|
|||||||
'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);
|
|
||||||
};
|
|
||||||
87
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
87
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
@@ -1,87 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./../utils');
|
|
||||||
var transformData = require('./transformData');
|
|
||||||
var isCancel = require('../cancel/isCancel');
|
|
||||||
var defaults = require('../defaults');
|
|
||||||
var Cancel = require('../cancel/Cancel');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throws a `Cancel` if cancellation has been requested.
|
|
||||||
*/
|
|
||||||
function throwIfCancellationRequested(config) {
|
|
||||||
if (config.cancelToken) {
|
|
||||||
config.cancelToken.throwIfRequested();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.signal && config.signal.aborted) {
|
|
||||||
throw new Cancel('canceled');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
// Ensure headers exist
|
|
||||||
config.headers = config.headers || {};
|
|
||||||
|
|
||||||
// Transform request data
|
|
||||||
config.data = transformData.call(
|
|
||||||
config,
|
|
||||||
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.call(
|
|
||||||
config,
|
|
||||||
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.call(
|
|
||||||
config,
|
|
||||||
reason.response.data,
|
|
||||||
reason.response.headers,
|
|
||||||
config.transformResponse
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.reject(reason);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
43
node_modules/axios/lib/core/enhanceError.js
generated
vendored
43
node_modules/axios/lib/core/enhanceError.js
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update an Error with the specified config, error code, and response.
|
|
||||||
*
|
|
||||||
* @param {Error} error The error to update.
|
|
||||||
* @param {Object} config The config.
|
|
||||||
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
||||||
* @param {Object} [request] The request.
|
|
||||||
* @param {Object} [response] The response.
|
|
||||||
* @returns {Error} The error.
|
|
||||||
*/
|
|
||||||
module.exports = function enhanceError(error, config, code, request, response) {
|
|
||||||
error.config = config;
|
|
||||||
if (code) {
|
|
||||||
error.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
error.request = request;
|
|
||||||
error.response = response;
|
|
||||||
error.isAxiosError = true;
|
|
||||||
|
|
||||||
error.toJSON = function toJSON() {
|
|
||||||
return {
|
|
||||||
// Standard
|
|
||||||
message: this.message,
|
|
||||||
name: this.name,
|
|
||||||
// Microsoft
|
|
||||||
description: this.description,
|
|
||||||
number: this.number,
|
|
||||||
// Mozilla
|
|
||||||
fileName: this.fileName,
|
|
||||||
lineNumber: this.lineNumber,
|
|
||||||
columnNumber: this.columnNumber,
|
|
||||||
stack: this.stack,
|
|
||||||
// Axios
|
|
||||||
config: this.config,
|
|
||||||
code: this.code,
|
|
||||||
status: this.response && this.response.status ? this.response.status : null
|
|
||||||
};
|
|
||||||
};
|
|
||||||
return error;
|
|
||||||
};
|
|
||||||
99
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
99
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
@@ -1,99 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('../utils');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Config-specific merge-function which creates a new config-object
|
|
||||||
* by merging two configuration objects together.
|
|
||||||
*
|
|
||||||
* @param {Object} config1
|
|
||||||
* @param {Object} config2
|
|
||||||
* @returns {Object} New object resulting from merging config2 to config1
|
|
||||||
*/
|
|
||||||
module.exports = function mergeConfig(config1, config2) {
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
config2 = config2 || {};
|
|
||||||
var config = {};
|
|
||||||
|
|
||||||
function getMergedValue(target, source) {
|
|
||||||
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
||||||
return utils.merge(target, source);
|
|
||||||
} else if (utils.isPlainObject(source)) {
|
|
||||||
return utils.merge({}, source);
|
|
||||||
} else if (utils.isArray(source)) {
|
|
||||||
return source.slice();
|
|
||||||
}
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
|
||||||
function mergeDeepProperties(prop) {
|
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
|
||||||
return getMergedValue(config1[prop], config2[prop]);
|
|
||||||
} else if (!utils.isUndefined(config1[prop])) {
|
|
||||||
return getMergedValue(undefined, config1[prop]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
|
||||||
function valueFromConfig2(prop) {
|
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
|
||||||
return getMergedValue(undefined, config2[prop]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
|
||||||
function defaultToConfig2(prop) {
|
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
|
||||||
return getMergedValue(undefined, config2[prop]);
|
|
||||||
} else if (!utils.isUndefined(config1[prop])) {
|
|
||||||
return getMergedValue(undefined, config1[prop]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
|
||||||
function mergeDirectKeys(prop) {
|
|
||||||
if (prop in config2) {
|
|
||||||
return getMergedValue(config1[prop], config2[prop]);
|
|
||||||
} else if (prop in config1) {
|
|
||||||
return getMergedValue(undefined, config1[prop]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var mergeMap = {
|
|
||||||
'url': valueFromConfig2,
|
|
||||||
'method': valueFromConfig2,
|
|
||||||
'data': valueFromConfig2,
|
|
||||||
'baseURL': defaultToConfig2,
|
|
||||||
'transformRequest': defaultToConfig2,
|
|
||||||
'transformResponse': defaultToConfig2,
|
|
||||||
'paramsSerializer': defaultToConfig2,
|
|
||||||
'timeout': defaultToConfig2,
|
|
||||||
'timeoutMessage': defaultToConfig2,
|
|
||||||
'withCredentials': defaultToConfig2,
|
|
||||||
'adapter': defaultToConfig2,
|
|
||||||
'responseType': defaultToConfig2,
|
|
||||||
'xsrfCookieName': defaultToConfig2,
|
|
||||||
'xsrfHeaderName': defaultToConfig2,
|
|
||||||
'onUploadProgress': defaultToConfig2,
|
|
||||||
'onDownloadProgress': defaultToConfig2,
|
|
||||||
'decompress': defaultToConfig2,
|
|
||||||
'maxContentLength': defaultToConfig2,
|
|
||||||
'maxBodyLength': defaultToConfig2,
|
|
||||||
'transport': defaultToConfig2,
|
|
||||||
'httpAgent': defaultToConfig2,
|
|
||||||
'httpsAgent': defaultToConfig2,
|
|
||||||
'cancelToken': defaultToConfig2,
|
|
||||||
'socketPath': defaultToConfig2,
|
|
||||||
'responseEncoding': defaultToConfig2,
|
|
||||||
'validateStatus': mergeDirectKeys
|
|
||||||
};
|
|
||||||
|
|
||||||
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
||||||
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
||||||
var configValue = merge(prop);
|
|
||||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
return config;
|
|
||||||
};
|
|
||||||
25
node_modules/axios/lib/core/settle.js
generated
vendored
25
node_modules/axios/lib/core/settle.js
generated
vendored
@@ -1,25 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var createError = require('./createError');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolve or reject a Promise based on response status.
|
|
||||||
*
|
|
||||||
* @param {Function} resolve A function that resolves the promise.
|
|
||||||
* @param {Function} reject A function that rejects the promise.
|
|
||||||
* @param {object} response The response.
|
|
||||||
*/
|
|
||||||
module.exports = function settle(resolve, reject, response) {
|
|
||||||
var validateStatus = response.config.validateStatus;
|
|
||||||
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
||||||
resolve(response);
|
|
||||||
} else {
|
|
||||||
reject(createError(
|
|
||||||
'Request failed with status code ' + response.status,
|
|
||||||
response.config,
|
|
||||||
null,
|
|
||||||
response.request,
|
|
||||||
response
|
|
||||||
));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
22
node_modules/axios/lib/core/transformData.js
generated
vendored
22
node_modules/axios/lib/core/transformData.js
generated
vendored
@@ -1,22 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./../utils');
|
|
||||||
var defaults = require('../defaults');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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) {
|
|
||||||
var context = this || defaults;
|
|
||||||
/*eslint no-param-reassign:0*/
|
|
||||||
utils.forEach(fns, function transform(fn) {
|
|
||||||
data = fn.call(context, data, headers);
|
|
||||||
});
|
|
||||||
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
131
node_modules/axios/lib/defaults/index.js
generated
vendored
131
node_modules/axios/lib/defaults/index.js
generated
vendored
@@ -1,131 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('../utils');
|
|
||||||
var normalizeHeaderName = require('../helpers/normalizeHeaderName');
|
|
||||||
var enhanceError = require('../core/enhanceError');
|
|
||||||
var transitionalDefaults = require('./transitional');
|
|
||||||
|
|
||||||
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 XMLHttpRequest !== 'undefined') {
|
|
||||||
// For browsers use XHR adapter
|
|
||||||
adapter = require('../adapters/xhr');
|
|
||||||
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|
||||||
// For node use HTTP adapter
|
|
||||||
adapter = require('../adapters/http');
|
|
||||||
}
|
|
||||||
return adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
function stringifySafely(rawValue, parser, encoder) {
|
|
||||||
if (utils.isString(rawValue)) {
|
|
||||||
try {
|
|
||||||
(parser || JSON.parse)(rawValue);
|
|
||||||
return utils.trim(rawValue);
|
|
||||||
} catch (e) {
|
|
||||||
if (e.name !== 'SyntaxError') {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (encoder || JSON.stringify)(rawValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
var defaults = {
|
|
||||||
|
|
||||||
transitional: transitionalDefaults,
|
|
||||||
|
|
||||||
adapter: getDefaultAdapter(),
|
|
||||||
|
|
||||||
transformRequest: [function transformRequest(data, headers) {
|
|
||||||
normalizeHeaderName(headers, 'Accept');
|
|
||||||
normalizeHeaderName(headers, 'Content-Type');
|
|
||||||
|
|
||||||
if (utils.isFormData(data) ||
|
|
||||||
utils.isArrayBuffer(data) ||
|
|
||||||
utils.isBuffer(data) ||
|
|
||||||
utils.isStream(data) ||
|
|
||||||
utils.isFile(data) ||
|
|
||||||
utils.isBlob(data)
|
|
||||||
) {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
if (utils.isArrayBufferView(data)) {
|
|
||||||
return data.buffer;
|
|
||||||
}
|
|
||||||
if (utils.isURLSearchParams(data)) {
|
|
||||||
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
||||||
return data.toString();
|
|
||||||
}
|
|
||||||
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
|
||||||
setContentTypeIfUnset(headers, 'application/json');
|
|
||||||
return stringifySafely(data);
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}],
|
|
||||||
|
|
||||||
transformResponse: [function transformResponse(data) {
|
|
||||||
var transitional = this.transitional || defaults.transitional;
|
|
||||||
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
||||||
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
||||||
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
||||||
|
|
||||||
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
|
||||||
try {
|
|
||||||
return JSON.parse(data);
|
|
||||||
} catch (e) {
|
|
||||||
if (strictJSONParsing) {
|
|
||||||
if (e.name === 'SyntaxError') {
|
|
||||||
throw enhanceError(e, this, 'E_JSON_PARSE');
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
||||||
* timeout is not created.
|
|
||||||
*/
|
|
||||||
timeout: 0,
|
|
||||||
|
|
||||||
xsrfCookieName: 'XSRF-TOKEN',
|
|
||||||
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
||||||
|
|
||||||
maxContentLength: -1,
|
|
||||||
maxBodyLength: -1,
|
|
||||||
|
|
||||||
validateStatus: function validateStatus(status) {
|
|
||||||
return status >= 200 && status < 300;
|
|
||||||
},
|
|
||||||
|
|
||||||
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;
|
|
||||||
7
node_modules/axios/lib/defaults/transitional.js
generated
vendored
7
node_modules/axios/lib/defaults/transitional.js
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
silentJSONParsing: true,
|
|
||||||
forcedJSONParsing: true,
|
|
||||||
clarifyTimeoutError: false
|
|
||||||
};
|
|
||||||
7
node_modules/axios/lib/helpers/README.md
generated
vendored
7
node_modules/axios/lib/helpers/README.md
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
# axios // helpers
|
|
||||||
|
|
||||||
The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
|
|
||||||
|
|
||||||
- Browser polyfills
|
|
||||||
- Managing cookies
|
|
||||||
- Parsing HTTP headers
|
|
||||||
11
node_modules/axios/lib/helpers/bind.js
generated
vendored
11
node_modules/axios/lib/helpers/bind.js
generated
vendored
@@ -1,11 +0,0 @@
|
|||||||
'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);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
70
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
70
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
@@ -1,70 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./../utils');
|
|
||||||
|
|
||||||
function encode(val) {
|
|
||||||
return encodeURIComponent(val).
|
|
||||||
replace(/%3A/gi, ':').
|
|
||||||
replace(/%24/g, '$').
|
|
||||||
replace(/%2C/gi, ',').
|
|
||||||
replace(/%20/g, '+').
|
|
||||||
replace(/%5B/gi, '[').
|
|
||||||
replace(/%5D/gi, ']');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build a URL by appending params to the end
|
|
||||||
*
|
|
||||||
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
||||||
* @param {object} [params] The params to be appended
|
|
||||||
* @returns {string} The formatted url
|
|
||||||
*/
|
|
||||||
module.exports = function buildURL(url, params, paramsSerializer) {
|
|
||||||
/*eslint no-param-reassign:0*/
|
|
||||||
if (!params) {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
var serializedParams;
|
|
||||||
if (paramsSerializer) {
|
|
||||||
serializedParams = paramsSerializer(params);
|
|
||||||
} else if (utils.isURLSearchParams(params)) {
|
|
||||||
serializedParams = params.toString();
|
|
||||||
} else {
|
|
||||||
var parts = [];
|
|
||||||
|
|
||||||
utils.forEach(params, function serialize(val, key) {
|
|
||||||
if (val === null || typeof val === 'undefined') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (utils.isArray(val)) {
|
|
||||||
key = key + '[]';
|
|
||||||
} else {
|
|
||||||
val = [val];
|
|
||||||
}
|
|
||||||
|
|
||||||
utils.forEach(val, function parseValue(v) {
|
|
||||||
if (utils.isDate(v)) {
|
|
||||||
v = v.toISOString();
|
|
||||||
} else if (utils.isObject(v)) {
|
|
||||||
v = JSON.stringify(v);
|
|
||||||
}
|
|
||||||
parts.push(encode(key) + '=' + encode(v));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
serializedParams = parts.join('&');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serializedParams) {
|
|
||||||
var hashmarkIndex = url.indexOf('#');
|
|
||||||
if (hashmarkIndex !== -1) {
|
|
||||||
url = url.slice(0, hashmarkIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
|
||||||
};
|
|
||||||
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
'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/axios/lib/helpers/cookies.js
generated
vendored
53
node_modules/axios/lib/helpers/cookies.js
generated
vendored
@@ -1,53 +0,0 @@
|
|||||||
'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/axios/lib/helpers/deprecatedMethod.js
generated
vendored
24
node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
@@ -1,24 +0,0 @@
|
|||||||
'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/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
14
node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
'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);
|
|
||||||
};
|
|
||||||
13
node_modules/axios/lib/helpers/isAxiosError.js
generated
vendored
13
node_modules/axios/lib/helpers/isAxiosError.js
generated
vendored
@@ -1,13 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = require('./../utils');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether the payload is an error thrown by Axios
|
|
||||||
*
|
|
||||||
* @param {*} payload The value to test
|
|
||||||
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
||||||
*/
|
|
||||||
module.exports = function isAxiosError(payload) {
|
|
||||||
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
||||||
};
|
|
||||||
68
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
68
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
@@ -1,68 +0,0 @@
|
|||||||
'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/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
12
node_modules/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
@@ -1,12 +0,0 @@
|
|||||||
'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/axios/lib/helpers/parseHeaders.js
generated
vendored
53
node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
@@ -1,53 +0,0 @@
|
|||||||
'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/axios/lib/helpers/spread.js
generated
vendored
27
node_modules/axios/lib/helpers/spread.js
generated
vendored
@@ -1,27 +0,0 @@
|
|||||||
'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);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
55
node_modules/axios/lib/helpers/toFormData.js
generated
vendored
55
node_modules/axios/lib/helpers/toFormData.js
generated
vendored
@@ -1,55 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
function combinedKey(parentKey, elKey) {
|
|
||||||
return parentKey + '.' + elKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildFormData(formData, data, parentKey) {
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
data.forEach(function buildArray(el, i) {
|
|
||||||
buildFormData(formData, el, combinedKey(parentKey, i));
|
|
||||||
});
|
|
||||||
} else if (
|
|
||||||
typeof data === 'object' &&
|
|
||||||
!(data instanceof File || data === null)
|
|
||||||
) {
|
|
||||||
Object.keys(data).forEach(function buildObject(key) {
|
|
||||||
buildFormData(
|
|
||||||
formData,
|
|
||||||
data[key],
|
|
||||||
parentKey ? combinedKey(parentKey, key) : key
|
|
||||||
);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (data === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var value =
|
|
||||||
typeof data === 'boolean' || typeof data === 'number'
|
|
||||||
? data.toString()
|
|
||||||
: data;
|
|
||||||
formData.append(parentKey, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* convert a data object to FormData
|
|
||||||
*
|
|
||||||
* type FormDataPrimitive = string | Blob | number | boolean
|
|
||||||
* interface FormDataNest {
|
|
||||||
* [x: string]: FormVal
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* type FormVal = FormDataNest | FormDataPrimitive
|
|
||||||
*
|
|
||||||
* @param {FormVal} data
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = function getFormData(data) {
|
|
||||||
var formData = new FormData();
|
|
||||||
|
|
||||||
buildFormData(formData, data);
|
|
||||||
|
|
||||||
return formData;
|
|
||||||
};
|
|
||||||
82
node_modules/axios/lib/helpers/validator.js
generated
vendored
82
node_modules/axios/lib/helpers/validator.js
generated
vendored
@@ -1,82 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var VERSION = require('../env/data').version;
|
|
||||||
|
|
||||||
var validators = {};
|
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
|
||||||
validators[type] = function validator(thing) {
|
|
||||||
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
var deprecatedWarnings = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitional option validator
|
|
||||||
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
||||||
* @param {string?} version - deprecated version / removed since version
|
|
||||||
* @param {string?} message - some message with additional info
|
|
||||||
* @returns {function}
|
|
||||||
*/
|
|
||||||
validators.transitional = function transitional(validator, version, message) {
|
|
||||||
function formatMessage(opt, desc) {
|
|
||||||
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
return function(value, opt, opts) {
|
|
||||||
if (validator === false) {
|
|
||||||
throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version && !deprecatedWarnings[opt]) {
|
|
||||||
deprecatedWarnings[opt] = true;
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.warn(
|
|
||||||
formatMessage(
|
|
||||||
opt,
|
|
||||||
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return validator ? validator(value, opt, opts) : true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assert object's properties type
|
|
||||||
* @param {object} options
|
|
||||||
* @param {object} schema
|
|
||||||
* @param {boolean?} allowUnknown
|
|
||||||
*/
|
|
||||||
|
|
||||||
function assertOptions(options, schema, allowUnknown) {
|
|
||||||
if (typeof options !== 'object') {
|
|
||||||
throw new TypeError('options must be an object');
|
|
||||||
}
|
|
||||||
var keys = Object.keys(options);
|
|
||||||
var i = keys.length;
|
|
||||||
while (i-- > 0) {
|
|
||||||
var opt = keys[i];
|
|
||||||
var validator = schema[opt];
|
|
||||||
if (validator) {
|
|
||||||
var value = options[opt];
|
|
||||||
var result = value === undefined || validator(value, opt, options);
|
|
||||||
if (result !== true) {
|
|
||||||
throw new TypeError('option ' + opt + ' must be ' + result);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (allowUnknown !== true) {
|
|
||||||
throw Error('Unknown option ' + opt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
assertOptions: assertOptions,
|
|
||||||
validators: validators
|
|
||||||
};
|
|
||||||
349
node_modules/axios/lib/utils.js
generated
vendored
349
node_modules/axios/lib/utils.js
generated
vendored
@@ -1,349 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var bind = require('./helpers/bind');
|
|
||||||
|
|
||||||
// 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 Array.isArray(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 a Buffer
|
|
||||||
*
|
|
||||||
* @param {Object} val The value to test
|
|
||||||
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
||||||
*/
|
|
||||||
function isBuffer(val) {
|
|
||||||
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
||||||
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 toString.call(val) === '[object 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) && (isArrayBuffer(val.buffer));
|
|
||||||
}
|
|
||||||
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 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 plain Object
|
|
||||||
*
|
|
||||||
* @param {Object} val The value to test
|
|
||||||
* @return {boolean} True if value is a plain Object, otherwise false
|
|
||||||
*/
|
|
||||||
function isPlainObject(val) {
|
|
||||||
if (toString.call(val) !== '[object Object]') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var prototype = Object.getPrototypeOf(val);
|
|
||||||
return prototype === null || prototype === Object.prototype;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 toString.call(val) === '[object 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.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if we're running in a standard browser environment
|
|
||||||
*
|
|
||||||
* This allows axios to run in a web worker, and react-native.
|
|
||||||
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
||||||
*
|
|
||||||
* web workers:
|
|
||||||
* typeof window -> undefined
|
|
||||||
* typeof document -> undefined
|
|
||||||
*
|
|
||||||
* react-native:
|
|
||||||
* navigator.product -> 'ReactNative'
|
|
||||||
* nativescript
|
|
||||||
* navigator.product -> 'NativeScript' or 'NS'
|
|
||||||
*/
|
|
||||||
function isStandardBrowserEnv() {
|
|
||||||
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
|
||||||
navigator.product === 'NativeScript' ||
|
|
||||||
navigator.product === 'NS')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
typeof window !== 'undefined' &&
|
|
||||||
typeof document !== 'undefined'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterate over an Array or an Object invoking a function for each item.
|
|
||||||
*
|
|
||||||
* If `obj` is an Array callback will be called passing
|
|
||||||
* the value, index, and complete array for each item.
|
|
||||||
*
|
|
||||||
* If 'obj' is an Object callback will be called passing
|
|
||||||
* the value, key, and complete object for each property.
|
|
||||||
*
|
|
||||||
* @param {Object|Array} obj The object to iterate
|
|
||||||
* @param {Function} fn The callback to invoke for each item
|
|
||||||
*/
|
|
||||||
function forEach(obj, fn) {
|
|
||||||
// Don't bother if no value provided
|
|
||||||
if (obj === null || typeof obj === 'undefined') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Force an array if not already something iterable
|
|
||||||
if (typeof obj !== 'object') {
|
|
||||||
/*eslint no-param-reassign:0*/
|
|
||||||
obj = [obj];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isArray(obj)) {
|
|
||||||
// Iterate over array values
|
|
||||||
for (var i = 0, l = obj.length; i < l; i++) {
|
|
||||||
fn.call(null, obj[i], i, obj);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Iterate over object keys
|
|
||||||
for (var key in obj) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
||||||
fn.call(null, obj[key], key, obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Accepts varargs expecting each argument to be an object, then
|
|
||||||
* immutably merges the properties of each object and returns result.
|
|
||||||
*
|
|
||||||
* When multiple objects contain the same key the later object in
|
|
||||||
* the arguments list will take precedence.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* var result = merge({foo: 123}, {foo: 456});
|
|
||||||
* console.log(result.foo); // outputs 456
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param {Object} obj1 Object to merge
|
|
||||||
* @returns {Object} Result of all merge properties
|
|
||||||
*/
|
|
||||||
function merge(/* obj1, obj2, obj3, ... */) {
|
|
||||||
var result = {};
|
|
||||||
function assignValue(val, key) {
|
|
||||||
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
|
||||||
result[key] = merge(result[key], val);
|
|
||||||
} else if (isPlainObject(val)) {
|
|
||||||
result[key] = merge({}, val);
|
|
||||||
} else if (isArray(val)) {
|
|
||||||
result[key] = val.slice();
|
|
||||||
} 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
||||||
*
|
|
||||||
* @param {string} content with BOM
|
|
||||||
* @return {string} content value without BOM
|
|
||||||
*/
|
|
||||||
function stripBOM(content) {
|
|
||||||
if (content.charCodeAt(0) === 0xFEFF) {
|
|
||||||
content = content.slice(1);
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
isArray: isArray,
|
|
||||||
isArrayBuffer: isArrayBuffer,
|
|
||||||
isBuffer: isBuffer,
|
|
||||||
isFormData: isFormData,
|
|
||||||
isArrayBufferView: isArrayBufferView,
|
|
||||||
isString: isString,
|
|
||||||
isNumber: isNumber,
|
|
||||||
isObject: isObject,
|
|
||||||
isPlainObject: isPlainObject,
|
|
||||||
isUndefined: isUndefined,
|
|
||||||
isDate: isDate,
|
|
||||||
isFile: isFile,
|
|
||||||
isBlob: isBlob,
|
|
||||||
isFunction: isFunction,
|
|
||||||
isStream: isStream,
|
|
||||||
isURLSearchParams: isURLSearchParams,
|
|
||||||
isStandardBrowserEnv: isStandardBrowserEnv,
|
|
||||||
forEach: forEach,
|
|
||||||
merge: merge,
|
|
||||||
extend: extend,
|
|
||||||
trim: trim,
|
|
||||||
stripBOM: stripBOM
|
|
||||||
};
|
|
||||||
116
node_modules/axios/package.json
generated
vendored
116
node_modules/axios/package.json
generated
vendored
@@ -1,116 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"axios@0.26.1",
|
|
||||||
"/Users/bitcarrot/github/satshkd-vercel"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "axios@0.26.1",
|
|
||||||
"_id": "axios@0.26.1",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
|
||||||
"_location": "/axios",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "axios@0.26.1",
|
|
||||||
"name": "axios",
|
|
||||||
"escapedName": "axios",
|
|
||||||
"rawSpec": "0.26.1",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "0.26.1"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
|
||||||
"_spec": "0.26.1",
|
|
||||||
"_where": "/Users/bitcarrot/github/satshkd-vercel",
|
|
||||||
"author": {
|
|
||||||
"name": "Matt Zabriskie"
|
|
||||||
},
|
|
||||||
"browser": {
|
|
||||||
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/axios/axios/issues"
|
|
||||||
},
|
|
||||||
"bundlesize": [
|
|
||||||
{
|
|
||||||
"path": "./dist/axios.min.js",
|
|
||||||
"threshold": "5kB"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"follow-redirects": "^1.14.8"
|
|
||||||
},
|
|
||||||
"description": "Promise based HTTP client for the browser and node.js",
|
|
||||||
"devDependencies": {
|
|
||||||
"abortcontroller-polyfill": "^1.5.0",
|
|
||||||
"coveralls": "^3.0.0",
|
|
||||||
"dtslint": "^4.1.6",
|
|
||||||
"es6-promise": "^4.2.4",
|
|
||||||
"grunt": "^1.3.0",
|
|
||||||
"grunt-banner": "^0.6.0",
|
|
||||||
"grunt-cli": "^1.2.0",
|
|
||||||
"grunt-contrib-clean": "^1.1.0",
|
|
||||||
"grunt-contrib-watch": "^1.0.0",
|
|
||||||
"grunt-eslint": "^23.0.0",
|
|
||||||
"grunt-karma": "^4.0.0",
|
|
||||||
"grunt-mocha-test": "^0.13.3",
|
|
||||||
"grunt-webpack": "^4.0.2",
|
|
||||||
"istanbul-instrumenter-loader": "^1.0.0",
|
|
||||||
"jasmine-core": "^2.4.1",
|
|
||||||
"karma": "^6.3.2",
|
|
||||||
"karma-chrome-launcher": "^3.1.0",
|
|
||||||
"karma-firefox-launcher": "^2.1.0",
|
|
||||||
"karma-jasmine": "^1.1.1",
|
|
||||||
"karma-jasmine-ajax": "^0.1.13",
|
|
||||||
"karma-safari-launcher": "^1.0.0",
|
|
||||||
"karma-sauce-launcher": "^4.3.6",
|
|
||||||
"karma-sinon": "^1.0.5",
|
|
||||||
"karma-sourcemap-loader": "^0.3.8",
|
|
||||||
"karma-webpack": "^4.0.2",
|
|
||||||
"load-grunt-tasks": "^3.5.2",
|
|
||||||
"minimist": "^1.2.0",
|
|
||||||
"mocha": "^8.2.1",
|
|
||||||
"sinon": "^4.5.0",
|
|
||||||
"terser-webpack-plugin": "^4.2.3",
|
|
||||||
"typescript": "^4.0.5",
|
|
||||||
"url-search-params": "^0.10.0",
|
|
||||||
"webpack": "^4.44.2",
|
|
||||||
"webpack-dev-server": "^3.11.0"
|
|
||||||
},
|
|
||||||
"homepage": "https://axios-http.com",
|
|
||||||
"jsdelivr": "dist/axios.min.js",
|
|
||||||
"keywords": [
|
|
||||||
"xhr",
|
|
||||||
"http",
|
|
||||||
"ajax",
|
|
||||||
"promise",
|
|
||||||
"node"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "index.js",
|
|
||||||
"name": "axios",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/axios/axios.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "NODE_ENV=production grunt build",
|
|
||||||
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
||||||
"examples": "node ./examples/server.js",
|
|
||||||
"fix": "eslint --fix lib/**/*.js",
|
|
||||||
"postversion": "git push && git push --tags",
|
|
||||||
"preversion": "grunt version && npm test",
|
|
||||||
"start": "node ./sandbox/server.js",
|
|
||||||
"test": "grunt test && dtslint",
|
|
||||||
"version": "npm run build && git add -A dist && git add CHANGELOG.md bower.json package.json"
|
|
||||||
},
|
|
||||||
"types": "index.d.ts",
|
|
||||||
"typings": "./index.d.ts",
|
|
||||||
"unpkg": "dist/axios.min.js",
|
|
||||||
"version": "0.26.1"
|
|
||||||
}
|
|
||||||
14
node_modules/axios/tsconfig.json
generated
vendored
14
node_modules/axios/tsconfig.json
generated
vendored
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "es2015",
|
|
||||||
"lib": ["dom", "es2015"],
|
|
||||||
"types": [],
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"strict": true,
|
|
||||||
"noEmit": true,
|
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
|
||||||
"axios": ["."]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
6
node_modules/axios/tslint.json
generated
vendored
6
node_modules/axios/tslint.json
generated
vendored
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "dtslint/dtslint.json",
|
|
||||||
"rules": {
|
|
||||||
"no-unnecessary-generics": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
node_modules/balanced-match/.github/FUNDING.yml
generated
vendored
2
node_modules/balanced-match/.github/FUNDING.yml
generated
vendored
@@ -1,2 +0,0 @@
|
|||||||
tidelift: "npm/balanced-match"
|
|
||||||
patreon: juliangruber
|
|
||||||
21
node_modules/balanced-match/LICENSE.md
generated
vendored
21
node_modules/balanced-match/LICENSE.md
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
(MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
||||||
|
|
||||||
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.
|
|
||||||
97
node_modules/balanced-match/README.md
generated
vendored
97
node_modules/balanced-match/README.md
generated
vendored
@@ -1,97 +0,0 @@
|
|||||||
# balanced-match
|
|
||||||
|
|
||||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
|
||||||
|
|
||||||
[](http://travis-ci.org/juliangruber/balanced-match)
|
|
||||||
[](https://www.npmjs.org/package/balanced-match)
|
|
||||||
|
|
||||||
[](https://ci.testling.com/juliangruber/balanced-match)
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Get the first matching pair of braces:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var balanced = require('balanced-match');
|
|
||||||
|
|
||||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
|
||||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
|
||||||
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
|
||||||
```
|
|
||||||
|
|
||||||
The matches are:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ node example.js
|
|
||||||
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
|
||||||
{ start: 3,
|
|
||||||
end: 9,
|
|
||||||
pre: 'pre',
|
|
||||||
body: 'first',
|
|
||||||
post: 'between{second}post' }
|
|
||||||
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### var m = balanced(a, b, str)
|
|
||||||
|
|
||||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
|
||||||
object with those keys:
|
|
||||||
|
|
||||||
* **start** the index of the first match of `a`
|
|
||||||
* **end** the index of the matching `b`
|
|
||||||
* **pre** the preamble, `a` and `b` not included
|
|
||||||
* **body** the match, `a` and `b` not included
|
|
||||||
* **post** the postscript, `a` and `b` not included
|
|
||||||
|
|
||||||
If there's no match, `undefined` will be returned.
|
|
||||||
|
|
||||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
|
||||||
|
|
||||||
### var r = balanced.range(a, b, str)
|
|
||||||
|
|
||||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
|
||||||
array with indexes: `[ <a index>, <b index> ]`.
|
|
||||||
|
|
||||||
If there's no match, `undefined` will be returned.
|
|
||||||
|
|
||||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
With [npm](https://npmjs.org) do:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install balanced-match
|
|
||||||
```
|
|
||||||
|
|
||||||
## Security contact information
|
|
||||||
|
|
||||||
To report a security vulnerability, please use the
|
|
||||||
[Tidelift security contact](https://tidelift.com/security).
|
|
||||||
Tidelift will coordinate the fix and disclosure.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
(MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
||||||
|
|
||||||
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.
|
|
||||||
62
node_modules/balanced-match/index.js
generated
vendored
62
node_modules/balanced-match/index.js
generated
vendored
@@ -1,62 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
module.exports = balanced;
|
|
||||||
function balanced(a, b, str) {
|
|
||||||
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
||||||
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
||||||
|
|
||||||
var r = range(a, b, str);
|
|
||||||
|
|
||||||
return r && {
|
|
||||||
start: r[0],
|
|
||||||
end: r[1],
|
|
||||||
pre: str.slice(0, r[0]),
|
|
||||||
body: str.slice(r[0] + a.length, r[1]),
|
|
||||||
post: str.slice(r[1] + b.length)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function maybeMatch(reg, str) {
|
|
||||||
var m = str.match(reg);
|
|
||||||
return m ? m[0] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
balanced.range = range;
|
|
||||||
function range(a, b, str) {
|
|
||||||
var begs, beg, left, right, result;
|
|
||||||
var ai = str.indexOf(a);
|
|
||||||
var bi = str.indexOf(b, ai + 1);
|
|
||||||
var i = ai;
|
|
||||||
|
|
||||||
if (ai >= 0 && bi > 0) {
|
|
||||||
if(a===b) {
|
|
||||||
return [ai, bi];
|
|
||||||
}
|
|
||||||
begs = [];
|
|
||||||
left = str.length;
|
|
||||||
|
|
||||||
while (i >= 0 && !result) {
|
|
||||||
if (i == ai) {
|
|
||||||
begs.push(i);
|
|
||||||
ai = str.indexOf(a, i + 1);
|
|
||||||
} else if (begs.length == 1) {
|
|
||||||
result = [ begs.pop(), bi ];
|
|
||||||
} else {
|
|
||||||
beg = begs.pop();
|
|
||||||
if (beg < left) {
|
|
||||||
left = beg;
|
|
||||||
right = bi;
|
|
||||||
}
|
|
||||||
|
|
||||||
bi = str.indexOf(b, i + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
i = ai < bi && ai >= 0 ? ai : bi;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (begs.length) {
|
|
||||||
result = [ left, right ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
79
node_modules/balanced-match/package.json
generated
vendored
79
node_modules/balanced-match/package.json
generated
vendored
@@ -1,79 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"balanced-match@1.0.2",
|
|
||||||
"/Users/bitcarrot/github/satshkd-vercel"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "balanced-match@1.0.2",
|
|
||||||
"_id": "balanced-match@1.0.2",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
|
||||||
"_location": "/balanced-match",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "balanced-match@1.0.2",
|
|
||||||
"name": "balanced-match",
|
|
||||||
"escapedName": "balanced-match",
|
|
||||||
"rawSpec": "1.0.2",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.0.2"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/brace-expansion"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
|
||||||
"_spec": "1.0.2",
|
|
||||||
"_where": "/Users/bitcarrot/github/satshkd-vercel",
|
|
||||||
"author": {
|
|
||||||
"name": "Julian Gruber",
|
|
||||||
"email": "mail@juliangruber.com",
|
|
||||||
"url": "http://juliangruber.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/juliangruber/balanced-match/issues"
|
|
||||||
},
|
|
||||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
|
||||||
"devDependencies": {
|
|
||||||
"matcha": "^0.7.0",
|
|
||||||
"tape": "^4.6.0"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
|
||||||
"keywords": [
|
|
||||||
"match",
|
|
||||||
"regexp",
|
|
||||||
"test",
|
|
||||||
"balanced",
|
|
||||||
"parse"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "index.js",
|
|
||||||
"name": "balanced-match",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"bench": "matcha test/bench.js",
|
|
||||||
"test": "tape test/test.js"
|
|
||||||
},
|
|
||||||
"testling": {
|
|
||||||
"files": "test/*.js",
|
|
||||||
"browsers": [
|
|
||||||
"ie/8..latest",
|
|
||||||
"firefox/20..latest",
|
|
||||||
"firefox/nightly",
|
|
||||||
"chrome/25..latest",
|
|
||||||
"chrome/canary",
|
|
||||||
"opera/12..latest",
|
|
||||||
"opera/next",
|
|
||||||
"safari/5.1..latest",
|
|
||||||
"ipad/6.0..latest",
|
|
||||||
"iphone/6.0..latest",
|
|
||||||
"android-browser/4.2..latest"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"version": "1.0.2"
|
|
||||||
}
|
|
||||||
52
node_modules/basic-auth/HISTORY.md
generated
vendored
52
node_modules/basic-auth/HISTORY.md
generated
vendored
@@ -1,52 +0,0 @@
|
|||||||
2.0.1 / 2018-09-19
|
|
||||||
==================
|
|
||||||
|
|
||||||
* deps: safe-buffer@5.1.2
|
|
||||||
|
|
||||||
2.0.0 / 2017-09-12
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Drop support for Node.js below 0.8
|
|
||||||
* Remove `auth(ctx)` signature -- pass in header or `auth(ctx.req)`
|
|
||||||
* Use `safe-buffer` for improved Buffer API
|
|
||||||
|
|
||||||
1.1.0 / 2016-11-18
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Add `auth.parse` for low-level string parsing
|
|
||||||
|
|
||||||
1.0.4 / 2016-05-10
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Improve error message when `req` argument is not an object
|
|
||||||
* Improve error message when `req` missing `headers` property
|
|
||||||
|
|
||||||
1.0.3 / 2015-07-01
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Fix regression accepting a Koa context
|
|
||||||
|
|
||||||
1.0.2 / 2015-06-12
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Improve error message when `req` argument missing
|
|
||||||
* perf: enable strict mode
|
|
||||||
* perf: hoist regular expression
|
|
||||||
* perf: parse with regular expressions
|
|
||||||
* perf: remove argument reassignment
|
|
||||||
|
|
||||||
1.0.1 / 2015-05-04
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Update readme
|
|
||||||
|
|
||||||
1.0.0 / 2014-07-01
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Support empty password
|
|
||||||
* Support empty username
|
|
||||||
|
|
||||||
0.0.1 / 2013-11-30
|
|
||||||
==================
|
|
||||||
|
|
||||||
* Initial release
|
|
||||||
24
node_modules/basic-auth/LICENSE
generated
vendored
24
node_modules/basic-auth/LICENSE
generated
vendored
@@ -1,24 +0,0 @@
|
|||||||
(The MIT License)
|
|
||||||
|
|
||||||
Copyright (c) 2013 TJ Holowaychuk
|
|
||||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
|
||||||
Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.com>
|
|
||||||
|
|
||||||
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.
|
|
||||||
113
node_modules/basic-auth/README.md
generated
vendored
113
node_modules/basic-auth/README.md
generated
vendored
@@ -1,113 +0,0 @@
|
|||||||
# basic-auth
|
|
||||||
|
|
||||||
[![NPM Version][npm-image]][npm-url]
|
|
||||||
[![NPM Downloads][downloads-image]][downloads-url]
|
|
||||||
[![Node.js Version][node-version-image]][node-version-url]
|
|
||||||
[![Build Status][travis-image]][travis-url]
|
|
||||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
||||||
|
|
||||||
Generic basic auth Authorization header field parser for whatever.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
||||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
||||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npm install basic-auth
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
<!-- eslint-disable no-unused-vars -->
|
|
||||||
|
|
||||||
```js
|
|
||||||
var auth = require('basic-auth')
|
|
||||||
```
|
|
||||||
|
|
||||||
### auth(req)
|
|
||||||
|
|
||||||
Get the basic auth credentials from the given request. The `Authorization`
|
|
||||||
header is parsed and if the header is invalid, `undefined` is returned,
|
|
||||||
otherwise an object with `name` and `pass` properties.
|
|
||||||
|
|
||||||
### auth.parse(string)
|
|
||||||
|
|
||||||
Parse a basic auth authorization header string. This will return an object
|
|
||||||
with `name` and `pass` properties, or `undefined` if the string is invalid.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Pass a Node.js request object to the module export. If parsing fails
|
|
||||||
`undefined` is returned, otherwise an object with `.name` and `.pass`.
|
|
||||||
|
|
||||||
<!-- eslint-disable no-unused-vars, no-undef -->
|
|
||||||
|
|
||||||
```js
|
|
||||||
var auth = require('basic-auth')
|
|
||||||
var user = auth(req)
|
|
||||||
// => { name: 'something', pass: 'whatever' }
|
|
||||||
```
|
|
||||||
|
|
||||||
A header string from any other location can also be parsed with
|
|
||||||
`auth.parse`, for example a `Proxy-Authorization` header:
|
|
||||||
|
|
||||||
<!-- eslint-disable no-unused-vars, no-undef -->
|
|
||||||
|
|
||||||
```js
|
|
||||||
var auth = require('basic-auth')
|
|
||||||
var user = auth.parse(req.getHeader('Proxy-Authorization'))
|
|
||||||
```
|
|
||||||
|
|
||||||
### With vanilla node.js http server
|
|
||||||
|
|
||||||
```js
|
|
||||||
var http = require('http')
|
|
||||||
var auth = require('basic-auth')
|
|
||||||
var compare = require('tsscmp')
|
|
||||||
|
|
||||||
// Create server
|
|
||||||
var server = http.createServer(function (req, res) {
|
|
||||||
var credentials = auth(req)
|
|
||||||
|
|
||||||
// Check credentials
|
|
||||||
// The "check" function will typically be against your user store
|
|
||||||
if (!credentials || !check(credentials.name, credentials.pass)) {
|
|
||||||
res.statusCode = 401
|
|
||||||
res.setHeader('WWW-Authenticate', 'Basic realm="example"')
|
|
||||||
res.end('Access denied')
|
|
||||||
} else {
|
|
||||||
res.end('Access granted')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Basic function to validate credentials for example
|
|
||||||
function check (name, pass) {
|
|
||||||
var valid = true
|
|
||||||
|
|
||||||
// Simple method to prevent short-circut and use timing-safe compare
|
|
||||||
valid = compare(name, 'john') && valid
|
|
||||||
valid = compare(pass, 'secret') && valid
|
|
||||||
|
|
||||||
return valid
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen
|
|
||||||
server.listen(3000)
|
|
||||||
```
|
|
||||||
|
|
||||||
# License
|
|
||||||
|
|
||||||
[MIT](LICENSE)
|
|
||||||
|
|
||||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/basic-auth/master
|
|
||||||
[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master
|
|
||||||
[downloads-image]: https://badgen.net/npm/dm/basic-auth
|
|
||||||
[downloads-url]: https://npmjs.org/package/basic-auth
|
|
||||||
[node-version-image]: https://badgen.net/npm/node/basic-auth
|
|
||||||
[node-version-url]: https://nodejs.org/en/download
|
|
||||||
[npm-image]: https://badgen.net/npm/v/basic-auth
|
|
||||||
[npm-url]: https://npmjs.org/package/basic-auth
|
|
||||||
[travis-image]: https://badgen.net/travis/jshttp/basic-auth/master
|
|
||||||
[travis-url]: https://travis-ci.org/jshttp/basic-auth
|
|
||||||
133
node_modules/basic-auth/index.js
generated
vendored
133
node_modules/basic-auth/index.js
generated
vendored
@@ -1,133 +0,0 @@
|
|||||||
/*!
|
|
||||||
* basic-auth
|
|
||||||
* Copyright(c) 2013 TJ Holowaychuk
|
|
||||||
* Copyright(c) 2014 Jonathan Ong
|
|
||||||
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
|
||||||
* MIT Licensed
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Buffer = require('safe-buffer').Buffer
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module exports.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = auth
|
|
||||||
module.exports.parse = parse
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RegExp for basic auth credentials
|
|
||||||
*
|
|
||||||
* credentials = auth-scheme 1*SP token68
|
|
||||||
* auth-scheme = "Basic" ; case insensitive
|
|
||||||
* token68 = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RegExp for basic auth user/pass
|
|
||||||
*
|
|
||||||
* user-pass = userid ":" password
|
|
||||||
* userid = *<TEXT excluding ":">
|
|
||||||
* password = *TEXT
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
var USER_PASS_REGEXP = /^([^:]*):(.*)$/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the Authorization header field of a request.
|
|
||||||
*
|
|
||||||
* @param {object} req
|
|
||||||
* @return {object} with .name and .pass
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function auth (req) {
|
|
||||||
if (!req) {
|
|
||||||
throw new TypeError('argument req is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof req !== 'object') {
|
|
||||||
throw new TypeError('argument req is required to be an object')
|
|
||||||
}
|
|
||||||
|
|
||||||
// get header
|
|
||||||
var header = getAuthorization(req)
|
|
||||||
|
|
||||||
// parse header
|
|
||||||
return parse(header)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decode base64 string.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function decodeBase64 (str) {
|
|
||||||
return Buffer.from(str, 'base64').toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Authorization header from request object.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getAuthorization (req) {
|
|
||||||
if (!req.headers || typeof req.headers !== 'object') {
|
|
||||||
throw new TypeError('argument req is required to have headers property')
|
|
||||||
}
|
|
||||||
|
|
||||||
return req.headers.authorization
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse basic auth to object.
|
|
||||||
*
|
|
||||||
* @param {string} string
|
|
||||||
* @return {object}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
|
|
||||||
function parse (string) {
|
|
||||||
if (typeof string !== 'string') {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse header
|
|
||||||
var match = CREDENTIALS_REGEXP.exec(string)
|
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
// decode user pass
|
|
||||||
var userPass = USER_PASS_REGEXP.exec(decodeBase64(match[1]))
|
|
||||||
|
|
||||||
if (!userPass) {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
// return credentials object
|
|
||||||
return new Credentials(userPass[1], userPass[2])
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Object to represent user credentials.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function Credentials (name, pass) {
|
|
||||||
this.name = name
|
|
||||||
this.pass = pass
|
|
||||||
}
|
|
||||||
21
node_modules/basic-auth/node_modules/safe-buffer/LICENSE
generated
vendored
21
node_modules/basic-auth/node_modules/safe-buffer/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) Feross Aboukhadijeh
|
|
||||||
|
|
||||||
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.
|
|
||||||
584
node_modules/basic-auth/node_modules/safe-buffer/README.md
generated
vendored
584
node_modules/basic-auth/node_modules/safe-buffer/README.md
generated
vendored
@@ -1,584 +0,0 @@
|
|||||||
# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
|
|
||||||
|
|
||||||
[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg
|
|
||||||
[travis-url]: https://travis-ci.org/feross/safe-buffer
|
|
||||||
[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg
|
|
||||||
[npm-url]: https://npmjs.org/package/safe-buffer
|
|
||||||
[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg
|
|
||||||
[downloads-url]: https://npmjs.org/package/safe-buffer
|
|
||||||
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
|
|
||||||
[standard-url]: https://standardjs.com
|
|
||||||
|
|
||||||
#### Safer Node.js Buffer API
|
|
||||||
|
|
||||||
**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`,
|
|
||||||
`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.**
|
|
||||||
|
|
||||||
**Uses the built-in implementation when available.**
|
|
||||||
|
|
||||||
## install
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install safe-buffer
|
|
||||||
```
|
|
||||||
|
|
||||||
## usage
|
|
||||||
|
|
||||||
The goal of this package is to provide a safe replacement for the node.js `Buffer`.
|
|
||||||
|
|
||||||
It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to
|
|
||||||
the top of your node.js modules:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var Buffer = require('safe-buffer').Buffer
|
|
||||||
|
|
||||||
// Existing buffer code will continue to work without issues:
|
|
||||||
|
|
||||||
new Buffer('hey', 'utf8')
|
|
||||||
new Buffer([1, 2, 3], 'utf8')
|
|
||||||
new Buffer(obj)
|
|
||||||
new Buffer(16) // create an uninitialized buffer (potentially unsafe)
|
|
||||||
|
|
||||||
// But you can use these new explicit APIs to make clear what you want:
|
|
||||||
|
|
||||||
Buffer.from('hey', 'utf8') // convert from many types to a Buffer
|
|
||||||
Buffer.alloc(16) // create a zero-filled buffer (safe)
|
|
||||||
Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)
|
|
||||||
```
|
|
||||||
|
|
||||||
## api
|
|
||||||
|
|
||||||
### Class Method: Buffer.from(array)
|
|
||||||
<!-- YAML
|
|
||||||
added: v3.0.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `array` {Array}
|
|
||||||
|
|
||||||
Allocates a new `Buffer` using an `array` of octets.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);
|
|
||||||
// creates a new Buffer containing ASCII bytes
|
|
||||||
// ['b','u','f','f','e','r']
|
|
||||||
```
|
|
||||||
|
|
||||||
A `TypeError` will be thrown if `array` is not an `Array`.
|
|
||||||
|
|
||||||
### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
||||||
<!-- YAML
|
|
||||||
added: v5.10.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or
|
|
||||||
a `new ArrayBuffer()`
|
|
||||||
* `byteOffset` {Number} Default: `0`
|
|
||||||
* `length` {Number} Default: `arrayBuffer.length - byteOffset`
|
|
||||||
|
|
||||||
When passed a reference to the `.buffer` property of a `TypedArray` instance,
|
|
||||||
the newly created `Buffer` will share the same allocated memory as the
|
|
||||||
TypedArray.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const arr = new Uint16Array(2);
|
|
||||||
arr[0] = 5000;
|
|
||||||
arr[1] = 4000;
|
|
||||||
|
|
||||||
const buf = Buffer.from(arr.buffer); // shares the memory with arr;
|
|
||||||
|
|
||||||
console.log(buf);
|
|
||||||
// Prints: <Buffer 88 13 a0 0f>
|
|
||||||
|
|
||||||
// changing the TypedArray changes the Buffer also
|
|
||||||
arr[1] = 6000;
|
|
||||||
|
|
||||||
console.log(buf);
|
|
||||||
// Prints: <Buffer 88 13 70 17>
|
|
||||||
```
|
|
||||||
|
|
||||||
The optional `byteOffset` and `length` arguments specify a memory range within
|
|
||||||
the `arrayBuffer` that will be shared by the `Buffer`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const ab = new ArrayBuffer(10);
|
|
||||||
const buf = Buffer.from(ab, 0, 2);
|
|
||||||
console.log(buf.length);
|
|
||||||
// Prints: 2
|
|
||||||
```
|
|
||||||
|
|
||||||
A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`.
|
|
||||||
|
|
||||||
### Class Method: Buffer.from(buffer)
|
|
||||||
<!-- YAML
|
|
||||||
added: v3.0.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `buffer` {Buffer}
|
|
||||||
|
|
||||||
Copies the passed `buffer` data onto a new `Buffer` instance.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const buf1 = Buffer.from('buffer');
|
|
||||||
const buf2 = Buffer.from(buf1);
|
|
||||||
|
|
||||||
buf1[0] = 0x61;
|
|
||||||
console.log(buf1.toString());
|
|
||||||
// 'auffer'
|
|
||||||
console.log(buf2.toString());
|
|
||||||
// 'buffer' (copy is not changed)
|
|
||||||
```
|
|
||||||
|
|
||||||
A `TypeError` will be thrown if `buffer` is not a `Buffer`.
|
|
||||||
|
|
||||||
### Class Method: Buffer.from(str[, encoding])
|
|
||||||
<!-- YAML
|
|
||||||
added: v5.10.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `str` {String} String to encode.
|
|
||||||
* `encoding` {String} Encoding to use, Default: `'utf8'`
|
|
||||||
|
|
||||||
Creates a new `Buffer` containing the given JavaScript string `str`. If
|
|
||||||
provided, the `encoding` parameter identifies the character encoding.
|
|
||||||
If not provided, `encoding` defaults to `'utf8'`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const buf1 = Buffer.from('this is a tést');
|
|
||||||
console.log(buf1.toString());
|
|
||||||
// prints: this is a tést
|
|
||||||
console.log(buf1.toString('ascii'));
|
|
||||||
// prints: this is a tC)st
|
|
||||||
|
|
||||||
const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
|
|
||||||
console.log(buf2.toString());
|
|
||||||
// prints: this is a tést
|
|
||||||
```
|
|
||||||
|
|
||||||
A `TypeError` will be thrown if `str` is not a string.
|
|
||||||
|
|
||||||
### Class Method: Buffer.alloc(size[, fill[, encoding]])
|
|
||||||
<!-- YAML
|
|
||||||
added: v5.10.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `size` {Number}
|
|
||||||
* `fill` {Value} Default: `undefined`
|
|
||||||
* `encoding` {String} Default: `utf8`
|
|
||||||
|
|
||||||
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
|
|
||||||
`Buffer` will be *zero-filled*.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const buf = Buffer.alloc(5);
|
|
||||||
console.log(buf);
|
|
||||||
// <Buffer 00 00 00 00 00>
|
|
||||||
```
|
|
||||||
|
|
||||||
The `size` must be less than or equal to the value of
|
|
||||||
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
|
|
||||||
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
|
|
||||||
be created if a `size` less than or equal to 0 is specified.
|
|
||||||
|
|
||||||
If `fill` is specified, the allocated `Buffer` will be initialized by calling
|
|
||||||
`buf.fill(fill)`. See [`buf.fill()`][] for more information.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const buf = Buffer.alloc(5, 'a');
|
|
||||||
console.log(buf);
|
|
||||||
// <Buffer 61 61 61 61 61>
|
|
||||||
```
|
|
||||||
|
|
||||||
If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
|
||||||
initialized by calling `buf.fill(fill, encoding)`. For example:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
|
||||||
console.log(buf);
|
|
||||||
// <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
|
||||||
```
|
|
||||||
|
|
||||||
Calling `Buffer.alloc(size)` can be significantly slower than the alternative
|
|
||||||
`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance
|
|
||||||
contents will *never contain sensitive data*.
|
|
||||||
|
|
||||||
A `TypeError` will be thrown if `size` is not a number.
|
|
||||||
|
|
||||||
### Class Method: Buffer.allocUnsafe(size)
|
|
||||||
<!-- YAML
|
|
||||||
added: v5.10.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `size` {Number}
|
|
||||||
|
|
||||||
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must
|
|
||||||
be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit
|
|
||||||
architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
|
|
||||||
thrown. A zero-length Buffer will be created if a `size` less than or equal to
|
|
||||||
0 is specified.
|
|
||||||
|
|
||||||
The underlying memory for `Buffer` instances created in this way is *not
|
|
||||||
initialized*. The contents of the newly created `Buffer` are unknown and
|
|
||||||
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
|
|
||||||
`Buffer` instances to zeroes.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const buf = Buffer.allocUnsafe(5);
|
|
||||||
console.log(buf);
|
|
||||||
// <Buffer 78 e0 82 02 01>
|
|
||||||
// (octets will be different, every time)
|
|
||||||
buf.fill(0);
|
|
||||||
console.log(buf);
|
|
||||||
// <Buffer 00 00 00 00 00>
|
|
||||||
```
|
|
||||||
|
|
||||||
A `TypeError` will be thrown if `size` is not a number.
|
|
||||||
|
|
||||||
Note that the `Buffer` module pre-allocates an internal `Buffer` instance of
|
|
||||||
size `Buffer.poolSize` that is used as a pool for the fast allocation of new
|
|
||||||
`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated
|
|
||||||
`new Buffer(size)` constructor) only when `size` is less than or equal to
|
|
||||||
`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default
|
|
||||||
value of `Buffer.poolSize` is `8192` but can be modified.
|
|
||||||
|
|
||||||
Use of this pre-allocated internal memory pool is a key difference between
|
|
||||||
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
|
||||||
Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer
|
|
||||||
pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal
|
|
||||||
Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The
|
|
||||||
difference is subtle but can be important when an application requires the
|
|
||||||
additional performance that `Buffer.allocUnsafe(size)` provides.
|
|
||||||
|
|
||||||
### Class Method: Buffer.allocUnsafeSlow(size)
|
|
||||||
<!-- YAML
|
|
||||||
added: v5.10.0
|
|
||||||
-->
|
|
||||||
|
|
||||||
* `size` {Number}
|
|
||||||
|
|
||||||
Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The
|
|
||||||
`size` must be less than or equal to the value of
|
|
||||||
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
|
|
||||||
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
|
|
||||||
be created if a `size` less than or equal to 0 is specified.
|
|
||||||
|
|
||||||
The underlying memory for `Buffer` instances created in this way is *not
|
|
||||||
initialized*. The contents of the newly created `Buffer` are unknown and
|
|
||||||
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
|
|
||||||
`Buffer` instances to zeroes.
|
|
||||||
|
|
||||||
When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
|
||||||
allocations under 4KB are, by default, sliced from a single pre-allocated
|
|
||||||
`Buffer`. This allows applications to avoid the garbage collection overhead of
|
|
||||||
creating many individually allocated Buffers. This approach improves both
|
|
||||||
performance and memory usage by eliminating the need to track and cleanup as
|
|
||||||
many `Persistent` objects.
|
|
||||||
|
|
||||||
However, in the case where a developer may need to retain a small chunk of
|
|
||||||
memory from a pool for an indeterminate amount of time, it may be appropriate
|
|
||||||
to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then
|
|
||||||
copy out the relevant bits.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// need to keep around a few small chunks of memory
|
|
||||||
const store = [];
|
|
||||||
|
|
||||||
socket.on('readable', () => {
|
|
||||||
const data = socket.read();
|
|
||||||
// allocate for retained data
|
|
||||||
const sb = Buffer.allocUnsafeSlow(10);
|
|
||||||
// copy the data into the new allocation
|
|
||||||
data.copy(sb, 0, 0, 10);
|
|
||||||
store.push(sb);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after*
|
|
||||||
a developer has observed undue memory retention in their applications.
|
|
||||||
|
|
||||||
A `TypeError` will be thrown if `size` is not a number.
|
|
||||||
|
|
||||||
### All the Rest
|
|
||||||
|
|
||||||
The rest of the `Buffer` API is exactly the same as in node.js.
|
|
||||||
[See the docs](https://nodejs.org/api/buffer.html).
|
|
||||||
|
|
||||||
|
|
||||||
## Related links
|
|
||||||
|
|
||||||
- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660)
|
|
||||||
- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4)
|
|
||||||
|
|
||||||
## Why is `Buffer` unsafe?
|
|
||||||
|
|
||||||
Today, the node.js `Buffer` constructor is overloaded to handle many different argument
|
|
||||||
types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.),
|
|
||||||
`ArrayBuffer`, and also `Number`.
|
|
||||||
|
|
||||||
The API is optimized for convenience: you can throw any type at it, and it will try to do
|
|
||||||
what you want.
|
|
||||||
|
|
||||||
Because the Buffer constructor is so powerful, you often see code like this:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Convert UTF-8 strings to hex
|
|
||||||
function toHex (str) {
|
|
||||||
return new Buffer(str).toString('hex')
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
***But what happens if `toHex` is called with a `Number` argument?***
|
|
||||||
|
|
||||||
### Remote Memory Disclosure
|
|
||||||
|
|
||||||
If an attacker can make your program call the `Buffer` constructor with a `Number`
|
|
||||||
argument, then they can make it allocate uninitialized memory from the node.js process.
|
|
||||||
This could potentially disclose TLS private keys, user data, or database passwords.
|
|
||||||
|
|
||||||
When the `Buffer` constructor is passed a `Number` argument, it returns an
|
|
||||||
**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like
|
|
||||||
this, you **MUST** overwrite the contents before returning it to the user.
|
|
||||||
|
|
||||||
From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size):
|
|
||||||
|
|
||||||
> `new Buffer(size)`
|
|
||||||
>
|
|
||||||
> - `size` Number
|
|
||||||
>
|
|
||||||
> The underlying memory for `Buffer` instances created in this way is not initialized.
|
|
||||||
> **The contents of a newly created `Buffer` are unknown and could contain sensitive
|
|
||||||
> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes.
|
|
||||||
|
|
||||||
(Emphasis our own.)
|
|
||||||
|
|
||||||
Whenever the programmer intended to create an uninitialized `Buffer` you often see code
|
|
||||||
like this:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var buf = new Buffer(16)
|
|
||||||
|
|
||||||
// Immediately overwrite the uninitialized buffer with data from another buffer
|
|
||||||
for (var i = 0; i < buf.length; i++) {
|
|
||||||
buf[i] = otherBuf[i]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Would this ever be a problem in real code?
|
|
||||||
|
|
||||||
Yes. It's surprisingly common to forget to check the type of your variables in a
|
|
||||||
dynamically-typed language like JavaScript.
|
|
||||||
|
|
||||||
Usually the consequences of assuming the wrong type is that your program crashes with an
|
|
||||||
uncaught exception. But the failure mode for forgetting to check the type of arguments to
|
|
||||||
the `Buffer` constructor is more catastrophic.
|
|
||||||
|
|
||||||
Here's an example of a vulnerable service that takes a JSON payload and converts it to
|
|
||||||
hex:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Take a JSON payload {str: "some string"} and convert it to hex
|
|
||||||
var server = http.createServer(function (req, res) {
|
|
||||||
var data = ''
|
|
||||||
req.setEncoding('utf8')
|
|
||||||
req.on('data', function (chunk) {
|
|
||||||
data += chunk
|
|
||||||
})
|
|
||||||
req.on('end', function () {
|
|
||||||
var body = JSON.parse(data)
|
|
||||||
res.end(new Buffer(body.str).toString('hex'))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
server.listen(8080)
|
|
||||||
```
|
|
||||||
|
|
||||||
In this example, an http client just has to send:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"str": 1000
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
and it will get back 1,000 bytes of uninitialized memory from the server.
|
|
||||||
|
|
||||||
This is a very serious bug. It's similar in severity to the
|
|
||||||
[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process
|
|
||||||
memory by remote attackers.
|
|
||||||
|
|
||||||
|
|
||||||
### Which real-world packages were vulnerable?
|
|
||||||
|
|
||||||
#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht)
|
|
||||||
|
|
||||||
[Mathias Buus](https://github.com/mafintosh) and I
|
|
||||||
([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages,
|
|
||||||
[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow
|
|
||||||
anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get
|
|
||||||
them to reveal 20 bytes at a time of uninitialized memory from the node.js process.
|
|
||||||
|
|
||||||
Here's
|
|
||||||
[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8)
|
|
||||||
that fixed it. We released a new fixed version, created a
|
|
||||||
[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all
|
|
||||||
vulnerable versions on npm so users will get a warning to upgrade to a newer version.
|
|
||||||
|
|
||||||
#### [`ws`](https://www.npmjs.com/package/ws)
|
|
||||||
|
|
||||||
That got us wondering if there were other vulnerable packages. Sure enough, within a short
|
|
||||||
period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the
|
|
||||||
most popular WebSocket implementation in node.js.
|
|
||||||
|
|
||||||
If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as
|
|
||||||
expected, then uninitialized server memory would be disclosed to the remote peer.
|
|
||||||
|
|
||||||
These were the vulnerable methods:
|
|
||||||
|
|
||||||
```js
|
|
||||||
socket.send(number)
|
|
||||||
socket.ping(number)
|
|
||||||
socket.pong(number)
|
|
||||||
```
|
|
||||||
|
|
||||||
Here's a vulnerable socket server with some echo functionality:
|
|
||||||
|
|
||||||
```js
|
|
||||||
server.on('connection', function (socket) {
|
|
||||||
socket.on('message', function (message) {
|
|
||||||
message = JSON.parse(message)
|
|
||||||
if (message.type === 'echo') {
|
|
||||||
socket.send(message.data) // send back the user's message
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
`socket.send(number)` called on the server, will disclose server memory.
|
|
||||||
|
|
||||||
Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue
|
|
||||||
was fixed, with a more detailed explanation. Props to
|
|
||||||
[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the
|
|
||||||
[Node Security Project disclosure](https://nodesecurity.io/advisories/67).
|
|
||||||
|
|
||||||
|
|
||||||
### What's the solution?
|
|
||||||
|
|
||||||
It's important that node.js offers a fast way to get memory otherwise performance-critical
|
|
||||||
applications would needlessly get a lot slower.
|
|
||||||
|
|
||||||
But we need a better way to *signal our intent* as programmers. **When we want
|
|
||||||
uninitialized memory, we should request it explicitly.**
|
|
||||||
|
|
||||||
Sensitive functionality should not be packed into a developer-friendly API that loosely
|
|
||||||
accepts many different types. This type of API encourages the lazy practice of passing
|
|
||||||
variables in without checking the type very carefully.
|
|
||||||
|
|
||||||
#### A new API: `Buffer.allocUnsafe(number)`
|
|
||||||
|
|
||||||
The functionality of creating buffers with uninitialized memory should be part of another
|
|
||||||
API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that
|
|
||||||
frequently gets user input of all sorts of different types passed into it.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory!
|
|
||||||
|
|
||||||
// Immediately overwrite the uninitialized buffer with data from another buffer
|
|
||||||
for (var i = 0; i < buf.length; i++) {
|
|
||||||
buf[i] = otherBuf[i]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### How do we fix node.js core?
|
|
||||||
|
|
||||||
We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as
|
|
||||||
`semver-major`) which defends against one case:
|
|
||||||
|
|
||||||
```js
|
|
||||||
var str = 16
|
|
||||||
new Buffer(str, 'utf8')
|
|
||||||
```
|
|
||||||
|
|
||||||
In this situation, it's implied that the programmer intended the first argument to be a
|
|
||||||
string, since they passed an encoding as a second argument. Today, node.js will allocate
|
|
||||||
uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not
|
|
||||||
what the programmer intended.
|
|
||||||
|
|
||||||
But this is only a partial solution, since if the programmer does `new Buffer(variable)`
|
|
||||||
(without an `encoding` parameter) there's no way to know what they intended. If `variable`
|
|
||||||
is sometimes a number, then uninitialized memory will sometimes be returned.
|
|
||||||
|
|
||||||
### What's the real long-term fix?
|
|
||||||
|
|
||||||
We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when
|
|
||||||
we need uninitialized memory. But that would break 1000s of packages.
|
|
||||||
|
|
||||||
~~We believe the best solution is to:~~
|
|
||||||
|
|
||||||
~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~
|
|
||||||
|
|
||||||
~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~
|
|
||||||
|
|
||||||
#### Update
|
|
||||||
|
|
||||||
We now support adding three new APIs:
|
|
||||||
|
|
||||||
- `Buffer.from(value)` - convert from any type to a buffer
|
|
||||||
- `Buffer.alloc(size)` - create a zero-filled buffer
|
|
||||||
- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size
|
|
||||||
|
|
||||||
This solves the core problem that affected `ws` and `bittorrent-dht` which is
|
|
||||||
`Buffer(variable)` getting tricked into taking a number argument.
|
|
||||||
|
|
||||||
This way, existing code continues working and the impact on the npm ecosystem will be
|
|
||||||
minimal. Over time, npm maintainers can migrate performance-critical code to use
|
|
||||||
`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`.
|
|
||||||
|
|
||||||
|
|
||||||
### Conclusion
|
|
||||||
|
|
||||||
We think there's a serious design issue with the `Buffer` API as it exists today. It
|
|
||||||
promotes insecure software by putting high-risk functionality into a convenient API
|
|
||||||
with friendly "developer ergonomics".
|
|
||||||
|
|
||||||
This wasn't merely a theoretical exercise because we found the issue in some of the
|
|
||||||
most popular npm packages.
|
|
||||||
|
|
||||||
Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of
|
|
||||||
`buffer`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var Buffer = require('safe-buffer').Buffer
|
|
||||||
```
|
|
||||||
|
|
||||||
Eventually, we hope that node.js core can switch to this new, safer behavior. We believe
|
|
||||||
the impact on the ecosystem would be minimal since it's not a breaking change.
|
|
||||||
Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while
|
|
||||||
older, insecure packages would magically become safe from this attack vector.
|
|
||||||
|
|
||||||
|
|
||||||
## links
|
|
||||||
|
|
||||||
- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514)
|
|
||||||
- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67)
|
|
||||||
- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68)
|
|
||||||
|
|
||||||
|
|
||||||
## credit
|
|
||||||
|
|
||||||
The original issues in `bittorrent-dht`
|
|
||||||
([disclosure](https://nodesecurity.io/advisories/68)) and
|
|
||||||
`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by
|
|
||||||
[Mathias Buus](https://github.com/mafintosh) and
|
|
||||||
[Feross Aboukhadijeh](http://feross.org/).
|
|
||||||
|
|
||||||
Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues
|
|
||||||
and for his work running the [Node Security Project](https://nodesecurity.io/).
|
|
||||||
|
|
||||||
Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and
|
|
||||||
auditing the code.
|
|
||||||
|
|
||||||
|
|
||||||
## license
|
|
||||||
|
|
||||||
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)
|
|
||||||
187
node_modules/basic-auth/node_modules/safe-buffer/index.d.ts
generated
vendored
187
node_modules/basic-auth/node_modules/safe-buffer/index.d.ts
generated
vendored
@@ -1,187 +0,0 @@
|
|||||||
declare module "safe-buffer" {
|
|
||||||
export class Buffer {
|
|
||||||
length: number
|
|
||||||
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
|
||||||
toString(encoding?: string, start?: number, end?: number): string;
|
|
||||||
toJSON(): { type: 'Buffer', data: any[] };
|
|
||||||
equals(otherBuffer: Buffer): boolean;
|
|
||||||
compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
||||||
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
||||||
slice(start?: number, end?: number): Buffer;
|
|
||||||
writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
||||||
readUInt8(offset: number, noAssert?: boolean): number;
|
|
||||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
|
||||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
|
||||||
readUInt32LE(offset: number, noAssert?: boolean): number;
|
|
||||||
readUInt32BE(offset: number, noAssert?: boolean): number;
|
|
||||||
readInt8(offset: number, noAssert?: boolean): number;
|
|
||||||
readInt16LE(offset: number, noAssert?: boolean): number;
|
|
||||||
readInt16BE(offset: number, noAssert?: boolean): number;
|
|
||||||
readInt32LE(offset: number, noAssert?: boolean): number;
|
|
||||||
readInt32BE(offset: number, noAssert?: boolean): number;
|
|
||||||
readFloatLE(offset: number, noAssert?: boolean): number;
|
|
||||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
|
||||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
|
||||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
|
||||||
swap16(): Buffer;
|
|
||||||
swap32(): Buffer;
|
|
||||||
swap64(): Buffer;
|
|
||||||
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
|
||||||
fill(value: any, offset?: number, end?: number): this;
|
|
||||||
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
|
||||||
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
|
||||||
includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocates a new buffer containing the given {str}.
|
|
||||||
*
|
|
||||||
* @param str String to store in buffer.
|
|
||||||
* @param encoding encoding to use, optional. Default is 'utf8'
|
|
||||||
*/
|
|
||||||
constructor (str: string, encoding?: string);
|
|
||||||
/**
|
|
||||||
* Allocates a new buffer of {size} octets.
|
|
||||||
*
|
|
||||||
* @param size count of octets to allocate.
|
|
||||||
*/
|
|
||||||
constructor (size: number);
|
|
||||||
/**
|
|
||||||
* Allocates a new buffer containing the given {array} of octets.
|
|
||||||
*
|
|
||||||
* @param array The octets to store.
|
|
||||||
*/
|
|
||||||
constructor (array: Uint8Array);
|
|
||||||
/**
|
|
||||||
* Produces a Buffer backed by the same allocated memory as
|
|
||||||
* the given {ArrayBuffer}.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
|
||||||
*/
|
|
||||||
constructor (arrayBuffer: ArrayBuffer);
|
|
||||||
/**
|
|
||||||
* Allocates a new buffer containing the given {array} of octets.
|
|
||||||
*
|
|
||||||
* @param array The octets to store.
|
|
||||||
*/
|
|
||||||
constructor (array: any[]);
|
|
||||||
/**
|
|
||||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
|
||||||
*
|
|
||||||
* @param buffer The buffer to copy.
|
|
||||||
*/
|
|
||||||
constructor (buffer: Buffer);
|
|
||||||
prototype: Buffer;
|
|
||||||
/**
|
|
||||||
* Allocates a new Buffer using an {array} of octets.
|
|
||||||
*
|
|
||||||
* @param array
|
|
||||||
*/
|
|
||||||
static from(array: any[]): Buffer;
|
|
||||||
/**
|
|
||||||
* When passed a reference to the .buffer property of a TypedArray instance,
|
|
||||||
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
|
||||||
* The optional {byteOffset} and {length} arguments specify a memory range
|
|
||||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
|
||||||
*
|
|
||||||
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
|
||||||
* @param byteOffset
|
|
||||||
* @param length
|
|
||||||
*/
|
|
||||||
static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
|
||||||
/**
|
|
||||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
|
||||||
*
|
|
||||||
* @param buffer
|
|
||||||
*/
|
|
||||||
static from(buffer: Buffer): Buffer;
|
|
||||||
/**
|
|
||||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
|
||||||
* If provided, the {encoding} parameter identifies the character encoding.
|
|
||||||
* If not provided, {encoding} defaults to 'utf8'.
|
|
||||||
*
|
|
||||||
* @param str
|
|
||||||
*/
|
|
||||||
static from(str: string, encoding?: string): Buffer;
|
|
||||||
/**
|
|
||||||
* Returns true if {obj} is a Buffer
|
|
||||||
*
|
|
||||||
* @param obj object to test.
|
|
||||||
*/
|
|
||||||
static isBuffer(obj: any): obj is Buffer;
|
|
||||||
/**
|
|
||||||
* Returns true if {encoding} is a valid encoding argument.
|
|
||||||
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
||||||
*
|
|
||||||
* @param encoding string to test.
|
|
||||||
*/
|
|
||||||
static isEncoding(encoding: string): boolean;
|
|
||||||
/**
|
|
||||||
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
|
||||||
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
|
||||||
*
|
|
||||||
* @param string string to test.
|
|
||||||
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
|
||||||
*/
|
|
||||||
static byteLength(string: string, encoding?: string): number;
|
|
||||||
/**
|
|
||||||
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
|
||||||
*
|
|
||||||
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
|
||||||
* If the list has exactly one item, then the first item of the list is returned.
|
|
||||||
* If the list has more than one item, then a new Buffer is created.
|
|
||||||
*
|
|
||||||
* @param list An array of Buffer objects to concatenate
|
|
||||||
* @param totalLength Total length of the buffers when concatenated.
|
|
||||||
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
|
||||||
*/
|
|
||||||
static concat(list: Buffer[], totalLength?: number): Buffer;
|
|
||||||
/**
|
|
||||||
* The same as buf1.compare(buf2).
|
|
||||||
*/
|
|
||||||
static compare(buf1: Buffer, buf2: Buffer): number;
|
|
||||||
/**
|
|
||||||
* Allocates a new buffer of {size} octets.
|
|
||||||
*
|
|
||||||
* @param size count of octets to allocate.
|
|
||||||
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
|
||||||
* If parameter is omitted, buffer will be filled with zeros.
|
|
||||||
* @param encoding encoding used for call to buf.fill while initalizing
|
|
||||||
*/
|
|
||||||
static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
|
||||||
/**
|
|
||||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
|
||||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
||||||
*
|
|
||||||
* @param size count of octets to allocate
|
|
||||||
*/
|
|
||||||
static allocUnsafe(size: number): Buffer;
|
|
||||||
/**
|
|
||||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
|
||||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
||||||
*
|
|
||||||
* @param size count of octets to allocate
|
|
||||||
*/
|
|
||||||
static allocUnsafeSlow(size: number): Buffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user