update
This commit is contained in:
parent
d9becc67b6
commit
9308795b8b
|
@ -10,5 +10,4 @@ An action that builds a Debian package from source.
|
||||||
with:
|
with:
|
||||||
source_directory: lolcat # optional, relative to workspace directory
|
source_directory: lolcat # optional, relative to workspace directory
|
||||||
artifacts_directory: output # optional, relative to workspace directory
|
artifacts_directory: output # optional, relative to workspace directory
|
||||||
os: debian # or ubuntu, defaults to debian
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -12,10 +12,6 @@ inputs:
|
||||||
description: Directory where build artifacts will be placed, relative to workspace
|
description: Directory where build artifacts will be placed, relative to workspace
|
||||||
required: false
|
required: false
|
||||||
default: ./
|
default: ./
|
||||||
os:
|
|
||||||
description: '"ubuntu" or "debian"'
|
|
||||||
required: false
|
|
||||||
default: debian
|
|
||||||
runs:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
main: main.js
|
main: main.js
|
||||||
|
|
40
main.js
40
main.js
|
@ -1,23 +1,41 @@
|
||||||
const core = require("@actions/core")
|
const core = require("@actions/core")
|
||||||
const exec = require("@actions/exec")
|
const exec = require("@actions/exec")
|
||||||
const firstline = require("firstline")
|
const firstline = require("firstline")
|
||||||
|
const hub = require("docker-hub-utils")
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
|
|
||||||
|
function getDistribution(distribution) {
|
||||||
|
return distribution.replace("UNRELEASED", "unstable")
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getOS(distribution) {
|
||||||
|
for (const os of ["debian", "ubuntu"]) {
|
||||||
|
const tags = await hub.queryTags({ user: "library", name: os })
|
||||||
|
if (tags.find(tag => tag.name == distribution)) {
|
||||||
|
return os
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
const sourceDirectory = core.getInput("source_directory", { required: true })
|
const sourceRelativeDirectory = core.getInput("source_directory")
|
||||||
const artifactsDirectory = core.getInput("artifacts_directory", { required: true })
|
const artifactsRelativeDirectory = core.getInput("artifacts_directory")
|
||||||
const os = core.getInput("os", { required: true })
|
|
||||||
|
|
||||||
const workspaceDirectory = process.cwd()
|
const workspaceDirectory = process.cwd()
|
||||||
const file = path.join(workspaceDirectory, sourceDirectory, "debian/changelog")
|
const sourceDirectory = path.join(workspaceDirectory, sourceRelativeDirectory)
|
||||||
|
const buildDirectory = path.dirname(sourceDirectory)
|
||||||
|
const artifactsDirectory = path.join(workspaceDirectory, artifactsRelativeDirectory)
|
||||||
|
|
||||||
|
const file = path.join(sourceDirectory, "debian/changelog")
|
||||||
const changelog = await firstline(file)
|
const changelog = await firstline(file)
|
||||||
const regex = /^(?<package>.+) \((?<version>[^-]+)-?(?<revision>[^-]+)?\) (?<distribution>.+); (?<options>.+)$/
|
const regex = /^(?<package>.+) \((?<version>[^-]+)-?(?<revision>[^-]+)?\) (?<distribution>.+);/
|
||||||
const match = changelog.match(regex)
|
const match = changelog.match(regex)
|
||||||
const { package, version, revision, distribution } = match.groups
|
const { package, version, revision, distribution } = match.groups
|
||||||
|
const os = await getOS(getDistribution(distribution))
|
||||||
const container = package + "_" + version
|
const container = package + "_" + version
|
||||||
const image = os + ":" + distribution.replace("UNRELEASED", "unstable")
|
const image = os + ":" + getDistribution(distribution)
|
||||||
|
|
||||||
fs.mkdirSync(artifactsDirectory, { recursive: true })
|
fs.mkdirSync(artifactsDirectory, { recursive: true })
|
||||||
|
|
||||||
|
@ -25,8 +43,8 @@ async function main() {
|
||||||
await exec.exec("docker", [
|
await exec.exec("docker", [
|
||||||
"create",
|
"create",
|
||||||
"--name", container,
|
"--name", container,
|
||||||
"--volume", workspaceDirectory + ":" + workspaceDirectory,
|
"--volume", sourceDirectory + ":" + sourceDirectory,
|
||||||
"--workdir", path.join(workspaceDirectory, sourceDirectory),
|
"--workdir", sourceDirectory,
|
||||||
"--tty",
|
"--tty",
|
||||||
image,
|
image,
|
||||||
"sleep", "inf"
|
"sleep", "inf"
|
||||||
|
@ -49,7 +67,7 @@ async function main() {
|
||||||
"--exclude-vcs",
|
"--exclude-vcs",
|
||||||
"--exclude", "./debian",
|
"--exclude", "./debian",
|
||||||
"--transform", `s/^\./${package}-${version}/`,
|
"--transform", `s/^\./${package}-${version}/`,
|
||||||
"-cvzf", `../${package}_${version}.orig.tar.gz`,
|
"-cvzf", `${buildDirectory}/${package}_${version}.orig.tar.gz`,
|
||||||
"./"
|
"./"
|
||||||
])
|
])
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
@ -75,7 +93,7 @@ async function main() {
|
||||||
await exec.exec("docker", [
|
await exec.exec("docker", [
|
||||||
"exec",
|
"exec",
|
||||||
container,
|
container,
|
||||||
"apt-get", "build-dep", "-y", "./"
|
"apt-get", "build-dep", "-y", sourceDirectory
|
||||||
])
|
])
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
|
@ -92,7 +110,7 @@ async function main() {
|
||||||
"exec",
|
"exec",
|
||||||
container,
|
container,
|
||||||
"find",
|
"find",
|
||||||
"..",
|
buildDirectory,
|
||||||
"-maxdepth", "1",
|
"-maxdepth", "1",
|
||||||
"-name", `${package}_${version}*.*`,
|
"-name", `${package}_${version}*.*`,
|
||||||
"-type", "f",
|
"-type", "f",
|
||||||
|
|
1
node_modules/.bin/pino
generated
vendored
Symbolic link
1
node_modules/.bin/pino
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../pino/bin.js
|
11
node_modules/atomic-sleep/.travis.yml
generated
vendored
Normal file
11
node_modules/atomic-sleep/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
language: node_js
|
||||||
|
sudo: false
|
||||||
|
node_js:
|
||||||
|
- 6
|
||||||
|
- 8
|
||||||
|
- 10
|
||||||
|
- 11
|
||||||
|
- 12
|
||||||
|
- 13
|
||||||
|
script:
|
||||||
|
- npm run ci
|
22
node_modules/atomic-sleep/LICENSE
generated
vendored
Normal file
22
node_modules/atomic-sleep/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2020 David Mark Clements
|
||||||
|
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||||
|
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
38
node_modules/atomic-sleep/index.js
generated
vendored
Normal file
38
node_modules/atomic-sleep/index.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/* global SharedArrayBuffer, Atomics */
|
||||||
|
|
||||||
|
if (typeof SharedArrayBuffer !== 'undefined' && typeof Atomics !== 'undefined') {
|
||||||
|
const nil = new Int32Array(new SharedArrayBuffer(4))
|
||||||
|
|
||||||
|
function sleep (ms) {
|
||||||
|
// also filters out NaN, non-number types, including empty strings, but allows bigints
|
||||||
|
const valid = ms > 0 && ms < Infinity
|
||||||
|
if (valid === false) {
|
||||||
|
if (typeof ms !== 'number' && typeof ms !== 'bigint') {
|
||||||
|
throw TypeError('sleep: ms must be a number')
|
||||||
|
}
|
||||||
|
throw RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity')
|
||||||
|
}
|
||||||
|
|
||||||
|
Atomics.wait(nil, 0, 0, Number(ms))
|
||||||
|
}
|
||||||
|
module.exports = sleep
|
||||||
|
} else {
|
||||||
|
|
||||||
|
function sleep (ms) {
|
||||||
|
// also filters out NaN, non-number types, including empty strings, but allows bigints
|
||||||
|
const valid = ms > 0 && ms < Infinity
|
||||||
|
if (valid === false) {
|
||||||
|
if (typeof ms !== 'number' && typeof ms !== 'bigint') {
|
||||||
|
throw TypeError('sleep: ms must be a number')
|
||||||
|
}
|
||||||
|
throw RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity')
|
||||||
|
}
|
||||||
|
const target = Date.now() + Number(ms)
|
||||||
|
while (target > Date.now()){}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = sleep
|
||||||
|
|
||||||
|
}
|
65
node_modules/atomic-sleep/package.json
generated
vendored
Normal file
65
node_modules/atomic-sleep/package.json
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
"_from": "atomic-sleep@^1.0.0",
|
||||||
|
"_id": "atomic-sleep@1.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==",
|
||||||
|
"_location": "/atomic-sleep",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "atomic-sleep@^1.0.0",
|
||||||
|
"name": "atomic-sleep",
|
||||||
|
"escapedName": "atomic-sleep",
|
||||||
|
"rawSpec": "^1.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/sonic-boom"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
|
||||||
|
"_shasum": "eb85b77a601fc932cfe432c5acd364a9e2c9075b",
|
||||||
|
"_spec": "atomic-sleep@^1.0.0",
|
||||||
|
"_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/sonic-boom",
|
||||||
|
"author": {
|
||||||
|
"name": "David Mark Clements",
|
||||||
|
"url": "@davidmarkclem"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/davidmarkclements/atomic-sleep/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Zero CPU overhead, zero dependency, true event-loop blocking sleep",
|
||||||
|
"devDependencies": {
|
||||||
|
"standard": "^14.3.1",
|
||||||
|
"tap": "^14.10.6",
|
||||||
|
"tape": "^4.13.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/davidmarkclements/atomic-sleep#readme",
|
||||||
|
"keywords": [
|
||||||
|
"sleep",
|
||||||
|
"pause",
|
||||||
|
"wait",
|
||||||
|
"performance",
|
||||||
|
"atomics"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "atomic-sleep",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/davidmarkclements/atomic-sleep.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"ci": "npm run lint && npm test",
|
||||||
|
"lint": "standard",
|
||||||
|
"test": "tap -R classic- -j1 test"
|
||||||
|
},
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
58
node_modules/atomic-sleep/readme.md
generated
vendored
Normal file
58
node_modules/atomic-sleep/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<h1 align="center">Welcome to atomic-sleep ⏱️</h1>
|
||||||
|
<p>
|
||||||
|
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
|
||||||
|
<a href="#" target="_blank">
|
||||||
|
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
|
||||||
|
</a>
|
||||||
|
<a href="https://twitter.com/davidmarkclem" target="_blank">
|
||||||
|
<img alt="Twitter: davidmarkclem" src="https://img.shields.io/twitter/follow/davidmarkclem.svg?style=social" />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
> Zero CPU overhead, zero dependency, true event-loop blocking sleep
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const sleep = require('atomic-sleep')
|
||||||
|
|
||||||
|
console.time('sleep')
|
||||||
|
setTimeout(() => { console.timeEnd('sleep') }, 100)
|
||||||
|
sleep(1000)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `console.time` will report a time of just over 1000ms despite the `setTimeout`
|
||||||
|
being 100ms. This is because the event loop is paused for 1000ms and the setTimeout
|
||||||
|
fires immediately after the event loop is no longer blocked (as more than 100ms have passed).
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run tests
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Node and Browser versions that support both `SharedArrayBuffer` and `Atomics` will have (virtually) zero CPU overhead sleep.
|
||||||
|
|
||||||
|
For Node, Atomic Sleep can provide zero CPU overhead sleep from Node 8 and up.
|
||||||
|
|
||||||
|
For browser support see https://caniuse.com/#feat=sharedarraybuffer and https://caniuse.com/#feat=mdn-javascript_builtins_atomics.
|
||||||
|
|
||||||
|
|
||||||
|
For older Node versions and olders browsers we fall back to blocking the event loop in a way that will cause a CPU spike.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
👤 **David Mark Clements (@davidmarkclem)**
|
||||||
|
|
||||||
|
* Twitter: [@davidmarkclem](https://twitter.com/davidmarkclem)
|
||||||
|
* Github: [@davidmarkclements](https://github.com/davidmarkclements)
|
47
node_modules/atomic-sleep/test.js
generated
vendored
Normal file
47
node_modules/atomic-sleep/test.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
'use strict'
|
||||||
|
const test = require('tape')
|
||||||
|
const sleep = require('.')
|
||||||
|
|
||||||
|
test('blocks event loop for given amount of milliseconds', ({ is, end }) => {
|
||||||
|
const now = Date.now()
|
||||||
|
setTimeout(() => {
|
||||||
|
const delta = Date.now() - now
|
||||||
|
const fuzzyDelta = Math.floor(delta / 10) * 10 // allow up to 10ms of execution lag
|
||||||
|
is(fuzzyDelta, 1000)
|
||||||
|
end()
|
||||||
|
}, 100)
|
||||||
|
sleep(1000)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (typeof BigInt !== 'undefined') {
|
||||||
|
|
||||||
|
test('allows ms to be supplied as a BigInt number', ({ is, end }) => {
|
||||||
|
const now = Date.now()
|
||||||
|
setTimeout(() => {
|
||||||
|
const delta = Date.now() - now
|
||||||
|
const fuzzyDelta = Math.floor(delta / 10) * 10 // allow up to 10ms of execution lag
|
||||||
|
is(fuzzyDelta, 1000)
|
||||||
|
end()
|
||||||
|
}, 100)
|
||||||
|
sleep(BigInt(1000)) // avoiding n notation as this will error on legacy node/browsers
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
test('throws range error if ms less than 0', ({ throws, end }) => {
|
||||||
|
throws(() => sleep(-1), RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity'))
|
||||||
|
end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('throws range error if ms is Infinity', ({ throws, end }) => {
|
||||||
|
throws(() => sleep(Infinity), RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity'))
|
||||||
|
end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('throws range error if ms is not a number or bigint', ({ throws, end }) => {
|
||||||
|
throws(() => sleep('Infinity'), TypeError('sleep: ms must be a number'))
|
||||||
|
throws(() => sleep('foo'), TypeError('sleep: ms must be a number'))
|
||||||
|
throws(() => sleep({a: 1}), TypeError('sleep: ms must be a number'))
|
||||||
|
throws(() => sleep([1,2,3]), TypeError('sleep: ms must be a number'))
|
||||||
|
end()
|
||||||
|
})
|
413
node_modules/axios/CHANGELOG.md
generated
vendored
Normal file
413
node_modules/axios/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,413 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
### 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))
|
||||||
|
- Add typescript HTTP method definition for LINK and UNLINK ([#2444](https://github.com/axios/axios/pull/2444))
|
||||||
|
|
||||||
|
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))
|
||||||
|
- upadating 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 faciliate serialization ([#1625](https://github.com/axios/axios/issues/1625))
|
||||||
|
- Add second then on axios call ([#1623](https://github.com/axios/axios/issues/1623))
|
||||||
|
- Typings: allow custom return types
|
||||||
|
- Add option to specify character set in responses (with http adapter)
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
|
||||||
|
- Fix Keep defaults local to instance ([#385](https://github.com/axios/axios/issues/385))
|
||||||
|
- Correctly catch exception in http test ([#1475](https://github.com/axios/axios/issues/1475))
|
||||||
|
- Fix accept header normalization ([#1698](https://github.com/axios/axios/issues/1698))
|
||||||
|
- Fix http adapter to allow HTTPS connections via HTTP ([#959](https://github.com/axios/axios/issues/959))
|
||||||
|
- Fix Removes usage of deprecated Buffer constructor. ([#1555](https://github.com/axios/axios/issues/1555), [#1622](https://github.com/axios/axios/issues/1622))
|
||||||
|
- Fix defaults to use httpAdapter if available ([#1285](https://github.com/axios/axios/issues/1285))
|
||||||
|
- Fixing defaults to use httpAdapter if available
|
||||||
|
- Use a safer, cross-platform method to detect the Node environment
|
||||||
|
- Fix Reject promise if request is cancelled by the browser ([#537](https://github.com/axios/axios/issues/537))
|
||||||
|
- [Typescript] Fix missing type parameters on delete/head methods
|
||||||
|
- [NS]: Send `false` flag isStandardBrowserEnv for Nativescript
|
||||||
|
- Fix missing type parameters on delete/head
|
||||||
|
- Fix Default method for an instance always overwritten by get
|
||||||
|
- Fix type error when socketPath option in AxiosRequestConfig
|
||||||
|
- Capture errors on request data streams
|
||||||
|
- Decorate resolve and reject to clear timeout in all cases
|
||||||
|
|
||||||
|
Huge thanks to everyone who contributed to this release via code (authors listed
|
||||||
|
below) or via reviews and triaging on GitHub:
|
||||||
|
|
||||||
|
- Andrew Scott <ascott18@gmail.com>
|
||||||
|
- Anthony Gauthier <antho325@hotmail.com>
|
||||||
|
- arpit <arpit2438735@gmail.com>
|
||||||
|
- ascott18
|
||||||
|
- Benedikt Rötsch <axe312ger@users.noreply.github.com>
|
||||||
|
- Chance Dickson <me@chancedickson.com>
|
||||||
|
- Dave Stewart <info@davestewart.co.uk>
|
||||||
|
- Deric Cain <deric.cain@gmail.com>
|
||||||
|
- Guillaume Briday <guillaumebriday@gmail.com>
|
||||||
|
- Jacob Wejendorp <jacob@wejendorp.dk>
|
||||||
|
- Jim Lynch <mrdotjim@gmail.com>
|
||||||
|
- johntron
|
||||||
|
- Justin Beckwith <beckwith@google.com>
|
||||||
|
- Justin Beckwith <justin.beckwith@gmail.com>
|
||||||
|
- Khaled Garbaya <khaledgarbaya@gmail.com>
|
||||||
|
- Lim Jing Rong <jjingrong@users.noreply.github.com>
|
||||||
|
- Mark van den Broek <mvdnbrk@gmail.com>
|
||||||
|
- Martti Laine <martti@codeclown.net>
|
||||||
|
- mattridley
|
||||||
|
- mattridley <matt.r@joinblink.com>
|
||||||
|
- Nicolas Del Valle <nicolas.delvalle@gmail.com>
|
||||||
|
- Nilegfx
|
||||||
|
- pbarbiero
|
||||||
|
- Rikki Gibson <rikkigibson@gmail.com>
|
||||||
|
- Sako Hartounian <sakohartounian@yahoo.com>
|
||||||
|
- Shane Fitzpatrick <fitzpasd@gmail.com>
|
||||||
|
- Stephan Schneider <stephanschndr@gmail.com>
|
||||||
|
- Steven <steven@ceriously.com>
|
||||||
|
- Tim Garthwaite <tim.garthwaite@jibo.com>
|
||||||
|
- Tim Johns <timjohns@yahoo.com>
|
||||||
|
- Yutaro Miyazaki <yutaro@studio-rubbish.com>
|
||||||
|
|
||||||
|
### 0.18.0 (Feb 19, 2018)
|
||||||
|
|
||||||
|
- Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070))
|
||||||
|
- Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)):
|
||||||
|
- AxiosRequestConfig.proxy: allows type false
|
||||||
|
- AxiosProxyConfig: added auth field
|
||||||
|
- Adding function signature in AxiosInstance interface so AxiosInstance can be invoked ([#1192](https://github.com/axios/axios/pull/1192), [#1254](https://github.com/axios/axios/pull/1254))
|
||||||
|
- Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287))
|
||||||
|
- Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342))
|
||||||
|
|
||||||
|
### 0.17.1 (Nov 11, 2017)
|
||||||
|
|
||||||
|
- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))
|
||||||
|
- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080))
|
||||||
|
- Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131))
|
||||||
|
|
||||||
|
### 0.17.0 (Oct 21, 2017)
|
||||||
|
|
||||||
|
- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))
|
||||||
|
- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874))
|
||||||
|
- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691))
|
||||||
|
- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061))
|
||||||
|
|
||||||
|
### 0.16.2 (Jun 3, 2017)
|
||||||
|
|
||||||
|
- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))
|
||||||
|
- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830))
|
||||||
|
- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930))
|
||||||
|
|
||||||
|
### 0.16.1 (Apr 8, 2017)
|
||||||
|
|
||||||
|
- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))
|
||||||
|
- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829))
|
||||||
|
- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773))
|
||||||
|
|
||||||
|
### 0.16.0 (Mar 31, 2017)
|
||||||
|
|
||||||
|
- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))
|
||||||
|
- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461))
|
||||||
|
- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654))
|
||||||
|
- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731))
|
||||||
|
- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581))
|
||||||
|
- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561))
|
||||||
|
|
||||||
|
### 0.15.3 (Nov 27, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))
|
||||||
|
- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519))
|
||||||
|
- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509))
|
||||||
|
- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507))
|
||||||
|
- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483))
|
||||||
|
- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493))
|
||||||
|
- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491))
|
||||||
|
|
||||||
|
### 0.15.2 (Oct 17, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482))
|
||||||
|
|
||||||
|
### 0.15.1 (Oct 14, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
|
||||||
|
|
||||||
|
### 0.15.0 (Oct 10, 2016)
|
||||||
|
|
||||||
|
- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))
|
||||||
|
- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437))
|
||||||
|
- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440))
|
||||||
|
- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445))
|
||||||
|
|
||||||
|
### 0.14.0 (Aug 27, 2016)
|
||||||
|
|
||||||
|
- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))
|
||||||
|
- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387))
|
||||||
|
- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423))
|
||||||
|
- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366))
|
||||||
|
- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397))
|
||||||
|
- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406))
|
||||||
|
|
||||||
|
### 0.13.1 (Jul 16, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378))
|
||||||
|
|
||||||
|
### 0.13.0 (Jul 13, 2016)
|
||||||
|
|
||||||
|
- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))
|
||||||
|
- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
|
||||||
|
- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
|
||||||
|
- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343))
|
||||||
|
- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352))
|
||||||
|
- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341))
|
||||||
|
- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217))
|
||||||
|
|
||||||
|
### 0.12.0 (May 31, 2016)
|
||||||
|
|
||||||
|
- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))
|
||||||
|
- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307))
|
||||||
|
|
||||||
|
### 0.11.1 (May 17, 2016)
|
||||||
|
|
||||||
|
- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))
|
||||||
|
- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325))
|
||||||
|
- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321))
|
||||||
|
|
||||||
|
### 0.11.0 (Apr 26, 2016)
|
||||||
|
|
||||||
|
- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))
|
||||||
|
- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308))
|
||||||
|
- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299))
|
||||||
|
|
||||||
|
### 0.10.0 (Apr 20, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))
|
||||||
|
- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252))
|
||||||
|
- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227))
|
||||||
|
- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249))
|
||||||
|
- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251))
|
||||||
|
- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275))
|
||||||
|
- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279))
|
||||||
|
- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200))
|
||||||
|
|
||||||
|
### 0.9.1 (Jan 24, 2016)
|
||||||
|
|
||||||
|
- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))
|
||||||
|
- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205))
|
||||||
|
- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201))
|
||||||
|
- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198))
|
||||||
|
|
||||||
|
### 0.9.0 (Jan 18, 2016)
|
||||||
|
|
||||||
|
- Adding support for custom adapters
|
||||||
|
- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195))
|
||||||
|
- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185))
|
||||||
|
- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183))
|
||||||
|
- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182))
|
||||||
|
|
||||||
|
### 0.8.1 (Dec 14, 2015)
|
||||||
|
|
||||||
|
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))
|
||||||
|
- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173))
|
||||||
|
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174))
|
||||||
|
|
||||||
|
### 0.8.0 (Dec 11, 2015)
|
||||||
|
|
||||||
|
- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))
|
||||||
|
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128))
|
||||||
|
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121))
|
||||||
|
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127))
|
||||||
|
- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146))
|
||||||
|
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149))
|
||||||
|
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140))
|
||||||
|
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167))
|
||||||
|
- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160))
|
||||||
|
|
||||||
|
### 0.7.0 (Sep 29, 2015)
|
||||||
|
|
||||||
|
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))
|
||||||
|
- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102))
|
||||||
|
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106))
|
||||||
|
- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105))
|
||||||
|
- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112))
|
||||||
|
- Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98))
|
||||||
|
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116))
|
||||||
|
|
||||||
|
### 0.6.0 (Sep 21, 2015)
|
||||||
|
|
||||||
|
- Removing deprecated success/error aliases
|
||||||
|
- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49))
|
||||||
|
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69))
|
||||||
|
- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56))
|
||||||
|
- Removing es6-promise dependency
|
||||||
|
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91))
|
||||||
|
- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85))
|
||||||
|
- Converting build to UMD
|
||||||
|
|
||||||
|
### 0.5.4 (Apr 08, 2015)
|
||||||
|
|
||||||
|
- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53))
|
||||||
|
|
||||||
|
### 0.5.3 (Apr 07, 2015)
|
||||||
|
|
||||||
|
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
|
||||||
|
|
||||||
|
### 0.5.2 (Mar 13, 2015)
|
||||||
|
|
||||||
|
- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46))
|
||||||
|
|
||||||
|
### 0.5.1 (Mar 10, 2015)
|
||||||
|
|
||||||
|
- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))
|
||||||
|
- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47))
|
||||||
|
|
||||||
|
### 0.5.0 (Jan 23, 2015)
|
||||||
|
|
||||||
|
- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))
|
||||||
|
- Updating es6-promise dependency
|
||||||
|
|
||||||
|
### 0.4.2 (Dec 10, 2014)
|
||||||
|
|
||||||
|
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))
|
||||||
|
- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25))
|
||||||
|
- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29))
|
||||||
|
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30))
|
||||||
|
|
||||||
|
### 0.4.1 (Oct 15, 2014)
|
||||||
|
|
||||||
|
- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18))
|
||||||
|
|
||||||
|
### 0.4.0 (Oct 03, 2014)
|
||||||
|
|
||||||
|
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))
|
||||||
|
- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13))
|
||||||
|
- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12))
|
||||||
|
- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9))
|
||||||
|
- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11))
|
||||||
|
- Deprecating `success`/`error` in favor of `then`/`catch`
|
||||||
|
|
||||||
|
### 0.3.1 (Sep 16, 2014)
|
||||||
|
|
||||||
|
- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3))
|
||||||
|
|
||||||
|
### 0.3.0 (Sep 16, 2014)
|
||||||
|
|
||||||
|
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))
|
||||||
|
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6))
|
||||||
|
- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7))
|
||||||
|
|
||||||
|
### 0.2.2 (Sep 14, 2014)
|
||||||
|
|
||||||
|
- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
|
||||||
|
|
||||||
|
### 0.2.1 (Sep 12, 2014)
|
||||||
|
|
||||||
|
- Fixing build problem causing ridiculous file sizes
|
||||||
|
|
||||||
|
### 0.2.0 (Sep 12, 2014)
|
||||||
|
|
||||||
|
- Adding support for `all` and `spread`
|
||||||
|
- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1))
|
||||||
|
|
||||||
|
### 0.1.0 (Aug 29, 2014)
|
||||||
|
|
||||||
|
- Initial release
|
19
node_modules/axios/LICENSE
generated
vendored
Normal file
19
node_modules/axios/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2014-present Matt Zabriskie
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
709
node_modules/axios/README.md
generated
vendored
Executable file
709
node_modules/axios/README.md
generated
vendored
Executable file
|
@ -0,0 +1,709 @@
|
||||||
|
# axios
|
||||||
|
|
||||||
|
[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
|
||||||
|
[![build status](https://img.shields.io/travis/axios/axios/master.svg?style=flat-square)](https://travis-ci.org/axios/axios)
|
||||||
|
[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
|
||||||
|
[![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
|
||||||
|
[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
|
||||||
|
[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
|
||||||
|
[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
|
||||||
|
|
||||||
|
Promise based HTTP client for the browser and node.js
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
|
||||||
|
- Make [http](http://nodejs.org/api/http.html) requests from node.js
|
||||||
|
- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
|
||||||
|
- Intercept request and response
|
||||||
|
- Transform request and response data
|
||||||
|
- Cancel requests
|
||||||
|
- Automatic transforms for JSON data
|
||||||
|
- Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
|
||||||
|
|
||||||
|
## Browser Support
|
||||||
|
|
||||||
|
![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
|
||||||
|
--- | --- | --- | --- | --- | --- |
|
||||||
|
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
|
||||||
|
|
||||||
|
[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install axios
|
||||||
|
```
|
||||||
|
|
||||||
|
Using bower:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ bower install axios
|
||||||
|
```
|
||||||
|
|
||||||
|
Using yarn:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ yarn add axios
|
||||||
|
```
|
||||||
|
|
||||||
|
Using cdn:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
### 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);
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
// always executed
|
||||||
|
});
|
||||||
|
|
||||||
|
// Optionally the request above could also be done as
|
||||||
|
axios.get('/user', {
|
||||||
|
params: {
|
||||||
|
ID: 12345
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
// always executed
|
||||||
|
});
|
||||||
|
|
||||||
|
// Want to use async/await? Add the `async` keyword to your outer function/method.
|
||||||
|
async function getUser() {
|
||||||
|
try {
|
||||||
|
const response = await axios.get('/user?ID=12345');
|
||||||
|
console.log(response);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
|
||||||
|
> Explorer and older browsers, so use with caution.
|
||||||
|
|
||||||
|
Performing a `POST` request
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.post('/user', {
|
||||||
|
firstName: 'Fred',
|
||||||
|
lastName: 'Flintstone'
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Performing multiple concurrent requests
|
||||||
|
|
||||||
|
```js
|
||||||
|
function getUserAccount() {
|
||||||
|
return axios.get('/user/12345');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUserPermissions() {
|
||||||
|
return axios.get('/user/12345/permissions');
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.all([getUserAccount(), getUserPermissions()])
|
||||||
|
.then(axios.spread(function (acct, perms) {
|
||||||
|
// Both requests are now complete
|
||||||
|
}));
|
||||||
|
```
|
||||||
|
|
||||||
|
## axios API
|
||||||
|
|
||||||
|
Requests can be made by passing the relevant config to `axios`.
|
||||||
|
|
||||||
|
##### axios(config)
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Send a POST request
|
||||||
|
axios({
|
||||||
|
method: 'post',
|
||||||
|
url: '/user/12345',
|
||||||
|
data: {
|
||||||
|
firstName: 'Fred',
|
||||||
|
lastName: 'Flintstone'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// GET request for remote image
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: 'http://bit.ly/2mTM3nY',
|
||||||
|
responseType: 'stream'
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
##### axios(url[, config])
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Send a GET request (default method)
|
||||||
|
axios('/user/12345');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Request method aliases
|
||||||
|
|
||||||
|
For convenience aliases have been provided for all supported request methods.
|
||||||
|
|
||||||
|
##### axios.request(config)
|
||||||
|
##### axios.get(url[, config])
|
||||||
|
##### axios.delete(url[, config])
|
||||||
|
##### axios.head(url[, config])
|
||||||
|
##### axios.options(url[, config])
|
||||||
|
##### axios.post(url[, data[, config]])
|
||||||
|
##### axios.put(url[, data[, config]])
|
||||||
|
##### axios.patch(url[, data[, config]])
|
||||||
|
|
||||||
|
###### NOTE
|
||||||
|
When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
|
||||||
|
|
||||||
|
### Concurrency
|
||||||
|
|
||||||
|
Helper functions for dealing with concurrent requests.
|
||||||
|
|
||||||
|
##### axios.all(iterable)
|
||||||
|
##### axios.spread(callback)
|
||||||
|
|
||||||
|
### Creating an instance
|
||||||
|
|
||||||
|
You can create a new instance of axios with a custom config.
|
||||||
|
|
||||||
|
##### axios.create([config])
|
||||||
|
|
||||||
|
```js
|
||||||
|
const instance = axios.create({
|
||||||
|
baseURL: 'https://some-domain.com/api/',
|
||||||
|
timeout: 1000,
|
||||||
|
headers: {'X-Custom-Header': 'foobar'}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Instance methods
|
||||||
|
|
||||||
|
The available instance methods are listed below. The specified config will be merged with the instance config.
|
||||||
|
|
||||||
|
##### axios#request(config)
|
||||||
|
##### axios#get(url[, config])
|
||||||
|
##### axios#delete(url[, config])
|
||||||
|
##### axios#head(url[, config])
|
||||||
|
##### axios#options(url[, config])
|
||||||
|
##### axios#post(url[, data[, config]])
|
||||||
|
##### axios#put(url[, data[, config]])
|
||||||
|
##### axios#patch(url[, data[, config]])
|
||||||
|
##### axios#getUri([config])
|
||||||
|
|
||||||
|
## Request Config
|
||||||
|
|
||||||
|
These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// `url` is the server URL that will be used for the request
|
||||||
|
url: '/user',
|
||||||
|
|
||||||
|
// `method` is the request method to be used when making the request
|
||||||
|
method: 'get', // default
|
||||||
|
|
||||||
|
// `baseURL` will be prepended to `url` unless `url` is absolute.
|
||||||
|
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
||||||
|
// to methods of that instance.
|
||||||
|
baseURL: 'https://some-domain.com/api/',
|
||||||
|
|
||||||
|
// `transformRequest` allows changes to the request data before it is sent to the server
|
||||||
|
// This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
|
||||||
|
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
||||||
|
// FormData or Stream
|
||||||
|
// You may modify the headers object.
|
||||||
|
transformRequest: [function (data, headers) {
|
||||||
|
// Do whatever you want to transform the data
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
// `transformResponse` allows changes to the response data to be made before
|
||||||
|
// it is passed to then/catch
|
||||||
|
transformResponse: [function (data) {
|
||||||
|
// Do whatever you want to transform the data
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
// `headers` are custom headers to be sent
|
||||||
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
|
|
||||||
|
// `params` are the URL parameters to be sent with the request
|
||||||
|
// Must be a plain object or a URLSearchParams object
|
||||||
|
params: {
|
||||||
|
ID: 12345
|
||||||
|
},
|
||||||
|
|
||||||
|
// `paramsSerializer` is an optional function in charge of serializing `params`
|
||||||
|
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
|
||||||
|
paramsSerializer: function (params) {
|
||||||
|
return Qs.stringify(params, {arrayFormat: 'brackets'})
|
||||||
|
},
|
||||||
|
|
||||||
|
// `data` is the data to be sent as the request body
|
||||||
|
// Only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||||
|
// When no `transformRequest` is set, must be of one of the following types:
|
||||||
|
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
|
||||||
|
// - Browser only: FormData, File, Blob
|
||||||
|
// - Node only: Stream, Buffer
|
||||||
|
data: {
|
||||||
|
firstName: 'Fred'
|
||||||
|
},
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// Note: Ignored for `responseType` of 'stream' or client-side requests
|
||||||
|
responseEncoding: 'utf8', // default
|
||||||
|
|
||||||
|
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
|
||||||
|
xsrfCookieName: 'XSRF-TOKEN', // default
|
||||||
|
|
||||||
|
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value
|
||||||
|
xsrfHeaderName: 'X-XSRF-TOKEN', // default
|
||||||
|
|
||||||
|
// `onUploadProgress` allows handling of progress events for uploads
|
||||||
|
onUploadProgress: function (progressEvent) {
|
||||||
|
// Do whatever you want with the native progress event
|
||||||
|
},
|
||||||
|
|
||||||
|
// `onDownloadProgress` allows handling of progress events for downloads
|
||||||
|
onDownloadProgress: function (progressEvent) {
|
||||||
|
// Do whatever you want with the native progress event
|
||||||
|
},
|
||||||
|
|
||||||
|
// `maxContentLength` defines the max size of the http response content in bytes allowed
|
||||||
|
maxContentLength: 2000,
|
||||||
|
|
||||||
|
// `validateStatus` defines whether to resolve or reject the promise for a given
|
||||||
|
// HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
|
||||||
|
// or `undefined`), the promise will be resolved; otherwise, the promise will be
|
||||||
|
// rejected.
|
||||||
|
validateStatus: function (status) {
|
||||||
|
return status >= 200 && status < 300; // default
|
||||||
|
},
|
||||||
|
|
||||||
|
// `maxRedirects` defines the maximum number of redirects to follow in node.js.
|
||||||
|
// If set to 0, no redirects will be followed.
|
||||||
|
maxRedirects: 5, // default
|
||||||
|
|
||||||
|
// `socketPath` defines a UNIX Socket to be used in node.js.
|
||||||
|
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
|
||||||
|
// Only either `socketPath` or `proxy` can be specified.
|
||||||
|
// If both are specified, `socketPath` is used.
|
||||||
|
socketPath: null, // default
|
||||||
|
|
||||||
|
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
||||||
|
// and https requests, respectively, in node.js. This allows options to be added like
|
||||||
|
// `keepAlive` that are not enabled by default.
|
||||||
|
httpAgent: new http.Agent({ keepAlive: true }),
|
||||||
|
httpsAgent: new https.Agent({ keepAlive: true }),
|
||||||
|
|
||||||
|
// 'proxy' defines the hostname and port of the proxy server.
|
||||||
|
// You can also define your proxy using the conventional `http_proxy` and
|
||||||
|
// `https_proxy` environment variables. If you are using environment variables
|
||||||
|
// for your proxy configuration, you can also define a `no_proxy` environment
|
||||||
|
// variable as a comma-separated list of domains that should not be proxied.
|
||||||
|
// Use `false` to disable proxies, ignoring environment variables.
|
||||||
|
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
|
||||||
|
// supplies credentials.
|
||||||
|
// This will set an `Proxy-Authorization` header, overwriting any existing
|
||||||
|
// `Proxy-Authorization` custom headers you have set using `headers`.
|
||||||
|
proxy: {
|
||||||
|
host: '127.0.0.1',
|
||||||
|
port: 9000,
|
||||||
|
auth: {
|
||||||
|
username: 'mikeymike',
|
||||||
|
password: 'rapunz3l'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// `cancelToken` specifies a cancel token that can be used to cancel the request
|
||||||
|
// (see Cancellation section below for details)
|
||||||
|
cancelToken: new CancelToken(function (cancel) {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Response Schema
|
||||||
|
|
||||||
|
The response for a request contains the following information.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// `data` is the response that was provided by the server
|
||||||
|
data: {},
|
||||||
|
|
||||||
|
// `status` is the HTTP status code from the server response
|
||||||
|
status: 200,
|
||||||
|
|
||||||
|
// `statusText` is the HTTP status message from the server response
|
||||||
|
statusText: 'OK',
|
||||||
|
|
||||||
|
// `headers` the headers that the server responded with
|
||||||
|
// All header names are lower cased
|
||||||
|
headers: {},
|
||||||
|
|
||||||
|
// `config` is the config that was provided to `axios` for the request
|
||||||
|
config: {},
|
||||||
|
|
||||||
|
// `request` is the request that generated this response
|
||||||
|
// It is the last ClientRequest instance in node.js (in redirects)
|
||||||
|
// and an XMLHttpRequest instance 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';
|
||||||
|
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 () {/*...*/});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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; // Reject only if the status code is greater than or equal to 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();
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: you can cancel several requests with the same cancel token.
|
||||||
|
|
||||||
|
## Using application/x-www-form-urlencoded format
|
||||||
|
|
||||||
|
By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
|
||||||
|
|
||||||
|
### Browser
|
||||||
|
|
||||||
|
In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
params.append('param1', 'value1');
|
||||||
|
params.append('param2', 'value2');
|
||||||
|
axios.post('/foo', params);
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
|
||||||
|
|
||||||
|
Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const qs = require('qs');
|
||||||
|
axios.post('/foo', qs.stringify({ 'bar': 123 }));
|
||||||
|
```
|
||||||
|
|
||||||
|
Or in another way (ES6),
|
||||||
|
|
||||||
|
```js
|
||||||
|
import qs from 'qs';
|
||||||
|
const data = { 'bar': 123 };
|
||||||
|
const options = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||||
|
data: qs.stringify(data),
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
axios(options);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Node.js
|
||||||
|
|
||||||
|
In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const querystring = require('querystring');
|
||||||
|
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use the [`qs`](https://github.com/ljharb/qs) library.
|
||||||
|
|
||||||
|
###### NOTE
|
||||||
|
The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has known issues with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665).
|
||||||
|
|
||||||
|
## Semver
|
||||||
|
|
||||||
|
Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
|
||||||
|
|
||||||
|
## Promises
|
||||||
|
|
||||||
|
axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
|
||||||
|
If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
|
||||||
|
|
||||||
|
## TypeScript
|
||||||
|
axios includes [TypeScript](http://typescriptlang.org) definitions.
|
||||||
|
```typescript
|
||||||
|
import axios from 'axios';
|
||||||
|
axios.get('/user?ID=12345');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
|
||||||
|
* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
|
||||||
|
* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
|
||||||
|
* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
|
||||||
|
* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [Angular](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of Angular.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
162
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
Normal file
162
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
# Upgrade Guide
|
||||||
|
|
||||||
|
### 0.15.x -> 0.16.0
|
||||||
|
|
||||||
|
#### `Promise` Type Declarations
|
||||||
|
|
||||||
|
The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
|
||||||
|
|
||||||
|
### 0.13.x -> 0.14.0
|
||||||
|
|
||||||
|
#### TypeScript Definitions
|
||||||
|
|
||||||
|
The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
|
||||||
|
|
||||||
|
Please use the following `import` statement to import axios in TypeScript:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
axios.get('/foo')
|
||||||
|
.then(response => console.log(response))
|
||||||
|
.catch(error => console.log(error));
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `agent` Config Option
|
||||||
|
|
||||||
|
The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// Define a custom agent for HTTP
|
||||||
|
httpAgent: new http.Agent({ keepAlive: true }),
|
||||||
|
// Define a custom agent for HTTPS
|
||||||
|
httpsAgent: new https.Agent({ keepAlive: true })
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `progress` Config Option
|
||||||
|
|
||||||
|
The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// Define a handler for upload progress events
|
||||||
|
onUploadProgress: function (progressEvent) {
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
|
||||||
|
// Define a handler for download progress events
|
||||||
|
onDownloadProgress: function (progressEvent) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 0.12.x -> 0.13.0
|
||||||
|
|
||||||
|
The `0.13.0` release contains several changes to custom adapters and error handling.
|
||||||
|
|
||||||
|
#### Error Handling
|
||||||
|
|
||||||
|
Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('/user/12345')
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error.message);
|
||||||
|
console.log(error.code); // Not always specified
|
||||||
|
console.log(error.config); // The config that was used to make the request
|
||||||
|
console.log(error.response); // Only available if response was received from the server
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Request Adapters
|
||||||
|
|
||||||
|
This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
|
||||||
|
|
||||||
|
1. Response transformer is now called outside of adapter.
|
||||||
|
2. Request adapter returns a `Promise`.
|
||||||
|
|
||||||
|
This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter.
|
||||||
|
|
||||||
|
Previous code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myAdapter(resolve, reject, config) {
|
||||||
|
var response = {
|
||||||
|
data: transformData(
|
||||||
|
responseData,
|
||||||
|
responseHeaders,
|
||||||
|
config.transformResponse
|
||||||
|
),
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders
|
||||||
|
};
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
New code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myAdapter(config) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders
|
||||||
|
};
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See the related commits for more details:
|
||||||
|
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
|
||||||
|
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
|
||||||
|
|
||||||
|
### 0.5.x -> 0.6.0
|
||||||
|
|
||||||
|
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
|
||||||
|
|
||||||
|
#### ES6 Promise Polyfill
|
||||||
|
|
||||||
|
Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('es6-promise').polyfill();
|
||||||
|
var axios = require('axios');
|
||||||
|
```
|
||||||
|
|
||||||
|
This will polyfill the global environment, and only needs to be done once.
|
||||||
|
|
||||||
|
#### `axios.success`/`axios.error`
|
||||||
|
|
||||||
|
The `success`, and `error` aliases were deprectated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('some/url')
|
||||||
|
.then(function (res) {
|
||||||
|
/* ... */
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
/* ... */
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### UMD
|
||||||
|
|
||||||
|
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// AMD
|
||||||
|
require(['bower_components/axios/dist/axios'], function (axios) {
|
||||||
|
/* ... */
|
||||||
|
});
|
||||||
|
|
||||||
|
// CommonJS
|
||||||
|
var axios = require('axios/dist/axios');
|
||||||
|
```
|
1715
node_modules/axios/dist/axios.js
generated
vendored
Normal file
1715
node_modules/axios/dist/axios.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/axios/dist/axios.map
generated
vendored
Normal file
1
node_modules/axios/dist/axios.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
3
node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/axios/dist/axios.min.map
generated
vendored
Normal file
1
node_modules/axios/dist/axios.min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
157
node_modules/axios/index.d.ts
generated
vendored
Normal file
157
node_modules/axios/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
export interface AxiosTransformer {
|
||||||
|
(data: any, headers?: any): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosAdapter {
|
||||||
|
(config: AxiosRequestConfig): AxiosPromise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosBasicCredentials {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosProxyConfig {
|
||||||
|
host: string;
|
||||||
|
port: number;
|
||||||
|
auth?: {
|
||||||
|
username: string;
|
||||||
|
password:string;
|
||||||
|
};
|
||||||
|
protocol?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Method =
|
||||||
|
| 'get' | 'GET'
|
||||||
|
| 'delete' | 'DELETE'
|
||||||
|
| 'head' | 'HEAD'
|
||||||
|
| 'options' | 'OPTIONS'
|
||||||
|
| 'post' | 'POST'
|
||||||
|
| 'put' | 'PUT'
|
||||||
|
| 'patch' | 'PATCH'
|
||||||
|
| 'link' | 'LINK'
|
||||||
|
| 'unlink' | 'UNLINK'
|
||||||
|
|
||||||
|
export type ResponseType =
|
||||||
|
| 'arraybuffer'
|
||||||
|
| 'blob'
|
||||||
|
| 'document'
|
||||||
|
| 'json'
|
||||||
|
| 'text'
|
||||||
|
| 'stream'
|
||||||
|
|
||||||
|
export interface AxiosRequestConfig {
|
||||||
|
url?: string;
|
||||||
|
method?: Method;
|
||||||
|
baseURL?: string;
|
||||||
|
transformRequest?: AxiosTransformer | AxiosTransformer[];
|
||||||
|
transformResponse?: AxiosTransformer | AxiosTransformer[];
|
||||||
|
headers?: any;
|
||||||
|
params?: any;
|
||||||
|
paramsSerializer?: (params: any) => string;
|
||||||
|
data?: any;
|
||||||
|
timeout?: number;
|
||||||
|
timeoutErrorMessage?: string;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
adapter?: AxiosAdapter;
|
||||||
|
auth?: AxiosBasicCredentials;
|
||||||
|
responseType?: ResponseType;
|
||||||
|
xsrfCookieName?: string;
|
||||||
|
xsrfHeaderName?: string;
|
||||||
|
onUploadProgress?: (progressEvent: any) => void;
|
||||||
|
onDownloadProgress?: (progressEvent: any) => void;
|
||||||
|
maxContentLength?: number;
|
||||||
|
validateStatus?: (status: number) => boolean;
|
||||||
|
maxRedirects?: number;
|
||||||
|
socketPath?: string | null;
|
||||||
|
httpAgent?: any;
|
||||||
|
httpsAgent?: any;
|
||||||
|
proxy?: AxiosProxyConfig | false;
|
||||||
|
cancelToken?: CancelToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosResponse<T = any> {
|
||||||
|
data: T;
|
||||||
|
status: number;
|
||||||
|
statusText: string;
|
||||||
|
headers: any;
|
||||||
|
config: AxiosRequestConfig;
|
||||||
|
request?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosError<T = any> extends Error {
|
||||||
|
config: AxiosRequestConfig;
|
||||||
|
code?: string;
|
||||||
|
request?: any;
|
||||||
|
response?: AxiosResponse<T>;
|
||||||
|
isAxiosError: boolean;
|
||||||
|
toJSON: () => object;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelStatic {
|
||||||
|
new (message?: string): Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cancel {
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Canceler {
|
||||||
|
(message?: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelTokenStatic {
|
||||||
|
new (executor: (cancel: Canceler) => void): CancelToken;
|
||||||
|
source(): CancelTokenSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelToken {
|
||||||
|
promise: Promise<Cancel>;
|
||||||
|
reason?: Cancel;
|
||||||
|
throwIfRequested(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelTokenSource {
|
||||||
|
token: CancelToken;
|
||||||
|
cancel: Canceler;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosInterceptorManager<V> {
|
||||||
|
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
|
||||||
|
eject(id: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosInstance {
|
||||||
|
(config: AxiosRequestConfig): AxiosPromise;
|
||||||
|
(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||||
|
defaults: AxiosRequestConfig;
|
||||||
|
interceptors: {
|
||||||
|
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
||||||
|
response: AxiosInterceptorManager<AxiosResponse>;
|
||||||
|
};
|
||||||
|
getUri(config?: AxiosRequestConfig): string;
|
||||||
|
request<T = any, R = AxiosResponse<T>> (config: AxiosRequestConfig): Promise<R>;
|
||||||
|
get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
options<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosStatic extends AxiosInstance {
|
||||||
|
create(config?: AxiosRequestConfig): AxiosInstance;
|
||||||
|
Cancel: CancelStatic;
|
||||||
|
CancelToken: CancelTokenStatic;
|
||||||
|
isCancel(value: any): boolean;
|
||||||
|
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||||
|
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const Axios: AxiosStatic;
|
||||||
|
|
||||||
|
export default Axios;
|
1
node_modules/axios/index.js
generated
vendored
Normal file
1
node_modules/axios/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./lib/axios');
|
37
node_modules/axios/lib/adapters/README.md
generated
vendored
Normal file
37
node_modules/axios/lib/adapters/README.md
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# 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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
279
node_modules/axios/lib/adapters/http.js
generated
vendored
Executable file
279
node_modules/axios/lib/adapters/http.js
generated
vendored
Executable file
|
@ -0,0 +1,279 @@
|
||||||
|
'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 pkg = require('./../../package.json');
|
||||||
|
var createError = require('../core/createError');
|
||||||
|
var enhanceError = require('../core/enhanceError');
|
||||||
|
|
||||||
|
var isHttps = /https:?/;
|
||||||
|
|
||||||
|
/*eslint consistent-return:0*/
|
||||||
|
module.exports = function httpAdapter(config) {
|
||||||
|
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
||||||
|
var resolve = function resolve(value) {
|
||||||
|
resolvePromise(value);
|
||||||
|
};
|
||||||
|
var reject = function reject(value) {
|
||||||
|
rejectPromise(value);
|
||||||
|
};
|
||||||
|
var data = config.data;
|
||||||
|
var headers = config.headers;
|
||||||
|
|
||||||
|
// Set User-Agent (required by some servers)
|
||||||
|
// Only set header if it hasn't been set in config
|
||||||
|
// See https://github.com/axios/axios/issues/69
|
||||||
|
if (!headers['User-Agent'] && !headers['user-agent']) {
|
||||||
|
headers['User-Agent'] = 'axios/' + pkg.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data && !utils.isStream(data)) {
|
||||||
|
if (Buffer.isBuffer(data)) {
|
||||||
|
// Nothing to do...
|
||||||
|
} else if (utils.isArrayBuffer(data)) {
|
||||||
|
data = Buffer.from(new Uint8Array(data));
|
||||||
|
} else if (utils.isString(data)) {
|
||||||
|
data = Buffer.from(data, 'utf-8');
|
||||||
|
} else {
|
||||||
|
return reject(createError(
|
||||||
|
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
||||||
|
config
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Content-Length header if data exists
|
||||||
|
headers['Content-Length'] = data.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTP basic authentication
|
||||||
|
var auth = undefined;
|
||||||
|
if (config.auth) {
|
||||||
|
var username = config.auth.username || '';
|
||||||
|
var password = config.auth.password || '';
|
||||||
|
auth = username + ':' + password;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse url
|
||||||
|
var 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) {
|
||||||
|
delete headers.Authorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isHttpsRequest = isHttps.test(protocol);
|
||||||
|
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
||||||
|
method: config.method.toUpperCase(),
|
||||||
|
headers: headers,
|
||||||
|
agent: agent,
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
||||||
|
if (parsedProxyUrl.auth) {
|
||||||
|
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
|
||||||
|
proxy.auth = {
|
||||||
|
username: proxyUrlAuth[0],
|
||||||
|
password: proxyUrlAuth[1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proxy) {
|
||||||
|
options.hostname = proxy.host;
|
||||||
|
options.host = proxy.host;
|
||||||
|
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
|
||||||
|
options.port = proxy.port;
|
||||||
|
options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path;
|
||||||
|
|
||||||
|
// Basic proxy authorization
|
||||||
|
if (proxy.auth) {
|
||||||
|
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
||||||
|
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var transport;
|
||||||
|
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
|
||||||
|
if (config.transport) {
|
||||||
|
transport = config.transport;
|
||||||
|
} else if (config.maxRedirects === 0) {
|
||||||
|
transport = isHttpsProxy ? https : http;
|
||||||
|
} else {
|
||||||
|
if (config.maxRedirects) {
|
||||||
|
options.maxRedirects = config.maxRedirects;
|
||||||
|
}
|
||||||
|
transport = isHttpsProxy ? httpsFollow : httpFollow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.maxContentLength && config.maxContentLength > -1) {
|
||||||
|
options.maxBodyLength = config.maxContentLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the request
|
||||||
|
var req = transport.request(options, function handleResponse(res) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
|
||||||
|
// uncompress the response body transparently if required
|
||||||
|
var stream = res;
|
||||||
|
switch (res.headers['content-encoding']) {
|
||||||
|
/*eslint default-case:0*/
|
||||||
|
case 'gzip':
|
||||||
|
case 'compress':
|
||||||
|
case 'deflate':
|
||||||
|
// add the unzipper to the body stream processing pipeline
|
||||||
|
stream = (res.statusCode === 204) ? stream : stream.pipe(zlib.createUnzip());
|
||||||
|
|
||||||
|
// remove the content-encoding in order to not confuse downstream operations
|
||||||
|
delete res.headers['content-encoding'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the last request in case of redirects
|
||||||
|
var lastRequest = res.req || req;
|
||||||
|
|
||||||
|
var response = {
|
||||||
|
status: res.statusCode,
|
||||||
|
statusText: res.statusMessage,
|
||||||
|
headers: res.headers,
|
||||||
|
config: config,
|
||||||
|
request: lastRequest
|
||||||
|
};
|
||||||
|
|
||||||
|
if (config.responseType === 'stream') {
|
||||||
|
response.data = stream;
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
} else {
|
||||||
|
var responseBuffer = [];
|
||||||
|
stream.on('data', function handleStreamData(chunk) {
|
||||||
|
responseBuffer.push(chunk);
|
||||||
|
|
||||||
|
// make sure the content length is not over the maxContentLength if specified
|
||||||
|
if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
|
||||||
|
stream.destroy();
|
||||||
|
reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||||
|
config, null, lastRequest));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
stream.on('error', function handleStreamError(err) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
reject(enhanceError(err, config, null, lastRequest));
|
||||||
|
});
|
||||||
|
|
||||||
|
stream.on('end', function handleStreamEnd() {
|
||||||
|
var responseData = Buffer.concat(responseBuffer);
|
||||||
|
if (config.responseType !== 'arraybuffer') {
|
||||||
|
responseData = responseData.toString(config.responseEncoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
response.data = responseData;
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle errors
|
||||||
|
req.on('error', function handleRequestError(err) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
reject(enhanceError(err, config, null, req));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle request timeout
|
||||||
|
if (config.timeout) {
|
||||||
|
// 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(config.timeout, function handleRequestTimeout() {
|
||||||
|
req.abort();
|
||||||
|
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.cancelToken) {
|
||||||
|
// Handle cancellation
|
||||||
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
|
||||||
|
req.abort();
|
||||||
|
reject(cancel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the request
|
||||||
|
if (utils.isStream(data)) {
|
||||||
|
data.on('error', function handleStreamError(err) {
|
||||||
|
reject(enhanceError(err, config, null, req));
|
||||||
|
}).pipe(req);
|
||||||
|
} else {
|
||||||
|
req.end(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
180
node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
180
node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var settle = require('./../core/settle');
|
||||||
|
var buildURL = require('./../helpers/buildURL');
|
||||||
|
var buildFullPath = require('../core/buildFullPath');
|
||||||
|
var parseHeaders = require('./../helpers/parseHeaders');
|
||||||
|
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
||||||
|
var createError = require('../core/createError');
|
||||||
|
|
||||||
|
module.exports = function xhrAdapter(config) {
|
||||||
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||||
|
var requestData = config.data;
|
||||||
|
var requestHeaders = config.headers;
|
||||||
|
|
||||||
|
if (utils.isFormData(requestData)) {
|
||||||
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
// HTTP basic authentication
|
||||||
|
if (config.auth) {
|
||||||
|
var username = config.auth.username || '';
|
||||||
|
var password = config.auth.password || '';
|
||||||
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Listen for ready state
|
||||||
|
request.onreadystatechange = function handleLoad() {
|
||||||
|
if (!request || request.readyState !== 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The request errored out and we didn't get a response, this will be
|
||||||
|
// handled by onerror instead
|
||||||
|
// With one exception: request that using file: protocol, most browsers
|
||||||
|
// will return status as 0 even though it's a successful request
|
||||||
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare the response
|
||||||
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
||||||
|
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders,
|
||||||
|
config: config,
|
||||||
|
request: request
|
||||||
|
};
|
||||||
|
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle browser request cancellation (as opposed to a manual cancellation)
|
||||||
|
request.onabort = function handleAbort() {
|
||||||
|
if (!request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle low level network errors
|
||||||
|
request.onerror = function handleError() {
|
||||||
|
// Real errors are hidden from us by the browser
|
||||||
|
// onerror should only fire if it's a network error
|
||||||
|
reject(createError('Network Error', config, null, request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle timeout
|
||||||
|
request.ontimeout = function handleTimeout() {
|
||||||
|
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
||||||
|
if (config.timeoutErrorMessage) {
|
||||||
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||||
|
}
|
||||||
|
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
|
||||||
|
request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add xsrf header
|
||||||
|
// This is only done if running in a standard browser environment.
|
||||||
|
// Specifically not if we're in a web worker, or react-native.
|
||||||
|
if (utils.isStandardBrowserEnv()) {
|
||||||
|
var cookies = require('./../helpers/cookies');
|
||||||
|
|
||||||
|
// Add xsrf header
|
||||||
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(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 (config.responseType) {
|
||||||
|
try {
|
||||||
|
request.responseType = config.responseType;
|
||||||
|
} catch (e) {
|
||||||
|
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
||||||
|
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
||||||
|
if (config.responseType !== 'json') {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle progress if needed
|
||||||
|
if (typeof config.onDownloadProgress === 'function') {
|
||||||
|
request.addEventListener('progress', config.onDownloadProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not all browsers support upload events
|
||||||
|
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
||||||
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.cancelToken) {
|
||||||
|
// Handle cancellation
|
||||||
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
||||||
|
if (!request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.abort();
|
||||||
|
reject(cancel);
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestData === undefined) {
|
||||||
|
requestData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the request
|
||||||
|
request.send(requestData);
|
||||||
|
});
|
||||||
|
};
|
53
node_modules/axios/lib/axios.js
generated
vendored
Normal file
53
node_modules/axios/lib/axios.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
|
var bind = require('./helpers/bind');
|
||||||
|
var Axios = require('./core/Axios');
|
||||||
|
var mergeConfig = require('./core/mergeConfig');
|
||||||
|
var defaults = require('./defaults');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an instance of Axios
|
||||||
|
*
|
||||||
|
* @param {Object} defaultConfig The default config for the instance
|
||||||
|
* @return {Axios} A new instance of Axios
|
||||||
|
*/
|
||||||
|
function createInstance(defaultConfig) {
|
||||||
|
var context = new Axios(defaultConfig);
|
||||||
|
var instance = bind(Axios.prototype.request, context);
|
||||||
|
|
||||||
|
// Copy axios.prototype to instance
|
||||||
|
utils.extend(instance, Axios.prototype, context);
|
||||||
|
|
||||||
|
// Copy context to instance
|
||||||
|
utils.extend(instance, context);
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the default instance to be exported
|
||||||
|
var axios = createInstance(defaults);
|
||||||
|
|
||||||
|
// Expose Axios class to allow class inheritance
|
||||||
|
axios.Axios = Axios;
|
||||||
|
|
||||||
|
// Factory for creating new instances
|
||||||
|
axios.create = function create(instanceConfig) {
|
||||||
|
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
||||||
|
};
|
||||||
|
|
||||||
|
// Expose Cancel & CancelToken
|
||||||
|
axios.Cancel = require('./cancel/Cancel');
|
||||||
|
axios.CancelToken = require('./cancel/CancelToken');
|
||||||
|
axios.isCancel = require('./cancel/isCancel');
|
||||||
|
|
||||||
|
// Expose all/spread
|
||||||
|
axios.all = function all(promises) {
|
||||||
|
return Promise.all(promises);
|
||||||
|
};
|
||||||
|
axios.spread = require('./helpers/spread');
|
||||||
|
|
||||||
|
module.exports = axios;
|
||||||
|
|
||||||
|
// Allow use of default import syntax in TypeScript
|
||||||
|
module.exports.default = axios;
|
19
node_modules/axios/lib/cancel/Cancel.js
generated
vendored
Normal file
19
node_modules/axios/lib/cancel/Cancel.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `Cancel` is an object that is thrown when an operation is canceled.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {string=} message The message.
|
||||||
|
*/
|
||||||
|
function Cancel(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cancel.prototype.toString = function toString() {
|
||||||
|
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
||||||
|
};
|
||||||
|
|
||||||
|
Cancel.prototype.__CANCEL__ = true;
|
||||||
|
|
||||||
|
module.exports = Cancel;
|
57
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
57
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var Cancel = require('./Cancel');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {Function} executor The executor function.
|
||||||
|
*/
|
||||||
|
function CancelToken(executor) {
|
||||||
|
if (typeof executor !== 'function') {
|
||||||
|
throw new TypeError('executor must be a function.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var resolvePromise;
|
||||||
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
||||||
|
resolvePromise = resolve;
|
||||||
|
});
|
||||||
|
|
||||||
|
var token = this;
|
||||||
|
executor(function cancel(message) {
|
||||||
|
if (token.reason) {
|
||||||
|
// Cancellation has already been requested
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
token.reason = new Cancel(message);
|
||||||
|
resolvePromise(token.reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `Cancel` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
||||||
|
if (this.reason) {
|
||||||
|
throw this.reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||||||
|
* cancels the `CancelToken`.
|
||||||
|
*/
|
||||||
|
CancelToken.source = function source() {
|
||||||
|
var cancel;
|
||||||
|
var token = new CancelToken(function executor(c) {
|
||||||
|
cancel = c;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
token: token,
|
||||||
|
cancel: cancel
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = CancelToken;
|
5
node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
5
node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function isCancel(value) {
|
||||||
|
return !!(value && value.__CANCEL__);
|
||||||
|
};
|
94
node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
94
node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var buildURL = require('../helpers/buildURL');
|
||||||
|
var InterceptorManager = require('./InterceptorManager');
|
||||||
|
var dispatchRequest = require('./dispatchRequest');
|
||||||
|
var mergeConfig = require('./mergeConfig');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance of Axios
|
||||||
|
*
|
||||||
|
* @param {Object} instanceConfig The default config for the instance
|
||||||
|
*/
|
||||||
|
function Axios(instanceConfig) {
|
||||||
|
this.defaults = instanceConfig;
|
||||||
|
this.interceptors = {
|
||||||
|
request: new InterceptorManager(),
|
||||||
|
response: new InterceptorManager()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request
|
||||||
|
*
|
||||||
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
||||||
|
*/
|
||||||
|
Axios.prototype.request = function request(config) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
// Allow for axios('example/url'[, config]) a la fetch API
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
config = arguments[1] || {};
|
||||||
|
config.url = arguments[0];
|
||||||
|
} else {
|
||||||
|
config = config || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
config = mergeConfig(this.defaults, config);
|
||||||
|
|
||||||
|
// 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';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook up interceptors middleware
|
||||||
|
var chain = [dispatchRequest, undefined];
|
||||||
|
var promise = Promise.resolve(config);
|
||||||
|
|
||||||
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
||||||
|
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
||||||
|
chain.push(interceptor.fulfilled, interceptor.rejected);
|
||||||
|
});
|
||||||
|
|
||||||
|
while (chain.length) {
|
||||||
|
promise = promise.then(chain.shift(), chain.shift());
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Axios.prototype.getUri = function getUri(config) {
|
||||||
|
config = mergeConfig(this.defaults, config);
|
||||||
|
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Provide aliases for supported request methods
|
||||||
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
||||||
|
/*eslint func-names:0*/
|
||||||
|
Axios.prototype[method] = function(url, config) {
|
||||||
|
return this.request(utils.merge(config || {}, {
|
||||||
|
method: method,
|
||||||
|
url: url
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||||
|
/*eslint func-names:0*/
|
||||||
|
Axios.prototype[method] = function(url, data, config) {
|
||||||
|
return this.request(utils.merge(config || {}, {
|
||||||
|
method: method,
|
||||||
|
url: url,
|
||||||
|
data: data
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = Axios;
|
52
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
52
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
function InterceptorManager() {
|
||||||
|
this.handlers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new interceptor to the stack
|
||||||
|
*
|
||||||
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||||||
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||||||
|
*
|
||||||
|
* @return {Number} An ID used to remove interceptor later
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
||||||
|
this.handlers.push({
|
||||||
|
fulfilled: fulfilled,
|
||||||
|
rejected: rejected
|
||||||
|
});
|
||||||
|
return this.handlers.length - 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an interceptor from the stack
|
||||||
|
*
|
||||||
|
* @param {Number} id The ID that was returned by `use`
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.eject = function eject(id) {
|
||||||
|
if (this.handlers[id]) {
|
||||||
|
this.handlers[id] = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate over all the registered interceptors
|
||||||
|
*
|
||||||
|
* This method is particularly useful for skipping over any
|
||||||
|
* interceptors that may have become `null` calling `eject`.
|
||||||
|
*
|
||||||
|
* @param {Function} fn The function to call for each interceptor
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||||
|
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||||
|
if (h !== null) {
|
||||||
|
fn(h);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = InterceptorManager;
|
7
node_modules/axios/lib/core/README.md
generated
vendored
Normal file
7
node_modules/axios/lib/core/README.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# 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
|
||||||
|
- Managing interceptors
|
||||||
|
- Handling config
|
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
Normal file
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
'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
Normal file
18
node_modules/axios/lib/core/createError.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var enhanceError = require('./enhanceError');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Error with the specified message, config, error code, request and response.
|
||||||
|
*
|
||||||
|
* @param {string} message The error message.
|
||||||
|
* @param {Object} config The config.
|
||||||
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||||||
|
* @param {Object} [request] The request.
|
||||||
|
* @param {Object} [response] The response.
|
||||||
|
* @returns {Error} The created error.
|
||||||
|
*/
|
||||||
|
module.exports = function createError(message, config, code, request, response) {
|
||||||
|
var error = new Error(message);
|
||||||
|
return enhanceError(error, config, code, request, response);
|
||||||
|
};
|
79
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
79
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var transformData = require('./transformData');
|
||||||
|
var isCancel = require('../cancel/isCancel');
|
||||||
|
var defaults = require('../defaults');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `Cancel` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
function throwIfCancellationRequested(config) {
|
||||||
|
if (config.cancelToken) {
|
||||||
|
config.cancelToken.throwIfRequested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request to the server using the configured adapter.
|
||||||
|
*
|
||||||
|
* @param {object} config The config that is to be used for the request
|
||||||
|
* @returns {Promise} The Promise to be fulfilled
|
||||||
|
*/
|
||||||
|
module.exports = function dispatchRequest(config) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Ensure headers exist
|
||||||
|
config.headers = config.headers || {};
|
||||||
|
|
||||||
|
// Transform request data
|
||||||
|
config.data = transformData(
|
||||||
|
config.data,
|
||||||
|
config.headers,
|
||||||
|
config.transformRequest
|
||||||
|
);
|
||||||
|
|
||||||
|
// Flatten headers
|
||||||
|
config.headers = utils.merge(
|
||||||
|
config.headers.common || {},
|
||||||
|
config.headers[config.method] || {},
|
||||||
|
config.headers
|
||||||
|
);
|
||||||
|
|
||||||
|
utils.forEach(
|
||||||
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||||
|
function cleanHeaderConfig(method) {
|
||||||
|
delete config.headers[method];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var adapter = config.adapter || defaults.adapter;
|
||||||
|
|
||||||
|
return adapter(config).then(function onAdapterResolution(response) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
response.data = transformData(
|
||||||
|
response.data,
|
||||||
|
response.headers,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}, function onAdapterRejection(reason) {
|
||||||
|
if (!isCancel(reason)) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
if (reason && reason.response) {
|
||||||
|
reason.response.data = transformData(
|
||||||
|
reason.response.data,
|
||||||
|
reason.response.headers,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject(reason);
|
||||||
|
});
|
||||||
|
};
|
42
node_modules/axios/lib/core/enhanceError.js
generated
vendored
Normal file
42
node_modules/axios/lib/core/enhanceError.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an Error with the specified config, error code, and response.
|
||||||
|
*
|
||||||
|
* @param {Error} error The error to update.
|
||||||
|
* @param {Object} config The config.
|
||||||
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||||||
|
* @param {Object} [request] The request.
|
||||||
|
* @param {Object} [response] The response.
|
||||||
|
* @returns {Error} The error.
|
||||||
|
*/
|
||||||
|
module.exports = function enhanceError(error, config, code, request, response) {
|
||||||
|
error.config = config;
|
||||||
|
if (code) {
|
||||||
|
error.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
error.request = request;
|
||||||
|
error.response = response;
|
||||||
|
error.isAxiosError = true;
|
||||||
|
|
||||||
|
error.toJSON = function() {
|
||||||
|
return {
|
||||||
|
// Standard
|
||||||
|
message: this.message,
|
||||||
|
name: this.name,
|
||||||
|
// Microsoft
|
||||||
|
description: this.description,
|
||||||
|
number: this.number,
|
||||||
|
// Mozilla
|
||||||
|
fileName: this.fileName,
|
||||||
|
lineNumber: this.lineNumber,
|
||||||
|
columnNumber: this.columnNumber,
|
||||||
|
stack: this.stack,
|
||||||
|
// Axios
|
||||||
|
config: this.config,
|
||||||
|
code: this.code
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return error;
|
||||||
|
};
|
73
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
Normal file
73
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
'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 = {};
|
||||||
|
|
||||||
|
var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
|
||||||
|
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
|
||||||
|
var defaultToConfig2Keys = [
|
||||||
|
'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
||||||
|
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
||||||
|
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
|
||||||
|
'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
|
||||||
|
'httpsAgent', 'cancelToken', 'socketPath'
|
||||||
|
];
|
||||||
|
|
||||||
|
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
||||||
|
if (typeof config2[prop] !== 'undefined') {
|
||||||
|
config[prop] = config2[prop];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
|
||||||
|
if (utils.isObject(config2[prop])) {
|
||||||
|
config[prop] = utils.deepMerge(config1[prop], config2[prop]);
|
||||||
|
} else if (typeof config2[prop] !== 'undefined') {
|
||||||
|
config[prop] = config2[prop];
|
||||||
|
} else if (utils.isObject(config1[prop])) {
|
||||||
|
config[prop] = utils.deepMerge(config1[prop]);
|
||||||
|
} else if (typeof config1[prop] !== 'undefined') {
|
||||||
|
config[prop] = config1[prop];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
||||||
|
if (typeof config2[prop] !== 'undefined') {
|
||||||
|
config[prop] = config2[prop];
|
||||||
|
} else if (typeof config1[prop] !== 'undefined') {
|
||||||
|
config[prop] = config1[prop];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var axiosKeys = valueFromConfig2Keys
|
||||||
|
.concat(mergeDeepPropertiesKeys)
|
||||||
|
.concat(defaultToConfig2Keys);
|
||||||
|
|
||||||
|
var otherKeys = Object
|
||||||
|
.keys(config2)
|
||||||
|
.filter(function filterAxiosKeys(key) {
|
||||||
|
return axiosKeys.indexOf(key) === -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
|
||||||
|
if (typeof config2[prop] !== 'undefined') {
|
||||||
|
config[prop] = config2[prop];
|
||||||
|
} else if (typeof config1[prop] !== 'undefined') {
|
||||||
|
config[prop] = config1[prop];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return config;
|
||||||
|
};
|
25
node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
25
node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var createError = require('./createError');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve or reject a Promise based on response status.
|
||||||
|
*
|
||||||
|
* @param {Function} resolve A function that resolves the promise.
|
||||||
|
* @param {Function} reject A function that rejects the promise.
|
||||||
|
* @param {object} response The response.
|
||||||
|
*/
|
||||||
|
module.exports = function settle(resolve, reject, response) {
|
||||||
|
var validateStatus = response.config.validateStatus;
|
||||||
|
if (!validateStatus || validateStatus(response.status)) {
|
||||||
|
resolve(response);
|
||||||
|
} else {
|
||||||
|
reject(createError(
|
||||||
|
'Request failed with status code ' + response.status,
|
||||||
|
response.config,
|
||||||
|
null,
|
||||||
|
response.request,
|
||||||
|
response
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
20
node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
20
node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform the data for a request or a response
|
||||||
|
*
|
||||||
|
* @param {Object|String} data The data to be transformed
|
||||||
|
* @param {Array} headers The headers for the request or response
|
||||||
|
* @param {Array|Function} fns A single function or Array of functions
|
||||||
|
* @returns {*} The resulting transformed data
|
||||||
|
*/
|
||||||
|
module.exports = function transformData(data, headers, fns) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
utils.forEach(fns, function transform(fn) {
|
||||||
|
data = fn(data, headers);
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
};
|
97
node_modules/axios/lib/defaults.js
generated
vendored
Normal file
97
node_modules/axios/lib/defaults.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
|
var normalizeHeaderName = require('./helpers/normalizeHeaderName');
|
||||||
|
|
||||||
|
var DEFAULT_CONTENT_TYPE = {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
};
|
||||||
|
|
||||||
|
function setContentTypeIfUnset(headers, value) {
|
||||||
|
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
||||||
|
headers['Content-Type'] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDefaultAdapter() {
|
||||||
|
var adapter;
|
||||||
|
if (typeof 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaults = {
|
||||||
|
adapter: getDefaultAdapter(),
|
||||||
|
|
||||||
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
|
normalizeHeaderName(headers, 'Accept');
|
||||||
|
normalizeHeaderName(headers, 'Content-Type');
|
||||||
|
if (utils.isFormData(data) ||
|
||||||
|
utils.isArrayBuffer(data) ||
|
||||||
|
utils.isBuffer(data) ||
|
||||||
|
utils.isStream(data) ||
|
||||||
|
utils.isFile(data) ||
|
||||||
|
utils.isBlob(data)
|
||||||
|
) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (utils.isArrayBufferView(data)) {
|
||||||
|
return data.buffer;
|
||||||
|
}
|
||||||
|
if (utils.isURLSearchParams(data)) {
|
||||||
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
||||||
|
return data.toString();
|
||||||
|
}
|
||||||
|
if (utils.isObject(data)) {
|
||||||
|
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
||||||
|
return JSON.stringify(data);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
transformResponse: [function transformResponse(data) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
} catch (e) { /* Ignore */ }
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
||||||
|
* timeout is not created.
|
||||||
|
*/
|
||||||
|
timeout: 0,
|
||||||
|
|
||||||
|
xsrfCookieName: 'XSRF-TOKEN',
|
||||||
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
||||||
|
|
||||||
|
maxContentLength: -1,
|
||||||
|
|
||||||
|
validateStatus: function validateStatus(status) {
|
||||||
|
return status >= 200 && status < 300;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
defaults.headers = {
|
||||||
|
common: {
|
||||||
|
'Accept': 'application/json, text/plain, */*'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||||
|
defaults.headers[method] = {};
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||||
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = defaults;
|
7
node_modules/axios/lib/helpers/README.md
generated
vendored
Normal file
7
node_modules/axios/lib/helpers/README.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# 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
Normal file
11
node_modules/axios/lib/helpers/bind.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function bind(fn, thisArg) {
|
||||||
|
return function wrap() {
|
||||||
|
var args = new Array(arguments.length);
|
||||||
|
for (var i = 0; i < args.length; i++) {
|
||||||
|
args[i] = arguments[i];
|
||||||
|
}
|
||||||
|
return fn.apply(thisArg, args);
|
||||||
|
};
|
||||||
|
};
|
71
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
71
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
function encode(val) {
|
||||||
|
return encodeURIComponent(val).
|
||||||
|
replace(/%40/gi, '@').
|
||||||
|
replace(/%3A/gi, ':').
|
||||||
|
replace(/%24/g, '$').
|
||||||
|
replace(/%2C/gi, ',').
|
||||||
|
replace(/%20/g, '+').
|
||||||
|
replace(/%5B/gi, '[').
|
||||||
|
replace(/%5D/gi, ']');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a URL by appending params to the end
|
||||||
|
*
|
||||||
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
||||||
|
* @param {object} [params] The params to be appended
|
||||||
|
* @returns {string} The formatted url
|
||||||
|
*/
|
||||||
|
module.exports = function buildURL(url, params, paramsSerializer) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
if (!params) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
var serializedParams;
|
||||||
|
if (paramsSerializer) {
|
||||||
|
serializedParams = paramsSerializer(params);
|
||||||
|
} else if (utils.isURLSearchParams(params)) {
|
||||||
|
serializedParams = params.toString();
|
||||||
|
} else {
|
||||||
|
var parts = [];
|
||||||
|
|
||||||
|
utils.forEach(params, function serialize(val, key) {
|
||||||
|
if (val === null || typeof val === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isArray(val)) {
|
||||||
|
key = key + '[]';
|
||||||
|
} else {
|
||||||
|
val = [val];
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.forEach(val, function parseValue(v) {
|
||||||
|
if (utils.isDate(v)) {
|
||||||
|
v = v.toISOString();
|
||||||
|
} else if (utils.isObject(v)) {
|
||||||
|
v = JSON.stringify(v);
|
||||||
|
}
|
||||||
|
parts.push(encode(key) + '=' + encode(v));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
serializedParams = parts.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serializedParams) {
|
||||||
|
var hashmarkIndex = url.indexOf('#');
|
||||||
|
if (hashmarkIndex !== -1) {
|
||||||
|
url = url.slice(0, hashmarkIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
};
|
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new URL by combining the specified URLs
|
||||||
|
*
|
||||||
|
* @param {string} baseURL The base URL
|
||||||
|
* @param {string} relativeURL The relative URL
|
||||||
|
* @returns {string} The combined URL
|
||||||
|
*/
|
||||||
|
module.exports = function combineURLs(baseURL, relativeURL) {
|
||||||
|
return relativeURL
|
||||||
|
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
||||||
|
: baseURL;
|
||||||
|
};
|
53
node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
53
node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
module.exports = (
|
||||||
|
utils.isStandardBrowserEnv() ?
|
||||||
|
|
||||||
|
// Standard browser envs support document.cookie
|
||||||
|
(function standardBrowserEnv() {
|
||||||
|
return {
|
||||||
|
write: function write(name, value, expires, path, domain, secure) {
|
||||||
|
var cookie = [];
|
||||||
|
cookie.push(name + '=' + encodeURIComponent(value));
|
||||||
|
|
||||||
|
if (utils.isNumber(expires)) {
|
||||||
|
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isString(path)) {
|
||||||
|
cookie.push('path=' + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isString(domain)) {
|
||||||
|
cookie.push('domain=' + domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (secure === true) {
|
||||||
|
cookie.push('secure');
|
||||||
|
}
|
||||||
|
|
||||||
|
document.cookie = cookie.join('; ');
|
||||||
|
},
|
||||||
|
|
||||||
|
read: function read(name) {
|
||||||
|
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||||
|
return (match ? decodeURIComponent(match[3]) : null);
|
||||||
|
},
|
||||||
|
|
||||||
|
remove: function remove(name) {
|
||||||
|
this.write(name, '', Date.now() - 86400000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})() :
|
||||||
|
|
||||||
|
// Non standard browser env (web workers, react-native) lack needed support.
|
||||||
|
(function nonStandardBrowserEnv() {
|
||||||
|
return {
|
||||||
|
write: function write() {},
|
||||||
|
read: function read() { return null; },
|
||||||
|
remove: function remove() {}
|
||||||
|
};
|
||||||
|
})()
|
||||||
|
);
|
24
node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
24
node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/*eslint no-console:0*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supply a warning to the developer that a method they are using
|
||||||
|
* has been deprecated.
|
||||||
|
*
|
||||||
|
* @param {string} method The name of the deprecated method
|
||||||
|
* @param {string} [instead] The alternate method to use if applicable
|
||||||
|
* @param {string} [docs] The documentation URL to get further details
|
||||||
|
*/
|
||||||
|
module.exports = function deprecatedMethod(method, instead, docs) {
|
||||||
|
try {
|
||||||
|
console.warn(
|
||||||
|
'DEPRECATED method `' + method + '`.' +
|
||||||
|
(instead ? ' Use `' + instead + '` instead.' : '') +
|
||||||
|
' This method will be removed in a future release.');
|
||||||
|
|
||||||
|
if (docs) {
|
||||||
|
console.warn('For more information about usage see ' + docs);
|
||||||
|
}
|
||||||
|
} catch (e) { /* Ignore */ }
|
||||||
|
};
|
14
node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
Normal file
14
node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the specified URL is absolute
|
||||||
|
*
|
||||||
|
* @param {string} url The URL to test
|
||||||
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
||||||
|
*/
|
||||||
|
module.exports = function isAbsoluteURL(url) {
|
||||||
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
||||||
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
||||||
|
// by any combination of letters, digits, plus, period, or hyphen.
|
||||||
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
||||||
|
};
|
68
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
Normal file
68
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
module.exports = (
|
||||||
|
utils.isStandardBrowserEnv() ?
|
||||||
|
|
||||||
|
// Standard browser envs have full support of the APIs needed to test
|
||||||
|
// whether the request URL is of the same origin as current location.
|
||||||
|
(function standardBrowserEnv() {
|
||||||
|
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
||||||
|
var urlParsingNode = document.createElement('a');
|
||||||
|
var originURL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a URL to discover it's components
|
||||||
|
*
|
||||||
|
* @param {String} url The URL to be parsed
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
function resolveURL(url) {
|
||||||
|
var href = url;
|
||||||
|
|
||||||
|
if (msie) {
|
||||||
|
// IE needs attribute set twice to normalize properties
|
||||||
|
urlParsingNode.setAttribute('href', href);
|
||||||
|
href = urlParsingNode.href;
|
||||||
|
}
|
||||||
|
|
||||||
|
urlParsingNode.setAttribute('href', href);
|
||||||
|
|
||||||
|
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
||||||
|
return {
|
||||||
|
href: urlParsingNode.href,
|
||||||
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
||||||
|
host: urlParsingNode.host,
|
||||||
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
||||||
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
||||||
|
hostname: urlParsingNode.hostname,
|
||||||
|
port: urlParsingNode.port,
|
||||||
|
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
||||||
|
urlParsingNode.pathname :
|
||||||
|
'/' + urlParsingNode.pathname
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
originURL = resolveURL(window.location.href);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a URL shares the same origin as the current location
|
||||||
|
*
|
||||||
|
* @param {String} requestURL The URL to test
|
||||||
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
||||||
|
*/
|
||||||
|
return function isURLSameOrigin(requestURL) {
|
||||||
|
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
||||||
|
return (parsed.protocol === originURL.protocol &&
|
||||||
|
parsed.host === originURL.host);
|
||||||
|
};
|
||||||
|
})() :
|
||||||
|
|
||||||
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
||||||
|
(function nonStandardBrowserEnv() {
|
||||||
|
return function isURLSameOrigin() {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
})()
|
||||||
|
);
|
12
node_modules/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
Normal file
12
node_modules/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('../utils');
|
||||||
|
|
||||||
|
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
||||||
|
utils.forEach(headers, function processHeader(value, name) {
|
||||||
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
||||||
|
headers[normalizedName] = value;
|
||||||
|
delete headers[name];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
53
node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
Normal file
53
node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
// Headers whose duplicates are ignored by node
|
||||||
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
||||||
|
var ignoreDuplicateOf = [
|
||||||
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
||||||
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
||||||
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
||||||
|
'referer', 'retry-after', 'user-agent'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse headers into an object
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
||||||
|
* Content-Type: application/json
|
||||||
|
* Connection: keep-alive
|
||||||
|
* Transfer-Encoding: chunked
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} headers Headers needing to be parsed
|
||||||
|
* @returns {Object} Headers parsed into an object
|
||||||
|
*/
|
||||||
|
module.exports = function parseHeaders(headers) {
|
||||||
|
var parsed = {};
|
||||||
|
var key;
|
||||||
|
var val;
|
||||||
|
var i;
|
||||||
|
|
||||||
|
if (!headers) { return parsed; }
|
||||||
|
|
||||||
|
utils.forEach(headers.split('\n'), function parser(line) {
|
||||||
|
i = line.indexOf(':');
|
||||||
|
key = utils.trim(line.substr(0, i)).toLowerCase();
|
||||||
|
val = utils.trim(line.substr(i + 1));
|
||||||
|
|
||||||
|
if (key) {
|
||||||
|
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (key === 'set-cookie') {
|
||||||
|
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
||||||
|
} else {
|
||||||
|
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
};
|
27
node_modules/axios/lib/helpers/spread.js
generated
vendored
Normal file
27
node_modules/axios/lib/helpers/spread.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
||||||
|
*
|
||||||
|
* Common use case would be to use `Function.prototype.apply`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function f(x, y, z) {}
|
||||||
|
* var args = [1, 2, 3];
|
||||||
|
* f.apply(null, args);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* With `spread` this example can be re-written.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* spread(function(x, y, z) {})([1, 2, 3]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {Function} callback
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
module.exports = function spread(callback) {
|
||||||
|
return function wrap(arr) {
|
||||||
|
return callback.apply(null, arr);
|
||||||
|
};
|
||||||
|
};
|
344
node_modules/axios/lib/utils.js
generated
vendored
Normal file
344
node_modules/axios/lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,344 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var bind = require('./helpers/bind');
|
||||||
|
|
||||||
|
/*global toString:true*/
|
||||||
|
|
||||||
|
// utils is a library of generic helper functions non-specific to axios
|
||||||
|
|
||||||
|
var toString = Object.prototype.toString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is an Array
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is an Array, otherwise false
|
||||||
|
*/
|
||||||
|
function isArray(val) {
|
||||||
|
return toString.call(val) === '[object Array]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is 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 (typeof FormData !== 'undefined') && (val instanceof FormData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a view on an ArrayBuffer
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
||||||
|
*/
|
||||||
|
function isArrayBufferView(val) {
|
||||||
|
var result;
|
||||||
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
||||||
|
result = ArrayBuffer.isView(val);
|
||||||
|
} else {
|
||||||
|
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a String
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a String, otherwise false
|
||||||
|
*/
|
||||||
|
function isString(val) {
|
||||||
|
return typeof val === 'string';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Number
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Number, otherwise false
|
||||||
|
*/
|
||||||
|
function isNumber(val) {
|
||||||
|
return typeof val === 'number';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is an Object
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is an Object, otherwise false
|
||||||
|
*/
|
||||||
|
function isObject(val) {
|
||||||
|
return val !== null && typeof val === 'object';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Date
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Date, otherwise false
|
||||||
|
*/
|
||||||
|
function isDate(val) {
|
||||||
|
return toString.call(val) === '[object Date]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a File
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a File, otherwise false
|
||||||
|
*/
|
||||||
|
function isFile(val) {
|
||||||
|
return toString.call(val) === '[object File]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Blob
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Blob, otherwise false
|
||||||
|
*/
|
||||||
|
function isBlob(val) {
|
||||||
|
return toString.call(val) === '[object Blob]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Function
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Function, otherwise false
|
||||||
|
*/
|
||||||
|
function isFunction(val) {
|
||||||
|
return toString.call(val) === '[object Function]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Stream
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Stream, otherwise false
|
||||||
|
*/
|
||||||
|
function isStream(val) {
|
||||||
|
return isObject(val) && isFunction(val.pipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a URLSearchParams object
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||||||
|
*/
|
||||||
|
function isURLSearchParams(val) {
|
||||||
|
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim excess whitespace off the beginning and end of a string
|
||||||
|
*
|
||||||
|
* @param {String} str The String to trim
|
||||||
|
* @returns {String} The String freed of excess whitespace
|
||||||
|
*/
|
||||||
|
function trim(str) {
|
||||||
|
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if we're running in a standard browser environment
|
||||||
|
*
|
||||||
|
* This allows axios to run in a web worker, and react-native.
|
||||||
|
* Both environments support XMLHttpRequest, but not fully standard globals.
|
||||||
|
*
|
||||||
|
* web workers:
|
||||||
|
* typeof window -> undefined
|
||||||
|
* typeof document -> undefined
|
||||||
|
*
|
||||||
|
* react-native:
|
||||||
|
* navigator.product -> 'ReactNative'
|
||||||
|
* nativescript
|
||||||
|
* navigator.product -> 'NativeScript' or 'NS'
|
||||||
|
*/
|
||||||
|
function isStandardBrowserEnv() {
|
||||||
|
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
||||||
|
navigator.product === 'NativeScript' ||
|
||||||
|
navigator.product === 'NS')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
typeof window !== 'undefined' &&
|
||||||
|
typeof document !== 'undefined'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate over an Array or an Object invoking a function for each item.
|
||||||
|
*
|
||||||
|
* If `obj` is an Array callback will be called passing
|
||||||
|
* the value, index, and complete array for each item.
|
||||||
|
*
|
||||||
|
* If 'obj' is an Object callback will be called passing
|
||||||
|
* the value, key, and complete object for each property.
|
||||||
|
*
|
||||||
|
* @param {Object|Array} obj The object to iterate
|
||||||
|
* @param {Function} fn The callback to invoke for each item
|
||||||
|
*/
|
||||||
|
function forEach(obj, fn) {
|
||||||
|
// Don't bother if no value provided
|
||||||
|
if (obj === null || typeof obj === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force an array if not already something iterable
|
||||||
|
if (typeof obj !== 'object') {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
obj = [obj];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isArray(obj)) {
|
||||||
|
// Iterate over array values
|
||||||
|
for (var i = 0, l = obj.length; i < l; i++) {
|
||||||
|
fn.call(null, obj[i], i, obj);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Iterate over object keys
|
||||||
|
for (var key in obj) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||||
|
fn.call(null, obj[key], key, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts varargs expecting each argument to be an object, then
|
||||||
|
* immutably merges the properties of each object and returns result.
|
||||||
|
*
|
||||||
|
* When multiple objects contain the same key the later object in
|
||||||
|
* the arguments list will take precedence.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* var result = merge({foo: 123}, {foo: 456});
|
||||||
|
* console.log(result.foo); // outputs 456
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {Object} obj1 Object to merge
|
||||||
|
* @returns {Object} Result of all merge properties
|
||||||
|
*/
|
||||||
|
function merge(/* obj1, obj2, obj3, ... */) {
|
||||||
|
var result = {};
|
||||||
|
function assignValue(val, key) {
|
||||||
|
if (typeof result[key] === 'object' && typeof val === 'object') {
|
||||||
|
result[key] = merge(result[key], val);
|
||||||
|
} else {
|
||||||
|
result[key] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||||
|
forEach(arguments[i], assignValue);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function equal to merge with the difference being that no reference
|
||||||
|
* to original objects is kept.
|
||||||
|
*
|
||||||
|
* @see merge
|
||||||
|
* @param {Object} obj1 Object to merge
|
||||||
|
* @returns {Object} Result of all merge properties
|
||||||
|
*/
|
||||||
|
function deepMerge(/* obj1, obj2, obj3, ... */) {
|
||||||
|
var result = {};
|
||||||
|
function assignValue(val, key) {
|
||||||
|
if (typeof result[key] === 'object' && typeof val === 'object') {
|
||||||
|
result[key] = deepMerge(result[key], val);
|
||||||
|
} else if (typeof val === 'object') {
|
||||||
|
result[key] = deepMerge({}, val);
|
||||||
|
} else {
|
||||||
|
result[key] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||||
|
forEach(arguments[i], assignValue);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extends object a by mutably adding to it the properties of object b.
|
||||||
|
*
|
||||||
|
* @param {Object} a The object to be extended
|
||||||
|
* @param {Object} b The object to copy properties from
|
||||||
|
* @param {Object} thisArg The object to bind function to
|
||||||
|
* @return {Object} The resulting value of object a
|
||||||
|
*/
|
||||||
|
function extend(a, b, thisArg) {
|
||||||
|
forEach(b, function assignValue(val, key) {
|
||||||
|
if (thisArg && typeof val === 'function') {
|
||||||
|
a[key] = bind(val, thisArg);
|
||||||
|
} else {
|
||||||
|
a[key] = val;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
isArray: isArray,
|
||||||
|
isArrayBuffer: isArrayBuffer,
|
||||||
|
isBuffer: isBuffer,
|
||||||
|
isFormData: isFormData,
|
||||||
|
isArrayBufferView: isArrayBufferView,
|
||||||
|
isString: isString,
|
||||||
|
isNumber: isNumber,
|
||||||
|
isObject: isObject,
|
||||||
|
isUndefined: isUndefined,
|
||||||
|
isDate: isDate,
|
||||||
|
isFile: isFile,
|
||||||
|
isBlob: isBlob,
|
||||||
|
isFunction: isFunction,
|
||||||
|
isStream: isStream,
|
||||||
|
isURLSearchParams: isURLSearchParams,
|
||||||
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
||||||
|
forEach: forEach,
|
||||||
|
merge: merge,
|
||||||
|
deepMerge: deepMerge,
|
||||||
|
extend: extend,
|
||||||
|
trim: trim
|
||||||
|
};
|
111
node_modules/axios/package.json
generated
vendored
Normal file
111
node_modules/axios/package.json
generated
vendored
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
{
|
||||||
|
"_from": "axios@0.19.2",
|
||||||
|
"_id": "axios@0.19.2",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
|
||||||
|
"_location": "/axios",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "axios@0.19.2",
|
||||||
|
"name": "axios",
|
||||||
|
"escapedName": "axios",
|
||||||
|
"rawSpec": "0.19.2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "0.19.2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/docker-hub-utils"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
|
||||||
|
"_shasum": "3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27",
|
||||||
|
"_spec": "axios@0.19.2",
|
||||||
|
"_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/docker-hub-utils",
|
||||||
|
"author": {
|
||||||
|
"name": "Matt Zabriskie"
|
||||||
|
},
|
||||||
|
"browser": {
|
||||||
|
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/axios/axios/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"bundlesize": [
|
||||||
|
{
|
||||||
|
"path": "./dist/axios.min.js",
|
||||||
|
"threshold": "5kB"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "1.5.10"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Promise based HTTP client for the browser and node.js",
|
||||||
|
"devDependencies": {
|
||||||
|
"bundlesize": "^0.17.0",
|
||||||
|
"coveralls": "^3.0.0",
|
||||||
|
"es6-promise": "^4.2.4",
|
||||||
|
"grunt": "^1.0.2",
|
||||||
|
"grunt-banner": "^0.6.0",
|
||||||
|
"grunt-cli": "^1.2.0",
|
||||||
|
"grunt-contrib-clean": "^1.1.0",
|
||||||
|
"grunt-contrib-watch": "^1.0.0",
|
||||||
|
"grunt-eslint": "^20.1.0",
|
||||||
|
"grunt-karma": "^2.0.0",
|
||||||
|
"grunt-mocha-test": "^0.13.3",
|
||||||
|
"grunt-ts": "^6.0.0-beta.19",
|
||||||
|
"grunt-webpack": "^1.0.18",
|
||||||
|
"istanbul-instrumenter-loader": "^1.0.0",
|
||||||
|
"jasmine-core": "^2.4.1",
|
||||||
|
"karma": "^1.3.0",
|
||||||
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
|
"karma-coverage": "^1.1.1",
|
||||||
|
"karma-firefox-launcher": "^1.1.0",
|
||||||
|
"karma-jasmine": "^1.1.1",
|
||||||
|
"karma-jasmine-ajax": "^0.1.13",
|
||||||
|
"karma-opera-launcher": "^1.0.0",
|
||||||
|
"karma-safari-launcher": "^1.0.0",
|
||||||
|
"karma-sauce-launcher": "^1.2.0",
|
||||||
|
"karma-sinon": "^1.0.5",
|
||||||
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
|
"karma-webpack": "^1.7.0",
|
||||||
|
"load-grunt-tasks": "^3.5.2",
|
||||||
|
"minimist": "^1.2.0",
|
||||||
|
"mocha": "^5.2.0",
|
||||||
|
"sinon": "^4.5.0",
|
||||||
|
"typescript": "^2.8.1",
|
||||||
|
"url-search-params": "^0.10.0",
|
||||||
|
"webpack": "^1.13.1",
|
||||||
|
"webpack-dev-server": "^1.14.1"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/axios/axios",
|
||||||
|
"keywords": [
|
||||||
|
"xhr",
|
||||||
|
"http",
|
||||||
|
"ajax",
|
||||||
|
"promise",
|
||||||
|
"node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "axios",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/axios/axios.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "NODE_ENV=production grunt build",
|
||||||
|
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
||||||
|
"examples": "node ./examples/server.js",
|
||||||
|
"fix": "eslint --fix lib/**/*.js",
|
||||||
|
"postversion": "git push && git push --tags",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"start": "node ./sandbox/server.js",
|
||||||
|
"test": "grunt test && bundlesize",
|
||||||
|
"version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
|
||||||
|
},
|
||||||
|
"typings": "./index.d.ts",
|
||||||
|
"version": "0.19.2"
|
||||||
|
}
|
103
node_modules/camelcase-keys/index.d.ts
generated
vendored
Normal file
103
node_modules/camelcase-keys/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
declare namespace camelcaseKeys {
|
||||||
|
interface Options {
|
||||||
|
/**
|
||||||
|
Recurse nested objects and objects in arrays.
|
||||||
|
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
readonly deep?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Exclude keys from being camel-cased.
|
||||||
|
|
||||||
|
@default []
|
||||||
|
*/
|
||||||
|
readonly exclude?: ReadonlyArray<string | RegExp>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Exclude children at the given object paths in dot-notation from being camel-cased. For example, with an object like `{a: {b: '🦄'}}`, the object path to reach the unicorn is `'a.b'`.
|
||||||
|
|
||||||
|
@default []
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
camelcaseKeys({
|
||||||
|
a_b: 1,
|
||||||
|
a_c: {
|
||||||
|
c_d: 1,
|
||||||
|
c_e: {
|
||||||
|
e_f: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
deep: true,
|
||||||
|
stopPaths: [
|
||||||
|
'a_c.c_e'
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
// {
|
||||||
|
// aB: 1,
|
||||||
|
// aC: {
|
||||||
|
// cD: 1,
|
||||||
|
// cE: {
|
||||||
|
// e_f: 1
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
readonly stopPaths?: ReadonlyArray<string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Uppercase the first character as in `bye-bye` → `ByeBye`.
|
||||||
|
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
readonly pascalCase?: boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert object keys to camel case using [`camelcase`](https://github.com/sindresorhus/camelcase).
|
||||||
|
|
||||||
|
@param input - Object or array of objects to camel-case.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import camelcaseKeys = require('camelcase-keys');
|
||||||
|
|
||||||
|
// Convert an object
|
||||||
|
camelcaseKeys({'foo-bar': true});
|
||||||
|
//=> {fooBar: true}
|
||||||
|
|
||||||
|
// Convert an array of objects
|
||||||
|
camelcaseKeys([{'foo-bar': true}, {'bar-foo': false}]);
|
||||||
|
//=> [{fooBar: true}, {barFoo: false}]
|
||||||
|
|
||||||
|
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
|
||||||
|
//=> {fooBar: true, nested: {unicornRainbow: true}}
|
||||||
|
|
||||||
|
// Convert object keys to pascal case
|
||||||
|
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true, pascalCase: true});
|
||||||
|
//=> {FooBar: true, Nested: {UnicornRainbow: true}}
|
||||||
|
|
||||||
|
import minimist = require('minimist');
|
||||||
|
|
||||||
|
const argv = minimist(process.argv.slice(2));
|
||||||
|
//=> {_: [], 'foo-bar': true}
|
||||||
|
|
||||||
|
camelcaseKeys(argv);
|
||||||
|
//=> {_: [], fooBar: true}
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
declare function camelcaseKeys<T extends ReadonlyArray<{[key: string]: any}>>(
|
||||||
|
input: T,
|
||||||
|
options?: camelcaseKeys.Options,
|
||||||
|
): T;
|
||||||
|
|
||||||
|
declare function camelcaseKeys<T extends {[key: string]: any}>(
|
||||||
|
input: T,
|
||||||
|
options?: camelcaseKeys.Options,
|
||||||
|
): T;
|
||||||
|
|
||||||
|
export = camelcaseKeys;
|
73
node_modules/camelcase-keys/index.js
generated
vendored
Normal file
73
node_modules/camelcase-keys/index.js
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
'use strict';
|
||||||
|
const mapObj = require('map-obj');
|
||||||
|
const camelCase = require('camelcase');
|
||||||
|
const QuickLru = require('quick-lru');
|
||||||
|
|
||||||
|
const has = (array, key) => array.some(x => {
|
||||||
|
if (typeof x === 'string') {
|
||||||
|
return x === key;
|
||||||
|
}
|
||||||
|
|
||||||
|
x.lastIndex = 0;
|
||||||
|
return x.test(key);
|
||||||
|
});
|
||||||
|
|
||||||
|
const cache = new QuickLru({maxSize: 100000});
|
||||||
|
|
||||||
|
// Reproduces behavior from `map-obj`
|
||||||
|
const isObject = value =>
|
||||||
|
typeof value === 'object' &&
|
||||||
|
value !== null &&
|
||||||
|
!(value instanceof RegExp) &&
|
||||||
|
!(value instanceof Error) &&
|
||||||
|
!(value instanceof Date);
|
||||||
|
|
||||||
|
const camelCaseConvert = (input, options) => {
|
||||||
|
options = {
|
||||||
|
deep: false,
|
||||||
|
pascalCase: false,
|
||||||
|
...options
|
||||||
|
};
|
||||||
|
|
||||||
|
const {exclude, pascalCase, stopPaths, deep} = options;
|
||||||
|
|
||||||
|
const stopPathsSet = new Set(stopPaths);
|
||||||
|
|
||||||
|
const makeMapper = parentPath => (key, value) => {
|
||||||
|
if (deep && isObject(value)) {
|
||||||
|
const path = parentPath === undefined ? key : `${parentPath}.${key}`;
|
||||||
|
|
||||||
|
if (!stopPathsSet.has(path)) {
|
||||||
|
value = mapObj(value, makeMapper(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(exclude && has(exclude, key))) {
|
||||||
|
const cacheKey = pascalCase ? `${key}_` : key;
|
||||||
|
|
||||||
|
if (cache.has(cacheKey)) {
|
||||||
|
key = cache.get(cacheKey);
|
||||||
|
} else {
|
||||||
|
const ret = camelCase(key, {pascalCase});
|
||||||
|
|
||||||
|
if (key.length < 100) { // Prevent abuse
|
||||||
|
cache.set(cacheKey, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
key = ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [key, value];
|
||||||
|
};
|
||||||
|
|
||||||
|
return mapObj(input, makeMapper(undefined));
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = (input, options) => {
|
||||||
|
if (Array.isArray(input)) {
|
||||||
|
return Object.keys(input).map(key => camelCaseConvert(input[key], options));
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelCaseConvert(input, options);
|
||||||
|
};
|
9
node_modules/camelcase-keys/license
generated
vendored
Normal file
9
node_modules/camelcase-keys/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
105
node_modules/camelcase-keys/package.json
generated
vendored
Normal file
105
node_modules/camelcase-keys/package.json
generated
vendored
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
{
|
||||||
|
"_from": "camelcase-keys@6.2.1",
|
||||||
|
"_id": "camelcase-keys@6.2.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-BPCNVH56RVIxQQIXskp5tLQXUNGQ6sXr7iCv1FHDt81xBOQ/1r6H8SPxf19InVP6DexWar4s87q9thfuk8X9HA==",
|
||||||
|
"_location": "/camelcase-keys",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "camelcase-keys@6.2.1",
|
||||||
|
"name": "camelcase-keys",
|
||||||
|
"escapedName": "camelcase-keys",
|
||||||
|
"rawSpec": "6.2.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "6.2.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/docker-hub-utils"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.1.tgz",
|
||||||
|
"_shasum": "cd3e2d2d7db767aa3f247e4c2df93b4661008945",
|
||||||
|
"_spec": "camelcase-keys@6.2.1",
|
||||||
|
"_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/docker-hub-utils",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/sindresorhus/camelcase-keys/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"camelcase": "^5.3.1",
|
||||||
|
"map-obj": "^4.0.0",
|
||||||
|
"quick-lru": "^4.0.1"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Convert object keys to camel case",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^2.1.0",
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"tsd": "^0.11.0",
|
||||||
|
"xo": "^0.25.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"funding": "https://github.com/sponsors/sindresorhus",
|
||||||
|
"homepage": "https://github.com/sindresorhus/camelcase-keys#readme",
|
||||||
|
"keywords": [
|
||||||
|
"map",
|
||||||
|
"obj",
|
||||||
|
"object",
|
||||||
|
"key",
|
||||||
|
"keys",
|
||||||
|
"value",
|
||||||
|
"values",
|
||||||
|
"val",
|
||||||
|
"iterate",
|
||||||
|
"camelcase",
|
||||||
|
"camel-case",
|
||||||
|
"camel",
|
||||||
|
"case",
|
||||||
|
"dash",
|
||||||
|
"hyphen",
|
||||||
|
"dot",
|
||||||
|
"underscore",
|
||||||
|
"separator",
|
||||||
|
"string",
|
||||||
|
"text",
|
||||||
|
"convert",
|
||||||
|
"pascalcase",
|
||||||
|
"pascal-case",
|
||||||
|
"deep",
|
||||||
|
"recurse",
|
||||||
|
"recursive"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "camelcase-keys",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/sindresorhus/camelcase-keys.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "matcha bench/bench.js",
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"version": "6.2.1",
|
||||||
|
"xo": {
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "bench/bench.js",
|
||||||
|
"rules": {
|
||||||
|
"import/no-unresolved": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
125
node_modules/camelcase-keys/readme.md
generated
vendored
Normal file
125
node_modules/camelcase-keys/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
# camelcase-keys [![Build Status](https://travis-ci.org/sindresorhus/camelcase-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase-keys)
|
||||||
|
|
||||||
|
> Convert object keys to camel case using [`camelcase`](https://github.com/sindresorhus/camelcase)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install camelcase-keys
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const camelcaseKeys = require('camelcase-keys');
|
||||||
|
|
||||||
|
// Convert an object
|
||||||
|
camelcaseKeys({'foo-bar': true});
|
||||||
|
//=> {fooBar: true}
|
||||||
|
|
||||||
|
// Convert an array of objects
|
||||||
|
camelcaseKeys([{'foo-bar': true}, {'bar-foo': false}]);
|
||||||
|
//=> [{fooBar: true}, {barFoo: false}]
|
||||||
|
|
||||||
|
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
|
||||||
|
//=> {fooBar: true, nested: {unicornRainbow: true}}
|
||||||
|
|
||||||
|
camelcaseKeys({a_b: 1, a_c: {c_d: 1, c_e: {e_f: 1}}}, {deep: true, stopPaths: ['a_c.c_e']}),
|
||||||
|
//=> {aB: 1, aC: {cD: 1, cE: {e_f: 1}}}
|
||||||
|
|
||||||
|
// Convert object keys to pascal case
|
||||||
|
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true, pascalCase: true});
|
||||||
|
//=> {FooBar: true, Nested: {UnicornRainbow: true}}
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
const camelcaseKeys = require('camelcase-keys');
|
||||||
|
|
||||||
|
const argv = require('minimist')(process.argv.slice(2));
|
||||||
|
//=> {_: [], 'foo-bar': true}
|
||||||
|
|
||||||
|
camelcaseKeys(argv);
|
||||||
|
//=> {_: [], fooBar: true}
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### camelcaseKeys(input, options?)
|
||||||
|
|
||||||
|
#### input
|
||||||
|
|
||||||
|
Type: `object | object[]`
|
||||||
|
|
||||||
|
An object or array of objects to camel-case.
|
||||||
|
|
||||||
|
#### options
|
||||||
|
|
||||||
|
Type: `object`
|
||||||
|
|
||||||
|
##### exclude
|
||||||
|
|
||||||
|
Type: `Array<string | RegExp>`\
|
||||||
|
Default: `[]`
|
||||||
|
|
||||||
|
Exclude keys from being camel-cased.
|
||||||
|
|
||||||
|
##### stopPaths
|
||||||
|
|
||||||
|
Type: `string[]`\
|
||||||
|
Default: `[]`
|
||||||
|
|
||||||
|
Exclude children at the given object paths in dot-notation from being camel-cased. For example, with an object like `{a: {b: '🦄'}}`, the object path to reach the unicorn is `'a.b'`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
camelcaseKeys({
|
||||||
|
a_b: 1,
|
||||||
|
a_c: {
|
||||||
|
c_d: 1,
|
||||||
|
c_e: {
|
||||||
|
e_f: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
deep: true,
|
||||||
|
stopPaths: [
|
||||||
|
'a_c.c_e'
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
aB: 1,
|
||||||
|
aC: {
|
||||||
|
cD: 1,
|
||||||
|
cE: {
|
||||||
|
e_f: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
```
|
||||||
|
|
||||||
|
##### deep
|
||||||
|
|
||||||
|
Type: `boolean`\
|
||||||
|
Default: `false`
|
||||||
|
|
||||||
|
Recurse nested objects and objects in arrays.
|
||||||
|
|
||||||
|
##### pascalCase
|
||||||
|
|
||||||
|
Type: `boolean`\
|
||||||
|
Default: `false`
|
||||||
|
|
||||||
|
Uppercase the first character as in `bye-bye` → `ByeBye`.
|
||||||
|
|
||||||
|
## camelcase-keys for enterprise
|
||||||
|
|
||||||
|
Available as part of the Tidelift Subscription.
|
||||||
|
|
||||||
|
The maintainers of camelcase-keys and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase-keys?utm_source=npm-camelcase-keys&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [snakecase-keys](https://github.com/bendrucker/snakecase-keys)
|
||||||
|
- [kebabcase-keys](https://github.com/mattiloh/kebabcase-keys)
|
||||||
|
|
63
node_modules/camelcase/index.d.ts
generated
vendored
Normal file
63
node_modules/camelcase/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
declare namespace camelcase {
|
||||||
|
interface Options {
|
||||||
|
/**
|
||||||
|
Uppercase the first character: `foo-bar` → `FooBar`.
|
||||||
|
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
readonly pascalCase?: boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const camelcase: {
|
||||||
|
/**
|
||||||
|
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
|
||||||
|
|
||||||
|
@param input - String to convert to camel case.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import camelCase = require('camelcase');
|
||||||
|
|
||||||
|
camelCase('foo-bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo_bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar', {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
|
||||||
|
camelCase('--foo.bar', {pascalCase: false});
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
console.log(process.argv[3]);
|
||||||
|
//=> '--foo-bar'
|
||||||
|
camelCase(process.argv[3]);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['foo', 'bar']);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
|
||||||
|
|
||||||
|
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||||
|
// declare function camelcase(
|
||||||
|
// input: string | ReadonlyArray<string>,
|
||||||
|
// options?: camelcase.Options
|
||||||
|
// ): string;
|
||||||
|
// export = camelcase;
|
||||||
|
default: typeof camelcase;
|
||||||
|
};
|
||||||
|
|
||||||
|
export = camelcase;
|
76
node_modules/camelcase/index.js
generated
vendored
Normal file
76
node_modules/camelcase/index.js
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const preserveCamelCase = string => {
|
||||||
|
let isLastCharLower = false;
|
||||||
|
let isLastCharUpper = false;
|
||||||
|
let isLastLastCharUpper = false;
|
||||||
|
|
||||||
|
for (let i = 0; i < string.length; i++) {
|
||||||
|
const character = string[i];
|
||||||
|
|
||||||
|
if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
|
||||||
|
string = string.slice(0, i) + '-' + string.slice(i);
|
||||||
|
isLastCharLower = false;
|
||||||
|
isLastLastCharUpper = isLastCharUpper;
|
||||||
|
isLastCharUpper = true;
|
||||||
|
i++;
|
||||||
|
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
|
||||||
|
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
|
||||||
|
isLastLastCharUpper = isLastCharUpper;
|
||||||
|
isLastCharUpper = false;
|
||||||
|
isLastCharLower = true;
|
||||||
|
} else {
|
||||||
|
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
|
||||||
|
isLastLastCharUpper = isLastCharUpper;
|
||||||
|
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const camelCase = (input, options) => {
|
||||||
|
if (!(typeof input === 'string' || Array.isArray(input))) {
|
||||||
|
throw new TypeError('Expected the input to be `string | string[]`');
|
||||||
|
}
|
||||||
|
|
||||||
|
options = Object.assign({
|
||||||
|
pascalCase: false
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
|
||||||
|
|
||||||
|
if (Array.isArray(input)) {
|
||||||
|
input = input.map(x => x.trim())
|
||||||
|
.filter(x => x.length)
|
||||||
|
.join('-');
|
||||||
|
} else {
|
||||||
|
input = input.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.length === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.length === 1) {
|
||||||
|
return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasUpperCase = input !== input.toLowerCase();
|
||||||
|
|
||||||
|
if (hasUpperCase) {
|
||||||
|
input = preserveCamelCase(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
input = input
|
||||||
|
.replace(/^[_.\- ]+/, '')
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
|
||||||
|
.replace(/\d+(\w|$)/g, m => m.toUpperCase());
|
||||||
|
|
||||||
|
return postProcess(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = camelCase;
|
||||||
|
// TODO: Remove this for the next major release
|
||||||
|
module.exports.default = camelCase;
|
9
node_modules/camelcase/license
generated
vendored
Normal file
9
node_modules/camelcase/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
75
node_modules/camelcase/package.json
generated
vendored
Normal file
75
node_modules/camelcase/package.json
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
{
|
||||||
|
"_from": "camelcase@^5.3.1",
|
||||||
|
"_id": "camelcase@5.3.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||||
|
"_location": "/camelcase",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "camelcase@^5.3.1",
|
||||||
|
"name": "camelcase",
|
||||||
|
"escapedName": "camelcase",
|
||||||
|
"rawSpec": "^5.3.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^5.3.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/camelcase-keys"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
|
"_shasum": "e3c9b31569e106811df242f715725a1f4c494320",
|
||||||
|
"_spec": "camelcase@^5.3.1",
|
||||||
|
"_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/camelcase-keys",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/sindresorhus/camelcase/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^1.4.1",
|
||||||
|
"tsd": "^0.7.1",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/sindresorhus/camelcase#readme",
|
||||||
|
"keywords": [
|
||||||
|
"camelcase",
|
||||||
|
"camel-case",
|
||||||
|
"camel",
|
||||||
|
"case",
|
||||||
|
"dash",
|
||||||
|
"hyphen",
|
||||||
|
"dot",
|
||||||
|
"underscore",
|
||||||
|
"separator",
|
||||||
|
"string",
|
||||||
|
"text",
|
||||||
|
"convert",
|
||||||
|
"pascalcase",
|
||||||
|
"pascal-case"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "camelcase",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/sindresorhus/camelcase.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"version": "5.3.1"
|
||||||
|
}
|
99
node_modules/camelcase/readme.md
generated
vendored
Normal file
99
node_modules/camelcase/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
|
||||||
|
|
||||||
|
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<b>
|
||||||
|
<a href="https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=readme">Get professional support for 'camelcase' with a Tidelift subscription</a>
|
||||||
|
</b>
|
||||||
|
<br>
|
||||||
|
<sub>
|
||||||
|
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||||
|
</sub>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install camelcase
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const camelCase = require('camelcase');
|
||||||
|
|
||||||
|
camelCase('foo-bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo_bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('Foo-Bar', {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
|
||||||
|
camelCase('--foo.bar', {pascalCase: false});
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase('foo bar');
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
console.log(process.argv[3]);
|
||||||
|
//=> '--foo-bar'
|
||||||
|
camelCase(process.argv[3]);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['foo', 'bar']);
|
||||||
|
//=> 'fooBar'
|
||||||
|
|
||||||
|
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||||
|
//=> 'FooBar'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### camelCase(input, [options])
|
||||||
|
|
||||||
|
#### input
|
||||||
|
|
||||||
|
Type: `string` `string[]`
|
||||||
|
|
||||||
|
String to convert to camel case.
|
||||||
|
|
||||||
|
#### options
|
||||||
|
|
||||||
|
Type: `Object`
|
||||||
|
|
||||||
|
##### pascalCase
|
||||||
|
|
||||||
|
Type: `boolean`<br>
|
||||||
|
Default: `false`
|
||||||
|
|
||||||
|
Uppercase the first character: `foo-bar` → `FooBar`
|
||||||
|
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||||
|
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
|
||||||
|
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
|
||||||
|
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
|
||||||
|
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
1
node_modules/debug/.coveralls.yml
generated
vendored
Normal file
1
node_modules/debug/.coveralls.yml
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
14
node_modules/debug/.eslintrc
generated
vendored
Normal file
14
node_modules/debug/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"chrome": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": 0,
|
||||||
|
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended"
|
||||||
|
}
|
9
node_modules/debug/.npmignore
generated
vendored
Normal file
9
node_modules/debug/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
support
|
||||||
|
test
|
||||||
|
examples
|
||||||
|
example
|
||||||
|
*.sock
|
||||||
|
dist
|
||||||
|
yarn.lock
|
||||||
|
coverage
|
||||||
|
bower.json
|
20
node_modules/debug/.travis.yml
generated
vendored
Normal file
20
node_modules/debug/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
sudo: false
|
||||||
|
|
||||||
|
language: node_js
|
||||||
|
|
||||||
|
node_js:
|
||||||
|
- "4"
|
||||||
|
- "6"
|
||||||
|
- "8"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- make install
|
||||||
|
|
||||||
|
script:
|
||||||
|
- make lint
|
||||||
|
- make test
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- node_js: '8'
|
||||||
|
env: BROWSER=1
|
395
node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
395
node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,395 @@
|
||||||
|
|
||||||
|
3.1.0 / 2017-09-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add `DEBUG_HIDE_DATE` env var (#486)
|
||||||
|
* Remove ReDoS regexp in %o formatter (#504)
|
||||||
|
* Remove "component" from package.json
|
||||||
|
* Remove `component.json`
|
||||||
|
* Ignore package-lock.json
|
||||||
|
* Examples: fix colors printout
|
||||||
|
* Fix: browser detection
|
||||||
|
* Fix: spelling mistake (#496, @EdwardBetts)
|
||||||
|
|
||||||
|
3.0.1 / 2017-08-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Disable colors in Edge and Internet Explorer (#489)
|
||||||
|
|
||||||
|
3.0.0 / 2017-08-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Breaking: Remove DEBUG_FD (#406)
|
||||||
|
* Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418)
|
||||||
|
* Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408)
|
||||||
|
* Addition: document `enabled` flag (#465)
|
||||||
|
* Addition: add 256 colors mode (#481)
|
||||||
|
* Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440)
|
||||||
|
* Update: component: update "ms" to v2.0.0
|
||||||
|
* Update: separate the Node and Browser tests in Travis-CI
|
||||||
|
* Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots
|
||||||
|
* Update: separate Node.js and web browser examples for organization
|
||||||
|
* Update: update "browserify" to v14.4.0
|
||||||
|
* Fix: fix Readme typo (#473)
|
||||||
|
|
||||||
|
2.6.9 / 2017-09-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove ReDoS regexp in %o formatter (#504)
|
||||||
|
|
||||||
|
2.6.8 / 2017-05-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||||
|
|
||||||
|
2.6.7 / 2017-05-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||||
|
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||||
|
* Docs: Fix typo (#455, @msasad)
|
||||||
|
|
||||||
|
2.6.5 / 2017-04-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||||
|
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||||
|
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||||
|
|
||||||
|
|
||||||
|
2.6.4 / 2017-04-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||||
|
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||||
|
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||||
|
|
||||||
|
2.6.3 / 2017-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||||
|
* Docs: Changelog fix (@thebigredgeek)
|
||||||
|
|
||||||
|
2.6.2 / 2017-03-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||||
|
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||||
|
* Docs: Add Slackin invite badge (@tootallnate)
|
||||||
|
|
||||||
|
2.6.1 / 2017-02-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||||
|
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||||
|
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||||
|
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||||
|
|
||||||
|
2.6.0 / 2016-12-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||||
|
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||||
|
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||||
|
|
||||||
|
2.5.2 / 2016-12-25
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||||
|
* Docs: fixed README typo (#391, @lurch)
|
||||||
|
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||||
|
|
||||||
|
2.5.1 / 2016-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: babel-core compatibility
|
||||||
|
|
||||||
|
2.5.0 / 2016-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||||
|
* Fix: webworker compatibility (@thebigredgeek)
|
||||||
|
* Fix: output formatting issue (#388, @kribblo)
|
||||||
|
* Fix: babel-loader compatibility (#383, @escwald)
|
||||||
|
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||||
|
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||||
|
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||||
|
* Test: coveralls integration (#378, @yamikuronue)
|
||||||
|
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||||
|
|
||||||
|
2.4.5 / 2016-12-17
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||||
|
* Fix: custom log function (#379, @hsiliev)
|
||||||
|
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||||
|
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||||
|
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||||
|
|
||||||
|
2.4.4 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||||
|
|
||||||
|
2.4.3 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||||
|
|
||||||
|
2.4.2 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: browser colors (#367, @tootallnate)
|
||||||
|
* Misc: travis ci integration (@thebigredgeek)
|
||||||
|
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||||
|
|
||||||
|
2.4.1 / 2016-12-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: typo that broke the package (#356)
|
||||||
|
|
||||||
|
2.4.0 / 2016-12-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||||
|
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||||
|
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||||
|
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||||
|
* Improvement: allow colors in workers (#335, @botverse)
|
||||||
|
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||||
|
|
||||||
|
2.3.3 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||||
|
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||||
|
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||||
|
|
||||||
|
2.3.2 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||||
|
* Fix: should check whether process exists (Tom Newby)
|
||||||
|
|
||||||
|
2.3.1 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||||
|
* Improvement: Added performance optimizations (@tootallnate)
|
||||||
|
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||||
|
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||||
|
|
||||||
|
2.3.0 / 2016-11-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||||
|
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||||
|
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||||
|
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||||
|
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||||
|
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||||
|
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||||
|
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||||
|
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||||
|
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||||
|
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||||
|
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||||
|
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||||
|
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||||
|
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||||
|
* Misc: Updated contributors (@thebigredgeek)
|
||||||
|
|
||||||
|
2.2.0 / 2015-05-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||||
|
* README: add logging to file example (#193, @DanielOchoa)
|
||||||
|
* README: fixed a typo (#191, @amir-s)
|
||||||
|
* browser: expose `storage` (#190, @stephenmathieson)
|
||||||
|
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||||
|
|
||||||
|
2.1.3 / 2015-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Updated stdout/stderr example (#186)
|
||||||
|
* Updated example/stdout.js to match debug current behaviour
|
||||||
|
* Renamed example/stderr.js to stdout.js
|
||||||
|
* Update Readme.md (#184)
|
||||||
|
* replace high intensity foreground color for bold (#182, #183)
|
||||||
|
|
||||||
|
2.1.2 / 2015-03-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* dist: recompile
|
||||||
|
* update "ms" to v0.7.0
|
||||||
|
* package: update "browserify" to v9.0.3
|
||||||
|
* component: fix "ms.js" repo location
|
||||||
|
* changed bower package name
|
||||||
|
* updated documentation about using debug in a browser
|
||||||
|
* fix: security error on safari (#167, #168, @yields)
|
||||||
|
|
||||||
|
2.1.1 / 2014-12-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: use `typeof` to check for `console` existence
|
||||||
|
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||||
|
* browser: add support for Chrome apps
|
||||||
|
* Readme: added Windows usage remarks
|
||||||
|
* Add `bower.json` to properly support bower install
|
||||||
|
|
||||||
|
2.1.0 / 2014-10-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* node: implement `DEBUG_FD` env variable support
|
||||||
|
* package: update "browserify" to v6.1.0
|
||||||
|
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||||
|
|
||||||
|
2.0.0 / 2014-09-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: update "browserify" to v5.11.0
|
||||||
|
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||||
|
|
||||||
|
1.0.4 / 2014-07-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* dist: recompile
|
||||||
|
* example: remove `console.info()` log usage
|
||||||
|
* example: add "Content-Type" UTF-8 header to browser example
|
||||||
|
* browser: place %c marker after the space character
|
||||||
|
* browser: reset the "content" color via `color: inherit`
|
||||||
|
* browser: add colors support for Firefox >= v31
|
||||||
|
* debug: prefer an instance `log()` function over the global one (#119)
|
||||||
|
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||||
|
|
||||||
|
1.0.3 / 2014-07-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||||
|
* browser: fix lint
|
||||||
|
|
||||||
|
1.0.2 / 2014-06-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: update color palette (#113, @gscottolson)
|
||||||
|
* common: make console logging function configurable (#108, @timoxley)
|
||||||
|
* node: fix %o colors on old node <= 0.8.x
|
||||||
|
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||||
|
|
||||||
|
1.0.1 / 2014-06-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: use `removeItem()` to clear localStorage
|
||||||
|
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||||
|
* package: add "contributors" section
|
||||||
|
* node: fix comment typo
|
||||||
|
* README: list authors
|
||||||
|
|
||||||
|
1.0.0 / 2014-06-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* make ms diff be global, not be scope
|
||||||
|
* debug: ignore empty strings in enable()
|
||||||
|
* node: make DEBUG_COLORS able to disable coloring
|
||||||
|
* *: export the `colors` array
|
||||||
|
* npmignore: don't publish the `dist` dir
|
||||||
|
* Makefile: refactor to use browserify
|
||||||
|
* package: add "browserify" as a dev dependency
|
||||||
|
* Readme: add Web Inspector Colors section
|
||||||
|
* node: reset terminal color for the debug content
|
||||||
|
* node: map "%o" to `util.inspect()`
|
||||||
|
* browser: map "%j" to `JSON.stringify()`
|
||||||
|
* debug: add custom "formatters"
|
||||||
|
* debug: use "ms" module for humanizing the diff
|
||||||
|
* Readme: add "bash" syntax highlighting
|
||||||
|
* browser: add Firebug color support
|
||||||
|
* browser: add colors for WebKit browsers
|
||||||
|
* node: apply log to `console`
|
||||||
|
* rewrite: abstract common logic for Node & browsers
|
||||||
|
* add .jshintrc file
|
||||||
|
|
||||||
|
0.8.1 / 2014-04-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: re-add the "component" section
|
||||||
|
|
||||||
|
0.8.0 / 2014-03-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `enable()` method for nodejs. Closes #27
|
||||||
|
* change from stderr to stdout
|
||||||
|
* remove unnecessary index.js file
|
||||||
|
|
||||||
|
0.7.4 / 2013-11-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove "browserify" key from package.json (fixes something in browserify)
|
||||||
|
|
||||||
|
0.7.3 / 2013-10-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||||
|
* add debug(err) support. Closes #46
|
||||||
|
* add .browser prop to package.json. Closes #42
|
||||||
|
|
||||||
|
0.7.2 / 2013-02-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix package.json
|
||||||
|
* fix: Mobile Safari (private mode) is broken with debug
|
||||||
|
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||||
|
|
||||||
|
0.7.1 / 2013-02-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add repository URL to package.json
|
||||||
|
* add DEBUG_COLORED to force colored output
|
||||||
|
* add browserify support
|
||||||
|
* fix component. Closes #24
|
||||||
|
|
||||||
|
0.7.0 / 2012-05-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added .component to package.json
|
||||||
|
* Added debug.component.js build
|
||||||
|
|
||||||
|
0.6.0 / 2012-03-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||||
|
* Added `.enabled` flag to the node version [TooTallNate]
|
||||||
|
|
||||||
|
0.5.0 / 2012-02-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: humanize diffs. Closes #8
|
||||||
|
* Added `debug.disable()` to the CS variant
|
||||||
|
* Removed padding. Closes #10
|
||||||
|
* Fixed: persist client-side variant again. Closes #9
|
||||||
|
|
||||||
|
0.4.0 / 2012-02-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added browser variant support for older browsers [TooTallNate]
|
||||||
|
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||||
|
* Added padding to diff (moved it to the right)
|
||||||
|
|
||||||
|
0.3.0 / 2012-01-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added millisecond diff when isatty, otherwise UTC string
|
||||||
|
|
||||||
|
0.2.0 / 2012-01-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added wildcard support
|
||||||
|
|
||||||
|
0.1.0 / 2011-12-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||||
|
|
||||||
|
0.0.1 / 2010-01-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Initial release
|
19
node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/debug/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
58
node_modules/debug/Makefile
generated
vendored
Normal file
58
node_modules/debug/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||||
|
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||||
|
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||||
|
|
||||||
|
# BIN directory
|
||||||
|
BIN := $(THIS_DIR)/node_modules/.bin
|
||||||
|
|
||||||
|
# Path
|
||||||
|
PATH := node_modules/.bin:$(PATH)
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
|
# applications
|
||||||
|
NODE ?= $(shell which node)
|
||||||
|
YARN ?= $(shell which yarn)
|
||||||
|
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||||
|
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||||
|
|
||||||
|
install: node_modules
|
||||||
|
|
||||||
|
browser: dist/debug.js
|
||||||
|
|
||||||
|
node_modules: package.json
|
||||||
|
@NODE_ENV= $(PKG) install
|
||||||
|
@touch node_modules
|
||||||
|
|
||||||
|
dist/debug.js: src/*.js node_modules
|
||||||
|
@mkdir -p dist
|
||||||
|
@$(BROWSERIFY) \
|
||||||
|
--standalone debug \
|
||||||
|
. > dist/debug.js
|
||||||
|
|
||||||
|
lint:
|
||||||
|
@eslint *.js src/*.js
|
||||||
|
|
||||||
|
test-node:
|
||||||
|
@istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||||
|
@cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||||
|
|
||||||
|
test-browser:
|
||||||
|
@$(MAKE) browser
|
||||||
|
@karma start --single-run
|
||||||
|
|
||||||
|
test-all:
|
||||||
|
@concurrently \
|
||||||
|
"make test-node" \
|
||||||
|
"make test-browser"
|
||||||
|
|
||||||
|
test:
|
||||||
|
@if [ "x$(BROWSER)" = "x" ]; then \
|
||||||
|
$(MAKE) test-node; \
|
||||||
|
else \
|
||||||
|
$(MAKE) test-browser; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rimraf dist coverage
|
||||||
|
|
||||||
|
.PHONY: browser install clean lint test test-all test-node test-browser
|
368
node_modules/debug/README.md
generated
vendored
Normal file
368
node_modules/debug/README.md
generated
vendored
Normal file
|
@ -0,0 +1,368 @@
|
||||||
|
# debug
|
||||||
|
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
|
||||||
|
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
|
||||||
|
|
||||||
|
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||||
|
|
||||||
|
A tiny JavaScript debugging utility modelled after Node.js core's debugging
|
||||||
|
technique. Works in Node.js and web browsers.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install debug
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||||
|
|
||||||
|
Example [_app.js_](./examples/node/app.js):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug')('http')
|
||||||
|
, http = require('http')
|
||||||
|
, name = 'My App';
|
||||||
|
|
||||||
|
// fake app
|
||||||
|
|
||||||
|
debug('booting %o', name);
|
||||||
|
|
||||||
|
http.createServer(function(req, res){
|
||||||
|
debug(req.method + ' ' + req.url);
|
||||||
|
res.end('hello\n');
|
||||||
|
}).listen(3000, function(){
|
||||||
|
debug('listening');
|
||||||
|
});
|
||||||
|
|
||||||
|
// fake worker of some kind
|
||||||
|
|
||||||
|
require('./worker');
|
||||||
|
```
|
||||||
|
|
||||||
|
Example [_worker.js_](./examples/node/worker.js):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var a = require('debug')('worker:a')
|
||||||
|
, b = require('debug')('worker:b');
|
||||||
|
|
||||||
|
function work() {
|
||||||
|
a('doing lots of uninteresting work');
|
||||||
|
setTimeout(work, Math.random() * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
work();
|
||||||
|
|
||||||
|
function workb() {
|
||||||
|
b('doing some work');
|
||||||
|
setTimeout(workb, Math.random() * 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
workb();
|
||||||
|
```
|
||||||
|
|
||||||
|
The `DEBUG` environment variable is then used to enable these based on space or
|
||||||
|
comma-delimited names.
|
||||||
|
|
||||||
|
Here are some examples:
|
||||||
|
|
||||||
|
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
|
||||||
|
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
|
||||||
|
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
|
||||||
|
|
||||||
|
#### Windows note
|
||||||
|
|
||||||
|
On Windows the environment variable is set using the `set` command.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
set DEBUG=*,-not_this
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that PowerShell uses different syntax to set environment variables.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
$env:DEBUG = "*,-not_this"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, run the program to be debugged as usual.
|
||||||
|
|
||||||
|
|
||||||
|
## Namespace Colors
|
||||||
|
|
||||||
|
Every debug instance has a color generated for it based on its namespace name.
|
||||||
|
This helps when visually parsing the debug output to identify which debug instance
|
||||||
|
a debug line belongs to.
|
||||||
|
|
||||||
|
#### Node.js
|
||||||
|
|
||||||
|
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
|
||||||
|
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
|
||||||
|
otherwise debug will only use a small handful of basic colors.
|
||||||
|
|
||||||
|
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
|
||||||
|
|
||||||
|
#### Web Browser
|
||||||
|
|
||||||
|
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||||
|
option. These are WebKit web inspectors, Firefox ([since version
|
||||||
|
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||||
|
and the Firebug plugin for Firefox (any version).
|
||||||
|
|
||||||
|
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
|
||||||
|
|
||||||
|
|
||||||
|
## Millisecond diff
|
||||||
|
|
||||||
|
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||||
|
|
||||||
|
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||||
|
|
||||||
|
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
|
||||||
|
|
||||||
|
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
|
||||||
|
|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
|
||||||
|
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
|
||||||
|
|
||||||
|
## Wildcards
|
||||||
|
|
||||||
|
The `*` character may be used as a wildcard. Suppose for example your library has
|
||||||
|
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
|
||||||
|
instead of listing all three with
|
||||||
|
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
|
||||||
|
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||||
|
|
||||||
|
You can also exclude specific debuggers by prefixing them with a "-" character.
|
||||||
|
For example, `DEBUG=*,-connect:*` would include all debuggers except those
|
||||||
|
starting with "connect:".
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
When running through Node.js, you can set a few environment variables that will
|
||||||
|
change the behavior of the debug logging:
|
||||||
|
|
||||||
|
| Name | Purpose |
|
||||||
|
|-----------|-------------------------------------------------|
|
||||||
|
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||||
|
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
|
||||||
|
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||||
|
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||||
|
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||||
|
|
||||||
|
|
||||||
|
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||||
|
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||||
|
See the Node.js documentation for
|
||||||
|
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||||
|
for the complete list.
|
||||||
|
|
||||||
|
## Formatters
|
||||||
|
|
||||||
|
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
|
||||||
|
Below are the officially supported formatters:
|
||||||
|
|
||||||
|
| Formatter | Representation |
|
||||||
|
|-----------|----------------|
|
||||||
|
| `%O` | Pretty-print an Object on multiple lines. |
|
||||||
|
| `%o` | Pretty-print an Object all on a single line. |
|
||||||
|
| `%s` | String. |
|
||||||
|
| `%d` | Number (both integer and float). |
|
||||||
|
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||||
|
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||||
|
|
||||||
|
|
||||||
|
### Custom formatters
|
||||||
|
|
||||||
|
You can add custom formatters by extending the `debug.formatters` object.
|
||||||
|
For example, if you wanted to add support for rendering a Buffer as hex with
|
||||||
|
`%h`, you could do something like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const createDebug = require('debug')
|
||||||
|
createDebug.formatters.h = (v) => {
|
||||||
|
return v.toString('hex')
|
||||||
|
}
|
||||||
|
|
||||||
|
// …elsewhere
|
||||||
|
const debug = createDebug('foo')
|
||||||
|
debug('this is hex: %h', new Buffer('hello world'))
|
||||||
|
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Browser Support
|
||||||
|
|
||||||
|
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||||
|
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||||
|
if you don't want to build it yourself.
|
||||||
|
|
||||||
|
Debug's enable state is currently persisted by `localStorage`.
|
||||||
|
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||||
|
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
localStorage.debug = 'worker:*'
|
||||||
|
```
|
||||||
|
|
||||||
|
And then refresh the page.
|
||||||
|
|
||||||
|
```js
|
||||||
|
a = debug('worker:a');
|
||||||
|
b = debug('worker:b');
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
a('doing some work');
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
b('doing some work');
|
||||||
|
}, 1200);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Output streams
|
||||||
|
|
||||||
|
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||||
|
|
||||||
|
Example [_stdout.js_](./examples/node/stdout.js):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug');
|
||||||
|
var error = debug('app:error');
|
||||||
|
|
||||||
|
// by default stderr is used
|
||||||
|
error('goes to stderr!');
|
||||||
|
|
||||||
|
var log = debug('app:log');
|
||||||
|
// set this namespace to log via console.log
|
||||||
|
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||||
|
log('goes to stdout');
|
||||||
|
error('still goes to stderr!');
|
||||||
|
|
||||||
|
// set all output to go via console.info
|
||||||
|
// overrides all per-namespace log settings
|
||||||
|
debug.log = console.info.bind(console);
|
||||||
|
error('now goes to stdout via console.info');
|
||||||
|
log('still goes to stdout, but via console.info now');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Checking whether a debug target is enabled
|
||||||
|
|
||||||
|
After you've created a debug instance, you can determine whether or not it is
|
||||||
|
enabled by checking the `enabled` property:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const debug = require('debug')('http');
|
||||||
|
|
||||||
|
if (debug.enabled) {
|
||||||
|
// do stuff...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also manually toggle this property to force the debug instance to be
|
||||||
|
enabled or disabled.
|
||||||
|
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
- TJ Holowaychuk
|
||||||
|
- Nathan Rajlich
|
||||||
|
- Andrew Rhyne
|
||||||
|
|
||||||
|
## Backers
|
||||||
|
|
||||||
|
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
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.
|
70
node_modules/debug/karma.conf.js
generated
vendored
Normal file
70
node_modules/debug/karma.conf.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
// Karma configuration
|
||||||
|
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||||
|
|
||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
|
||||||
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||||
|
basePath: '',
|
||||||
|
|
||||||
|
|
||||||
|
// frameworks to use
|
||||||
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
|
frameworks: ['mocha', 'chai', 'sinon'],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files / patterns to load in the browser
|
||||||
|
files: [
|
||||||
|
'dist/debug.js',
|
||||||
|
'test/*spec.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files to exclude
|
||||||
|
exclude: [
|
||||||
|
'src/node.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// preprocess matching files before serving them to the browser
|
||||||
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
|
preprocessors: {
|
||||||
|
},
|
||||||
|
|
||||||
|
// test results reporter to use
|
||||||
|
// possible values: 'dots', 'progress'
|
||||||
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||||
|
reporters: ['progress'],
|
||||||
|
|
||||||
|
|
||||||
|
// web server port
|
||||||
|
port: 9876,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable colors in the output (reporters and logs)
|
||||||
|
colors: true,
|
||||||
|
|
||||||
|
|
||||||
|
// level of logging
|
||||||
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
|
autoWatch: true,
|
||||||
|
|
||||||
|
|
||||||
|
// start these browsers
|
||||||
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||||
|
browsers: ['PhantomJS'],
|
||||||
|
|
||||||
|
|
||||||
|
// Continuous Integration mode
|
||||||
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
|
singleRun: false,
|
||||||
|
|
||||||
|
// Concurrency level
|
||||||
|
// how many browser should be started simultaneous
|
||||||
|
concurrency: Infinity
|
||||||
|
})
|
||||||
|
}
|
1
node_modules/debug/node.js
generated
vendored
Normal file
1
node_modules/debug/node.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./src/node');
|
82
node_modules/debug/package.json
generated
vendored
Normal file
82
node_modules/debug/package.json
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
{
|
||||||
|
"_from": "debug@=3.1.0",
|
||||||
|
"_id": "debug@3.1.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||||
|
"_location": "/debug",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "debug@=3.1.0",
|
||||||
|
"name": "debug",
|
||||||
|
"escapedName": "debug",
|
||||||
|
"rawSpec": "=3.1.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "=3.1.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/follow-redirects"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||||
|
"_shasum": "5bb5a0672628b64149566ba16819e61518c67261",
|
||||||
|
"_spec": "debug@=3.1.0",
|
||||||
|
"_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/follow-redirects",
|
||||||
|
"author": {
|
||||||
|
"name": "TJ Holowaychuk",
|
||||||
|
"email": "tj@vision-media.ca"
|
||||||
|
},
|
||||||
|
"browser": "./src/browser.js",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/visionmedia/debug/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Nathan Rajlich",
|
||||||
|
"email": "nathan@tootallnate.net",
|
||||||
|
"url": "http://n8.io"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andrew Rhyne",
|
||||||
|
"email": "rhyneandrew@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "small debugging utility",
|
||||||
|
"devDependencies": {
|
||||||
|
"browserify": "14.4.0",
|
||||||
|
"chai": "^3.5.0",
|
||||||
|
"concurrently": "^3.1.0",
|
||||||
|
"coveralls": "^2.11.15",
|
||||||
|
"eslint": "^3.12.1",
|
||||||
|
"istanbul": "^0.4.5",
|
||||||
|
"karma": "^1.3.0",
|
||||||
|
"karma-chai": "^0.1.0",
|
||||||
|
"karma-mocha": "^1.3.0",
|
||||||
|
"karma-phantomjs-launcher": "^1.0.2",
|
||||||
|
"karma-sinon": "^1.0.5",
|
||||||
|
"mocha": "^3.2.0",
|
||||||
|
"mocha-lcov-reporter": "^1.2.0",
|
||||||
|
"rimraf": "^2.5.4",
|
||||||
|
"sinon": "^1.17.6",
|
||||||
|
"sinon-chai": "^2.8.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"log",
|
||||||
|
"debugger"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./src/index.js",
|
||||||
|
"name": "debug",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/visionmedia/debug.git"
|
||||||
|
},
|
||||||
|
"version": "3.1.0"
|
||||||
|
}
|
195
node_modules/debug/src/browser.js
generated
vendored
Normal file
195
node_modules/debug/src/browser.js
generated
vendored
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
/**
|
||||||
|
* This is the web browser implementation of `debug()`.
|
||||||
|
*
|
||||||
|
* Expose `debug()` as the module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = require('./debug');
|
||||||
|
exports.log = log;
|
||||||
|
exports.formatArgs = formatArgs;
|
||||||
|
exports.save = save;
|
||||||
|
exports.load = load;
|
||||||
|
exports.useColors = useColors;
|
||||||
|
exports.storage = 'undefined' != typeof chrome
|
||||||
|
&& 'undefined' != typeof chrome.storage
|
||||||
|
? chrome.storage.local
|
||||||
|
: localstorage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.colors = [
|
||||||
|
'#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
|
||||||
|
'#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
|
||||||
|
'#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
|
||||||
|
'#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
|
||||||
|
'#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
|
||||||
|
'#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
|
||||||
|
'#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
|
||||||
|
'#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
|
||||||
|
'#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
|
||||||
|
'#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
|
||||||
|
'#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||||
|
* and the Firebug extension (any Firefox version) are known
|
||||||
|
* to support "%c" CSS customizations.
|
||||||
|
*
|
||||||
|
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||||
|
*/
|
||||||
|
|
||||||
|
function useColors() {
|
||||||
|
// NB: In an Electron preload script, document will be defined but not fully
|
||||||
|
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||||
|
// explicitly
|
||||||
|
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internet Explorer and Edge do not support colors.
|
||||||
|
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||||
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||||
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||||
|
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||||
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||||
|
// is firefox >= v31?
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||||
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||||
|
// double check webkit in userAgent just in case we are in a worker
|
||||||
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters.j = function(v) {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(v);
|
||||||
|
} catch (err) {
|
||||||
|
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colorize log arguments if enabled.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formatArgs(args) {
|
||||||
|
var useColors = this.useColors;
|
||||||
|
|
||||||
|
args[0] = (useColors ? '%c' : '')
|
||||||
|
+ this.namespace
|
||||||
|
+ (useColors ? ' %c' : ' ')
|
||||||
|
+ args[0]
|
||||||
|
+ (useColors ? '%c ' : ' ')
|
||||||
|
+ '+' + exports.humanize(this.diff);
|
||||||
|
|
||||||
|
if (!useColors) return;
|
||||||
|
|
||||||
|
var c = 'color: ' + this.color;
|
||||||
|
args.splice(1, 0, c, 'color: inherit')
|
||||||
|
|
||||||
|
// the final "%c" is somewhat tricky, because there could be other
|
||||||
|
// arguments passed either before or after the %c, so we need to
|
||||||
|
// figure out the correct index to insert the CSS into
|
||||||
|
var index = 0;
|
||||||
|
var lastC = 0;
|
||||||
|
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
||||||
|
if ('%%' === match) return;
|
||||||
|
index++;
|
||||||
|
if ('%c' === match) {
|
||||||
|
// we only are interested in the *last* %c
|
||||||
|
// (the user may have provided their own)
|
||||||
|
lastC = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
args.splice(lastC, 0, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes `console.log()` when available.
|
||||||
|
* No-op when `console.log` is not a "function".
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
// this hackery is required for IE8/9, where
|
||||||
|
// the `console.log` function doesn't have 'apply'
|
||||||
|
return 'object' === typeof console
|
||||||
|
&& console.log
|
||||||
|
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save `namespaces`.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function save(namespaces) {
|
||||||
|
try {
|
||||||
|
if (null == namespaces) {
|
||||||
|
exports.storage.removeItem('debug');
|
||||||
|
} else {
|
||||||
|
exports.storage.debug = namespaces;
|
||||||
|
}
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load `namespaces`.
|
||||||
|
*
|
||||||
|
* @return {String} returns the previously persisted debug modes
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
var r;
|
||||||
|
try {
|
||||||
|
r = exports.storage.debug;
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
|
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||||
|
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||||
|
r = process.env.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable namespaces listed in `localStorage.debug` initially.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.enable(load());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localstorage attempts to return the localstorage.
|
||||||
|
*
|
||||||
|
* This is necessary because safari throws
|
||||||
|
* when a user disables cookies/localstorage
|
||||||
|
* and you attempt to access it.
|
||||||
|
*
|
||||||
|
* @return {LocalStorage}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function localstorage() {
|
||||||
|
try {
|
||||||
|
return window.localStorage;
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
225
node_modules/debug/src/debug.js
generated
vendored
Normal file
225
node_modules/debug/src/debug.js
generated
vendored
Normal file
|
@ -0,0 +1,225 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the common logic for both the Node.js and web browser
|
||||||
|
* implementations of `debug()`.
|
||||||
|
*
|
||||||
|
* Expose `debug()` as the module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
||||||
|
exports.coerce = coerce;
|
||||||
|
exports.disable = disable;
|
||||||
|
exports.enable = enable;
|
||||||
|
exports.enabled = enabled;
|
||||||
|
exports.humanize = require('ms');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active `debug` instances.
|
||||||
|
*/
|
||||||
|
exports.instances = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently active debug mode names, and names to skip.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.names = [];
|
||||||
|
exports.skips = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||||
|
*
|
||||||
|
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select a color.
|
||||||
|
* @param {String} namespace
|
||||||
|
* @return {Number}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function selectColor(namespace) {
|
||||||
|
var hash = 0, i;
|
||||||
|
|
||||||
|
for (i in namespace) {
|
||||||
|
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||||
|
hash |= 0; // Convert to 32bit integer
|
||||||
|
}
|
||||||
|
|
||||||
|
return exports.colors[Math.abs(hash) % exports.colors.length];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a debugger with the given `namespace`.
|
||||||
|
*
|
||||||
|
* @param {String} namespace
|
||||||
|
* @return {Function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createDebug(namespace) {
|
||||||
|
|
||||||
|
var prevTime;
|
||||||
|
|
||||||
|
function debug() {
|
||||||
|
// disabled?
|
||||||
|
if (!debug.enabled) return;
|
||||||
|
|
||||||
|
var self = debug;
|
||||||
|
|
||||||
|
// set `diff` timestamp
|
||||||
|
var curr = +new Date();
|
||||||
|
var ms = curr - (prevTime || curr);
|
||||||
|
self.diff = ms;
|
||||||
|
self.prev = prevTime;
|
||||||
|
self.curr = curr;
|
||||||
|
prevTime = curr;
|
||||||
|
|
||||||
|
// turn the `arguments` into a proper Array
|
||||||
|
var args = new Array(arguments.length);
|
||||||
|
for (var i = 0; i < args.length; i++) {
|
||||||
|
args[i] = arguments[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
args[0] = exports.coerce(args[0]);
|
||||||
|
|
||||||
|
if ('string' !== typeof args[0]) {
|
||||||
|
// anything else let's inspect with %O
|
||||||
|
args.unshift('%O');
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply any `formatters` transformations
|
||||||
|
var index = 0;
|
||||||
|
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
||||||
|
// if we encounter an escaped % then don't increase the array index
|
||||||
|
if (match === '%%') return match;
|
||||||
|
index++;
|
||||||
|
var formatter = exports.formatters[format];
|
||||||
|
if ('function' === typeof formatter) {
|
||||||
|
var val = args[index];
|
||||||
|
match = formatter.call(self, val);
|
||||||
|
|
||||||
|
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||||
|
args.splice(index, 1);
|
||||||
|
index--;
|
||||||
|
}
|
||||||
|
return match;
|
||||||
|
});
|
||||||
|
|
||||||
|
// apply env-specific formatting (colors, etc.)
|
||||||
|
exports.formatArgs.call(self, args);
|
||||||
|
|
||||||
|
var logFn = debug.log || exports.log || console.log.bind(console);
|
||||||
|
logFn.apply(self, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug.namespace = namespace;
|
||||||
|
debug.enabled = exports.enabled(namespace);
|
||||||
|
debug.useColors = exports.useColors();
|
||||||
|
debug.color = selectColor(namespace);
|
||||||
|
debug.destroy = destroy;
|
||||||
|
|
||||||
|
// env-specific initialization logic for debug instances
|
||||||
|
if ('function' === typeof exports.init) {
|
||||||
|
exports.init(debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.instances.push(debug);
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy () {
|
||||||
|
var index = exports.instances.indexOf(this);
|
||||||
|
if (index !== -1) {
|
||||||
|
exports.instances.splice(index, 1);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables a debug mode by namespaces. This can include modes
|
||||||
|
* separated by a colon and wildcards.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enable(namespaces) {
|
||||||
|
exports.save(namespaces);
|
||||||
|
|
||||||
|
exports.names = [];
|
||||||
|
exports.skips = [];
|
||||||
|
|
||||||
|
var i;
|
||||||
|
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||||
|
var len = split.length;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
if (!split[i]) continue; // ignore empty strings
|
||||||
|
namespaces = split[i].replace(/\*/g, '.*?');
|
||||||
|
if (namespaces[0] === '-') {
|
||||||
|
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||||
|
} else {
|
||||||
|
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < exports.instances.length; i++) {
|
||||||
|
var instance = exports.instances[i];
|
||||||
|
instance.enabled = exports.enabled(instance.namespace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable debug output.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function disable() {
|
||||||
|
exports.enable('');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given mode name is enabled, false otherwise.
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @return {Boolean}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enabled(name) {
|
||||||
|
if (name[name.length - 1] === '*') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var i, len;
|
||||||
|
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||||
|
if (exports.skips[i].test(name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||||
|
if (exports.names[i].test(name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coerce `val`.
|
||||||
|
*
|
||||||
|
* @param {Mixed} val
|
||||||
|
* @return {Mixed}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function coerce(val) {
|
||||||
|
if (val instanceof Error) return val.stack || val.message;
|
||||||
|
return val;
|
||||||
|
}
|
10
node_modules/debug/src/index.js
generated
vendored
Normal file
10
node_modules/debug/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/**
|
||||||
|
* Detect Electron renderer process, which is node, but we should
|
||||||
|
* treat as a browser.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (typeof process === 'undefined' || process.type === 'renderer') {
|
||||||
|
module.exports = require('./browser.js');
|
||||||
|
} else {
|
||||||
|
module.exports = require('./node.js');
|
||||||
|
}
|
186
node_modules/debug/src/node.js
generated
vendored
Normal file
186
node_modules/debug/src/node.js
generated
vendored
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var tty = require('tty');
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the Node.js implementation of `debug()`.
|
||||||
|
*
|
||||||
|
* Expose `debug()` as the module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = require('./debug');
|
||||||
|
exports.init = init;
|
||||||
|
exports.log = log;
|
||||||
|
exports.formatArgs = formatArgs;
|
||||||
|
exports.save = save;
|
||||||
|
exports.load = load;
|
||||||
|
exports.useColors = useColors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.colors = [ 6, 2, 3, 4, 5, 1 ];
|
||||||
|
|
||||||
|
try {
|
||||||
|
var supportsColor = require('supports-color');
|
||||||
|
if (supportsColor && supportsColor.level >= 2) {
|
||||||
|
exports.colors = [
|
||||||
|
20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68,
|
||||||
|
69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134,
|
||||||
|
135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
|
||||||
|
172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204,
|
||||||
|
205, 206, 207, 208, 209, 214, 215, 220, 221
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build up the default `inspectOpts` object from the environment variables.
|
||||||
|
*
|
||||||
|
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||||
|
return /^debug_/i.test(key);
|
||||||
|
}).reduce(function (obj, key) {
|
||||||
|
// camel-case
|
||||||
|
var prop = key
|
||||||
|
.substring(6)
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
||||||
|
|
||||||
|
// coerce string value into JS value
|
||||||
|
var val = process.env[key];
|
||||||
|
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
||||||
|
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
||||||
|
else if (val === 'null') val = null;
|
||||||
|
else val = Number(val);
|
||||||
|
|
||||||
|
obj[prop] = val;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function useColors() {
|
||||||
|
return 'colors' in exports.inspectOpts
|
||||||
|
? Boolean(exports.inspectOpts.colors)
|
||||||
|
: tty.isatty(process.stderr.fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %o to `util.inspect()`, all on a single line.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters.o = function(v) {
|
||||||
|
this.inspectOpts.colors = this.useColors;
|
||||||
|
return util.inspect(v, this.inspectOpts)
|
||||||
|
.split('\n').map(function(str) {
|
||||||
|
return str.trim()
|
||||||
|
}).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters.O = function(v) {
|
||||||
|
this.inspectOpts.colors = this.useColors;
|
||||||
|
return util.inspect(v, this.inspectOpts);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds ANSI color escape codes if enabled.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formatArgs(args) {
|
||||||
|
var name = this.namespace;
|
||||||
|
var useColors = this.useColors;
|
||||||
|
|
||||||
|
if (useColors) {
|
||||||
|
var c = this.color;
|
||||||
|
var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c);
|
||||||
|
var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m';
|
||||||
|
|
||||||
|
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||||
|
args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||||
|
} else {
|
||||||
|
args[0] = getDate() + name + ' ' + args[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDate() {
|
||||||
|
if (exports.inspectOpts.hideDate) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return new Date().toISOString() + ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
return process.stderr.write(util.format.apply(util, arguments) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save `namespaces`.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function save(namespaces) {
|
||||||
|
if (null == namespaces) {
|
||||||
|
// If you set a process.env field to null or undefined, it gets cast to the
|
||||||
|
// string 'null' or 'undefined'. Just delete instead.
|
||||||
|
delete process.env.DEBUG;
|
||||||
|
} else {
|
||||||
|
process.env.DEBUG = namespaces;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load `namespaces`.
|
||||||
|
*
|
||||||
|
* @return {String} returns the previously persisted debug modes
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
return process.env.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init logic for `debug` instances.
|
||||||
|
*
|
||||||
|
* Create a new `inspectOpts` object in case `useColors` is set
|
||||||
|
* differently for a particular `debug` instance.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function init (debug) {
|
||||||
|
debug.inspectOpts = {};
|
||||||
|
|
||||||
|
var keys = Object.keys(exports.inspectOpts);
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.enable(load());
|
50
node_modules/docker-hub-utils/README.md
generated
vendored
Normal file
50
node_modules/docker-hub-utils/README.md
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/jessestuart/docker-hub-utils">
|
||||||
|
<img
|
||||||
|
src="https://github.com/jessestuart/docker-hub-utils/blob/master/assets/nodejs-docker.png?raw=true"
|
||||||
|
width="50%"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<h1 align="center">
|
||||||
|
docker-hub-utils
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
[![CircleCI][circleci-badge]][circleci-link] [![npm][npm-badge]][npm-link]
|
||||||
|
[![codecov][codecov]][codecov 2]
|
||||||
|
|
||||||
|
### What is this?
|
||||||
|
|
||||||
|
`docker-hub-utils` is an [NPM package][npm-link] (packaged to work both in
|
||||||
|
`node.js` as well as in the browser), providing utility functions wrapping the
|
||||||
|
[Docker Hub API][docker 2]. This was created because the native API provides
|
||||||
|
little to no support for basic operations like filtering queries, and can be
|
||||||
|
quite verbose when e.g., fetching [Manifest Lists][docker], which is required to
|
||||||
|
determine which architectures a given image supports.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Currently supported operations
|
||||||
|
|
||||||
|
- Querying top repos by username / organization name.
|
||||||
|
- Filtering top user / org repositories by date last updated; this is useful
|
||||||
|
when you're only interested in repositories that have been updated in the past
|
||||||
|
`N` months / years / etc, a feature missing from the native API.
|
||||||
|
- Fetching Manifest Lists for any repository image in a single function call,
|
||||||
|
abstracting away the bearer token authentication dance.
|
||||||
|
|
||||||
|
You can see examples of these operations in use within the
|
||||||
|
[`docker-hub-graphql-api`][github 2] project, or in this project's test cases.
|
||||||
|
|
||||||
|
[circleci-badge]:
|
||||||
|
https://circleci.com/gh/jessestuart/docker-hub-utils.svg?style=shield
|
||||||
|
[circleci-link]: https://circleci.com/gh/jessestuart/docker-hub-utils
|
||||||
|
[codecov 2]: https://codecov.io/gh/jessestuart/docker-hub-utils
|
||||||
|
[codecov]:
|
||||||
|
https://codecov.io/gh/jessestuart/docker-hub-utils/branch/master/graph/badge.svg
|
||||||
|
[docker 2]: https://docs.docker.com/registry/spec/api/
|
||||||
|
[docker]: https://docs.docker.com/registry/spec/manifest-v2-2/
|
||||||
|
[github 2]: https://github.com/jessestuart/docker-hub-graphql-api
|
||||||
|
[github]: https://github.com/jessestuart/multiar.ch
|
||||||
|
[npm-badge]: https://img.shields.io/npm/v/docker-hub-utils.svg
|
||||||
|
[npm-link]: https://www.npmjs.com/package/docker-hub-utils
|
272
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js
generated
vendored
Normal file
272
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js
generated
vendored
Normal file
|
@ -0,0 +1,272 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||||
|
|
||||||
|
var axios = _interopDefault(require('axios'));
|
||||||
|
var camelcaseKeys = _interopDefault(require('camelcase-keys'));
|
||||||
|
var luxon = require('luxon');
|
||||||
|
var R = _interopDefault(require('ramda'));
|
||||||
|
var pino = _interopDefault(require('pino'));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Union type representing the architecture defined in part of an OCI image's
|
||||||
|
* manifest list.
|
||||||
|
*
|
||||||
|
* As specified in the Docker Manifest spec, any valid GOARCH values are valid
|
||||||
|
* image architecture values, and vice versa:
|
||||||
|
* > The platform object describes the platform which the image in the manifest
|
||||||
|
* > runs on. A full list of valid operating system and architecture values are
|
||||||
|
* > listed in the Go language documentation for $GOOS and $GOARCH
|
||||||
|
* @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function (Architecture) {
|
||||||
|
Architecture["i386"] = "386";
|
||||||
|
Architecture["amd64"] = "amd64";
|
||||||
|
Architecture["arm"] = "arm";
|
||||||
|
Architecture["arm64"] = "arm64";
|
||||||
|
Architecture["mips"] = "mips";
|
||||||
|
Architecture["mips64"] = "mips64";
|
||||||
|
Architecture["mips64le"] = "mips64le";
|
||||||
|
Architecture["mipsle"] = "mipsle";
|
||||||
|
Architecture["ppc64"] = "ppc64";
|
||||||
|
Architecture["ppc64le"] = "ppc64le";
|
||||||
|
Architecture["s390x"] = "s390x";
|
||||||
|
Architecture["wasm"] = "wasm";
|
||||||
|
})(exports.Architecture || (exports.Architecture = {}));
|
||||||
|
/**
|
||||||
|
* Union type representing the OS defined in part of an OCI image's
|
||||||
|
* manifest list.
|
||||||
|
* See the docs for the `Architecture` type above for more info.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var OS;
|
||||||
|
|
||||||
|
(function (OS) {
|
||||||
|
OS["aix"] = "aix";
|
||||||
|
OS["android"] = "android";
|
||||||
|
OS["darwin"] = "darwin";
|
||||||
|
OS["dragonfly"] = "dragonfly";
|
||||||
|
OS["freebsd"] = "freebsd";
|
||||||
|
OS["illumos"] = "illumos";
|
||||||
|
OS["js"] = "js";
|
||||||
|
OS["linux"] = "linux";
|
||||||
|
OS["netbsd"] = "netbsd";
|
||||||
|
OS["openbsd"] = "openbsd";
|
||||||
|
OS["plan9"] = "plan9";
|
||||||
|
OS["solaris"] = "solaris";
|
||||||
|
OS["windows"] = "windows";
|
||||||
|
})(OS || (OS = {}));
|
||||||
|
|
||||||
|
(function (ManifestMediaType) {
|
||||||
|
ManifestMediaType["Manifest"] = "application/vnd.docker.distribution.manifest.v2+json";
|
||||||
|
ManifestMediaType["ManifestList"] = "application/vnd.docker.distribution.manifest.list.v2+json";
|
||||||
|
})(exports.ManifestMediaType || (exports.ManifestMediaType = {}));
|
||||||
|
|
||||||
|
var log = /*#__PURE__*/
|
||||||
|
pino({
|
||||||
|
base: null,
|
||||||
|
useLevelLabels: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/';
|
||||||
|
var DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently only supports fetching the manifest for the `latest` tag; in
|
||||||
|
* reality, we can pass any valid content digest[1] to retrieve the manifest(s)
|
||||||
|
* for that image.
|
||||||
|
*
|
||||||
|
* [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests
|
||||||
|
*/
|
||||||
|
|
||||||
|
var createManifestListURL = function createManifestListURL(_ref) {
|
||||||
|
var repo = _ref.repo;
|
||||||
|
return "https://registry-1.docker.io/v2/" + repo.user + "/" + repo.name + "/manifests/latest";
|
||||||
|
};
|
||||||
|
|
||||||
|
var createUserReposListURL = function createUserReposListURL(user) {
|
||||||
|
return DOCKER_HUB_API_ROOT + "repositories/" + user;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* The OCI distribution spec requires a unique token for each repo manifest queried.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var fetchDockerHubToken = function fetchDockerHubToken(repo) {
|
||||||
|
try {
|
||||||
|
var name = repo.name,
|
||||||
|
user = repo.user;
|
||||||
|
return Promise.resolve(axios.get(DOCKER_HUB_API_AUTH_URL, {
|
||||||
|
params: {
|
||||||
|
scope: "repository:" + user + "/" + name + ":pull",
|
||||||
|
service: 'registry.docker.io'
|
||||||
|
}
|
||||||
|
})).then(function (tokenRequest) {
|
||||||
|
var token = R.path(['data', 'token'], tokenRequest);
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
throw new Error('Unable to retrieve auth token from registry.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Pure function that massages the Docker Hub API response into the
|
||||||
|
* format we want to return. e.g., only extracting certain fields;
|
||||||
|
* converting snake_case to camelCase, etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var extractRepositoryDetails = function extractRepositoryDetails(repos, lastUpdatedSince) {
|
||||||
|
if (!repos || R.isEmpty(repos)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var parsedRepos = camelcaseKeys(repos);
|
||||||
|
|
||||||
|
if (R.isNil(lastUpdatedSince)) {
|
||||||
|
return parsedRepos;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsedRepos.filter(function (repo) {
|
||||||
|
return luxon.DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Query a single repository given a repo name and username.
|
||||||
|
*
|
||||||
|
* @param user The DockerHub username or org name to query for.
|
||||||
|
* @param name The DockerHub repo name -- restrict to this single repo.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryRepo = function queryRepo(_ref2) {
|
||||||
|
var name = _ref2.name,
|
||||||
|
user = _ref2.user;
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Promise.resolve(axios.request({
|
||||||
|
url: DOCKER_HUB_API_ROOT + "repositories/" + user + "/" + name + "/"
|
||||||
|
})).then(function (repoResult) {
|
||||||
|
var repo = R.prop('data', repoResult);
|
||||||
|
|
||||||
|
if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelcaseKeys(repo);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Top-level function for querying repositories.
|
||||||
|
*
|
||||||
|
* @TODO Rename to just `queryRepos`.
|
||||||
|
*
|
||||||
|
* @param user The DockerHub username or org name to query for.
|
||||||
|
* @param numRepos The number of repos to query (max 100).
|
||||||
|
* @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryTopRepos = function queryTopRepos(_ref3) {
|
||||||
|
var lastUpdatedSince = _ref3.lastUpdatedSince,
|
||||||
|
_ref3$numRepos = _ref3.numRepos,
|
||||||
|
numRepos = _ref3$numRepos === void 0 ? 100 : _ref3$numRepos,
|
||||||
|
user = _ref3.user;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (numRepos > 100) {
|
||||||
|
throw new RangeError('Number of repos to query cannot exceed 100.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var listReposURL = createUserReposListURL(user);
|
||||||
|
return Promise.resolve(axios.get(listReposURL, {
|
||||||
|
params: {
|
||||||
|
page: 1,
|
||||||
|
page_size: numRepos
|
||||||
|
}
|
||||||
|
})).then(function (repoResults) {
|
||||||
|
var repos = R.path(['data', 'results'], repoResults);
|
||||||
|
return extractRepositoryDetails(repos, lastUpdatedSince);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Query image tags.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryTags = function queryTags(repo) {
|
||||||
|
try {
|
||||||
|
var repoUrl = createUserReposListURL(repo.user);
|
||||||
|
var tagsUrl = repoUrl + "/" + repo.name + "/tags?page_size=100";
|
||||||
|
return Promise.resolve(axios.get(tagsUrl)).then(function (tagsResults) {
|
||||||
|
var tags = R.path(['data', 'results'], tagsResults);
|
||||||
|
|
||||||
|
if (!tags || R.isEmpty(tags)) {
|
||||||
|
return;
|
||||||
|
} // @ts-ignore
|
||||||
|
|
||||||
|
|
||||||
|
return camelcaseKeys(tags);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Queries the Docker Hub API to retrieve a "fat manifest", an object of
|
||||||
|
* `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.
|
||||||
|
* Read up on the Manifest v2, Schema 2 Spec in more detail:
|
||||||
|
* @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md
|
||||||
|
* Or the shiny new OCI distribution spec which builds on it:
|
||||||
|
* @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md
|
||||||
|
*/
|
||||||
|
|
||||||
|
var fetchManifestList = function fetchManifestList(repo) {
|
||||||
|
try {
|
||||||
|
// Docker Hub requires a unique token for each repo manifest queried.
|
||||||
|
return Promise.resolve(fetchDockerHubToken(repo)).then(function (token) {
|
||||||
|
var manifestListURL = createManifestListURL({
|
||||||
|
repo: repo
|
||||||
|
});
|
||||||
|
return Promise.resolve(axios.get(manifestListURL, {
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/vnd.docker.distribution.manifest.list.v2+json',
|
||||||
|
Authorization: "Bearer " + token
|
||||||
|
}
|
||||||
|
})).then(function (manifestListResponse) {
|
||||||
|
// For now, just ignore legacy V1 schema manifests. They have an entirely
|
||||||
|
// different response shape and it's not worth mucking up the schema to
|
||||||
|
// support a legacy format.
|
||||||
|
if (manifestListResponse.data.schemaVersion === 1) {
|
||||||
|
log.info('Schema version 1 is unsupported.', repo.name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return R.path(['data'], manifestListResponse);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.DOCKER_HUB_API_AUTH_URL = DOCKER_HUB_API_AUTH_URL;
|
||||||
|
exports.DOCKER_HUB_API_ROOT = DOCKER_HUB_API_ROOT;
|
||||||
|
exports.extractRepositoryDetails = extractRepositoryDetails;
|
||||||
|
exports.fetchDockerHubToken = fetchDockerHubToken;
|
||||||
|
exports.fetchManifestList = fetchManifestList;
|
||||||
|
exports.queryRepo = queryRepo;
|
||||||
|
exports.queryTags = queryTags;
|
||||||
|
exports.queryTopRepos = queryTopRepos;
|
||||||
|
//# sourceMappingURL=docker-hub-utils.cjs.development.js.map
|
1
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js.map
generated
vendored
Normal file
1
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js
generated
vendored
Normal file
2
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r,t,s,i=e(require("axios")),o=e(require("camelcase-keys")),n=require("luxon"),a=e(require("ramda")),u=e(require("pino"));(r=exports.Architecture||(exports.Architecture={})).i386="386",r.amd64="amd64",r.arm="arm",r.arm64="arm64",r.mips="mips",r.mips64="mips64",r.mips64le="mips64le",r.mipsle="mipsle",r.ppc64="ppc64",r.ppc64le="ppc64le",r.s390x="s390x",r.wasm="wasm",function(e){e.aix="aix",e.android="android",e.darwin="darwin",e.dragonfly="dragonfly",e.freebsd="freebsd",e.illumos="illumos",e.js="js",e.linux="linux",e.netbsd="netbsd",e.openbsd="openbsd",e.plan9="plan9",e.solaris="solaris",e.windows="windows"}(t||(t={})),(s=exports.ManifestMediaType||(exports.ManifestMediaType={})).Manifest="application/vnd.docker.distribution.manifest.v2+json",s.ManifestList="application/vnd.docker.distribution.manifest.list.v2+json";var p=u({base:null,useLevelLabels:!0}),c=function(e){return"https://hub.docker.com/v2/repositories/"+e},d=function(e){try{return Promise.resolve(i.get("https://auth.docker.io/token",{params:{scope:"repository:"+e.user+"/"+e.name+":pull",service:"registry.docker.io"}})).then((function(e){var r=a.path(["data","token"],e);if(!r)throw new Error("Unable to retrieve auth token from registry.");return r}))}catch(e){return Promise.reject(e)}},m=function(e,r){if(!e||a.isEmpty(e))return[];var t=o(e);return a.isNil(r)?t:t.filter((function(e){return n.DateTime.fromISO(e.lastUpdated)<r}))};exports.DOCKER_HUB_API_AUTH_URL="https://auth.docker.io/token",exports.DOCKER_HUB_API_ROOT="https://hub.docker.com/v2/",exports.extractRepositoryDetails=m,exports.fetchDockerHubToken=d,exports.fetchManifestList=function(e){try{return Promise.resolve(d(e)).then((function(r){var t=function(e){var r=e.repo;return"https://registry-1.docker.io/v2/"+r.user+"/"+r.name+"/manifests/latest"}({repo:e});return Promise.resolve(i.get(t,{headers:{Accept:"application/vnd.docker.distribution.manifest.list.v2+json",Authorization:"Bearer "+r}})).then((function(r){if(1!==r.data.schemaVersion)return a.path(["data"],r);p.info("Schema version 1 is unsupported.",e.name)}))}))}catch(e){return Promise.reject(e)}},exports.queryRepo=function(e){var r=e.name,t=e.user;try{return Promise.resolve(i.request({url:"https://hub.docker.com/v2/repositories/"+t+"/"+r+"/"})).then((function(e){var r=a.prop("data",e);if(200===e.status&&r&&!a.isEmpty(r))return o(r)}))}catch(e){return Promise.reject(e)}},exports.queryTags=function(e){try{var r=c(e.user);return Promise.resolve(i.get(r+"/"+e.name+"/tags?page_size=100")).then((function(e){var r=a.path(["data","results"],e);if(r&&!a.isEmpty(r))return o(r)}))}catch(e){return Promise.reject(e)}},exports.queryTopRepos=function(e){var r=e.lastUpdatedSince,t=e.numRepos,s=void 0===t?100:t,o=e.user;try{if(s>100)throw new RangeError("Number of repos to query cannot exceed 100.");var n=c(o);return Promise.resolve(i.get(n,{params:{page:1,page_size:s}})).then((function(e){var t=a.path(["data","results"],e);return m(t,r)}))}catch(e){return Promise.reject(e)}};
|
||||||
|
//# sourceMappingURL=docker-hub-utils.cjs.production.min.js.map
|
1
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js.map
generated
vendored
Normal file
1
node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
262
node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js
generated
vendored
Normal file
262
node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js
generated
vendored
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
import camelcaseKeys from 'camelcase-keys';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
import R from 'ramda';
|
||||||
|
import pino from 'pino';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Union type representing the architecture defined in part of an OCI image's
|
||||||
|
* manifest list.
|
||||||
|
*
|
||||||
|
* As specified in the Docker Manifest spec, any valid GOARCH values are valid
|
||||||
|
* image architecture values, and vice versa:
|
||||||
|
* > The platform object describes the platform which the image in the manifest
|
||||||
|
* > runs on. A full list of valid operating system and architecture values are
|
||||||
|
* > listed in the Go language documentation for $GOOS and $GOARCH
|
||||||
|
* @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
|
||||||
|
*/
|
||||||
|
var Architecture;
|
||||||
|
|
||||||
|
(function (Architecture) {
|
||||||
|
Architecture["i386"] = "386";
|
||||||
|
Architecture["amd64"] = "amd64";
|
||||||
|
Architecture["arm"] = "arm";
|
||||||
|
Architecture["arm64"] = "arm64";
|
||||||
|
Architecture["mips"] = "mips";
|
||||||
|
Architecture["mips64"] = "mips64";
|
||||||
|
Architecture["mips64le"] = "mips64le";
|
||||||
|
Architecture["mipsle"] = "mipsle";
|
||||||
|
Architecture["ppc64"] = "ppc64";
|
||||||
|
Architecture["ppc64le"] = "ppc64le";
|
||||||
|
Architecture["s390x"] = "s390x";
|
||||||
|
Architecture["wasm"] = "wasm";
|
||||||
|
})(Architecture || (Architecture = {}));
|
||||||
|
/**
|
||||||
|
* Union type representing the OS defined in part of an OCI image's
|
||||||
|
* manifest list.
|
||||||
|
* See the docs for the `Architecture` type above for more info.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var OS;
|
||||||
|
|
||||||
|
(function (OS) {
|
||||||
|
OS["aix"] = "aix";
|
||||||
|
OS["android"] = "android";
|
||||||
|
OS["darwin"] = "darwin";
|
||||||
|
OS["dragonfly"] = "dragonfly";
|
||||||
|
OS["freebsd"] = "freebsd";
|
||||||
|
OS["illumos"] = "illumos";
|
||||||
|
OS["js"] = "js";
|
||||||
|
OS["linux"] = "linux";
|
||||||
|
OS["netbsd"] = "netbsd";
|
||||||
|
OS["openbsd"] = "openbsd";
|
||||||
|
OS["plan9"] = "plan9";
|
||||||
|
OS["solaris"] = "solaris";
|
||||||
|
OS["windows"] = "windows";
|
||||||
|
})(OS || (OS = {}));
|
||||||
|
|
||||||
|
var ManifestMediaType;
|
||||||
|
|
||||||
|
(function (ManifestMediaType) {
|
||||||
|
ManifestMediaType["Manifest"] = "application/vnd.docker.distribution.manifest.v2+json";
|
||||||
|
ManifestMediaType["ManifestList"] = "application/vnd.docker.distribution.manifest.list.v2+json";
|
||||||
|
})(ManifestMediaType || (ManifestMediaType = {}));
|
||||||
|
|
||||||
|
var log = /*#__PURE__*/
|
||||||
|
pino({
|
||||||
|
base: null,
|
||||||
|
useLevelLabels: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/';
|
||||||
|
var DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently only supports fetching the manifest for the `latest` tag; in
|
||||||
|
* reality, we can pass any valid content digest[1] to retrieve the manifest(s)
|
||||||
|
* for that image.
|
||||||
|
*
|
||||||
|
* [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests
|
||||||
|
*/
|
||||||
|
|
||||||
|
var createManifestListURL = function createManifestListURL(_ref) {
|
||||||
|
var repo = _ref.repo;
|
||||||
|
return "https://registry-1.docker.io/v2/" + repo.user + "/" + repo.name + "/manifests/latest";
|
||||||
|
};
|
||||||
|
|
||||||
|
var createUserReposListURL = function createUserReposListURL(user) {
|
||||||
|
return DOCKER_HUB_API_ROOT + "repositories/" + user;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* The OCI distribution spec requires a unique token for each repo manifest queried.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var fetchDockerHubToken = function fetchDockerHubToken(repo) {
|
||||||
|
try {
|
||||||
|
var name = repo.name,
|
||||||
|
user = repo.user;
|
||||||
|
return Promise.resolve(axios.get(DOCKER_HUB_API_AUTH_URL, {
|
||||||
|
params: {
|
||||||
|
scope: "repository:" + user + "/" + name + ":pull",
|
||||||
|
service: 'registry.docker.io'
|
||||||
|
}
|
||||||
|
})).then(function (tokenRequest) {
|
||||||
|
var token = R.path(['data', 'token'], tokenRequest);
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
throw new Error('Unable to retrieve auth token from registry.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Pure function that massages the Docker Hub API response into the
|
||||||
|
* format we want to return. e.g., only extracting certain fields;
|
||||||
|
* converting snake_case to camelCase, etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var extractRepositoryDetails = function extractRepositoryDetails(repos, lastUpdatedSince) {
|
||||||
|
if (!repos || R.isEmpty(repos)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var parsedRepos = camelcaseKeys(repos);
|
||||||
|
|
||||||
|
if (R.isNil(lastUpdatedSince)) {
|
||||||
|
return parsedRepos;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsedRepos.filter(function (repo) {
|
||||||
|
return DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Query a single repository given a repo name and username.
|
||||||
|
*
|
||||||
|
* @param user The DockerHub username or org name to query for.
|
||||||
|
* @param name The DockerHub repo name -- restrict to this single repo.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryRepo = function queryRepo(_ref2) {
|
||||||
|
var name = _ref2.name,
|
||||||
|
user = _ref2.user;
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Promise.resolve(axios.request({
|
||||||
|
url: DOCKER_HUB_API_ROOT + "repositories/" + user + "/" + name + "/"
|
||||||
|
})).then(function (repoResult) {
|
||||||
|
var repo = R.prop('data', repoResult);
|
||||||
|
|
||||||
|
if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelcaseKeys(repo);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Top-level function for querying repositories.
|
||||||
|
*
|
||||||
|
* @TODO Rename to just `queryRepos`.
|
||||||
|
*
|
||||||
|
* @param user The DockerHub username or org name to query for.
|
||||||
|
* @param numRepos The number of repos to query (max 100).
|
||||||
|
* @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryTopRepos = function queryTopRepos(_ref3) {
|
||||||
|
var lastUpdatedSince = _ref3.lastUpdatedSince,
|
||||||
|
_ref3$numRepos = _ref3.numRepos,
|
||||||
|
numRepos = _ref3$numRepos === void 0 ? 100 : _ref3$numRepos,
|
||||||
|
user = _ref3.user;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (numRepos > 100) {
|
||||||
|
throw new RangeError('Number of repos to query cannot exceed 100.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var listReposURL = createUserReposListURL(user);
|
||||||
|
return Promise.resolve(axios.get(listReposURL, {
|
||||||
|
params: {
|
||||||
|
page: 1,
|
||||||
|
page_size: numRepos
|
||||||
|
}
|
||||||
|
})).then(function (repoResults) {
|
||||||
|
var repos = R.path(['data', 'results'], repoResults);
|
||||||
|
return extractRepositoryDetails(repos, lastUpdatedSince);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Query image tags.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryTags = function queryTags(repo) {
|
||||||
|
try {
|
||||||
|
var repoUrl = createUserReposListURL(repo.user);
|
||||||
|
var tagsUrl = repoUrl + "/" + repo.name + "/tags?page_size=100";
|
||||||
|
return Promise.resolve(axios.get(tagsUrl)).then(function (tagsResults) {
|
||||||
|
var tags = R.path(['data', 'results'], tagsResults);
|
||||||
|
|
||||||
|
if (!tags || R.isEmpty(tags)) {
|
||||||
|
return;
|
||||||
|
} // @ts-ignore
|
||||||
|
|
||||||
|
|
||||||
|
return camelcaseKeys(tags);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Queries the Docker Hub API to retrieve a "fat manifest", an object of
|
||||||
|
* `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.
|
||||||
|
* Read up on the Manifest v2, Schema 2 Spec in more detail:
|
||||||
|
* @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md
|
||||||
|
* Or the shiny new OCI distribution spec which builds on it:
|
||||||
|
* @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md
|
||||||
|
*/
|
||||||
|
|
||||||
|
var fetchManifestList = function fetchManifestList(repo) {
|
||||||
|
try {
|
||||||
|
// Docker Hub requires a unique token for each repo manifest queried.
|
||||||
|
return Promise.resolve(fetchDockerHubToken(repo)).then(function (token) {
|
||||||
|
var manifestListURL = createManifestListURL({
|
||||||
|
repo: repo
|
||||||
|
});
|
||||||
|
return Promise.resolve(axios.get(manifestListURL, {
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/vnd.docker.distribution.manifest.list.v2+json',
|
||||||
|
Authorization: "Bearer " + token
|
||||||
|
}
|
||||||
|
})).then(function (manifestListResponse) {
|
||||||
|
// For now, just ignore legacy V1 schema manifests. They have an entirely
|
||||||
|
// different response shape and it's not worth mucking up the schema to
|
||||||
|
// support a legacy format.
|
||||||
|
if (manifestListResponse.data.schemaVersion === 1) {
|
||||||
|
log.info('Schema version 1 is unsupported.', repo.name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return R.path(['data'], manifestListResponse);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { Architecture, DOCKER_HUB_API_AUTH_URL, DOCKER_HUB_API_ROOT, ManifestMediaType, extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos };
|
||||||
|
//# sourceMappingURL=docker-hub-utils.esm.js.map
|
1
node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js.map
generated
vendored
Normal file
1
node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/docker-hub-utils/dist/index.d.ts
generated
vendored
Normal file
6
node_modules/docker-hub-utils/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { Architecture, DockerHubAPIRepo, DockerHubRepo, DockerManifest, DockerManifestList, ManifestMediaType, Tag } from './types/DockerHubRepo';
|
||||||
|
import { extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos } from './services/DockerHubAPI';
|
||||||
|
import { DOCKER_HUB_API_AUTH_URL, DOCKER_HUB_API_ROOT } from './utils/constants';
|
||||||
|
export { Architecture, DockerHubAPIRepo, DockerHubRepo, DockerManifest, DockerManifestList, ManifestMediaType, Tag, };
|
||||||
|
export { extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos, };
|
||||||
|
export { DOCKER_HUB_API_ROOT, DOCKER_HUB_API_AUTH_URL };
|
8
node_modules/docker-hub-utils/dist/index.js
generated
vendored
Normal file
8
node_modules/docker-hub-utils/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
module.exports = require('./docker-hub-utils.cjs.production.min.js')
|
||||||
|
} else {
|
||||||
|
module.exports = require('./docker-hub-utils.cjs.development.js')
|
||||||
|
}
|
49
node_modules/docker-hub-utils/dist/services/DockerHubAPI.d.ts
generated
vendored
Normal file
49
node_modules/docker-hub-utils/dist/services/DockerHubAPI.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
import { DockerHubAPIRepo, DockerHubRepo, DockerManifestList, Tag } from '../types/DockerHubRepo';
|
||||||
|
/**
|
||||||
|
* The OCI distribution spec requires a unique token for each repo manifest queried.
|
||||||
|
*/
|
||||||
|
export declare const fetchDockerHubToken: (repo: DockerHubRepo) => Promise<string>;
|
||||||
|
/**
|
||||||
|
* Pure function that massages the Docker Hub API response into the
|
||||||
|
* format we want to return. e.g., only extracting certain fields;
|
||||||
|
* converting snake_case to camelCase, etc.
|
||||||
|
*/
|
||||||
|
export declare const extractRepositoryDetails: (repos: DockerHubAPIRepo[], lastUpdatedSince?: DateTime | undefined) => DockerHubRepo[];
|
||||||
|
/**
|
||||||
|
* Query a single repository given a repo name and username.
|
||||||
|
*
|
||||||
|
* @param user The DockerHub username or org name to query for.
|
||||||
|
* @param name The DockerHub repo name -- restrict to this single repo.
|
||||||
|
*/
|
||||||
|
export declare const queryRepo: ({ name, user, }: {
|
||||||
|
name: string;
|
||||||
|
user: string;
|
||||||
|
}) => Promise<DockerHubRepo | undefined>;
|
||||||
|
/**
|
||||||
|
* Top-level function for querying repositories.
|
||||||
|
*
|
||||||
|
* @TODO Rename to just `queryRepos`.
|
||||||
|
*
|
||||||
|
* @param user The DockerHub username or org name to query for.
|
||||||
|
* @param numRepos The number of repos to query (max 100).
|
||||||
|
* @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.
|
||||||
|
*/
|
||||||
|
export declare const queryTopRepos: ({ lastUpdatedSince, numRepos, user, }: {
|
||||||
|
lastUpdatedSince?: DateTime | undefined;
|
||||||
|
numRepos?: number | undefined;
|
||||||
|
user: string;
|
||||||
|
}) => Promise<DockerHubRepo[]>;
|
||||||
|
/**
|
||||||
|
* Query image tags.
|
||||||
|
*/
|
||||||
|
export declare const queryTags: (repo: DockerHubRepo) => Promise<Tag[] | undefined>;
|
||||||
|
/**
|
||||||
|
* Queries the Docker Hub API to retrieve a "fat manifest", an object of
|
||||||
|
* `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.
|
||||||
|
* Read up on the Manifest v2, Schema 2 Spec in more detail:
|
||||||
|
* @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md
|
||||||
|
* Or the shiny new OCI distribution spec which builds on it:
|
||||||
|
* @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md
|
||||||
|
*/
|
||||||
|
export declare const fetchManifestList: (repo: DockerHubRepo) => Promise<DockerManifestList | undefined>;
|
123
node_modules/docker-hub-utils/dist/types/DockerHubRepo.d.ts
generated
vendored
Normal file
123
node_modules/docker-hub-utils/dist/types/DockerHubRepo.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
/**
|
||||||
|
* This is a direct representation of what we get back from the `/repositories`
|
||||||
|
* API call.
|
||||||
|
*/
|
||||||
|
export interface DockerHubAPIRepo {
|
||||||
|
readonly can_edit: boolean;
|
||||||
|
readonly description: string;
|
||||||
|
readonly is_automated: boolean;
|
||||||
|
readonly is_migrated: boolean;
|
||||||
|
readonly is_private: boolean;
|
||||||
|
readonly last_updated: string;
|
||||||
|
readonly name: string;
|
||||||
|
readonly namespace: string;
|
||||||
|
readonly pull_count: number;
|
||||||
|
readonly repository_type: string;
|
||||||
|
readonly star_count: number;
|
||||||
|
readonly status: number;
|
||||||
|
readonly user: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Union type representing the architecture defined in part of an OCI image's
|
||||||
|
* manifest list.
|
||||||
|
*
|
||||||
|
* As specified in the Docker Manifest spec, any valid GOARCH values are valid
|
||||||
|
* image architecture values, and vice versa:
|
||||||
|
* > The platform object describes the platform which the image in the manifest
|
||||||
|
* > runs on. A full list of valid operating system and architecture values are
|
||||||
|
* > listed in the Go language documentation for $GOOS and $GOARCH
|
||||||
|
* @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
|
||||||
|
*/
|
||||||
|
export declare enum Architecture {
|
||||||
|
i386 = "386",
|
||||||
|
amd64 = "amd64",
|
||||||
|
arm = "arm",
|
||||||
|
arm64 = "arm64",
|
||||||
|
mips = "mips",
|
||||||
|
mips64 = "mips64",
|
||||||
|
mips64le = "mips64le",
|
||||||
|
mipsle = "mipsle",
|
||||||
|
ppc64 = "ppc64",
|
||||||
|
ppc64le = "ppc64le",
|
||||||
|
s390x = "s390x",
|
||||||
|
wasm = "wasm"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Union type representing the OS defined in part of an OCI image's
|
||||||
|
* manifest list.
|
||||||
|
* See the docs for the `Architecture` type above for more info.
|
||||||
|
*/
|
||||||
|
export declare enum OS {
|
||||||
|
aix = "aix",
|
||||||
|
android = "android",
|
||||||
|
darwin = "darwin",
|
||||||
|
dragonfly = "dragonfly",
|
||||||
|
freebsd = "freebsd",
|
||||||
|
illumos = "illumos",
|
||||||
|
js = "js",
|
||||||
|
linux = "linux",
|
||||||
|
netbsd = "netbsd",
|
||||||
|
openbsd = "openbsd",
|
||||||
|
plan9 = "plan9",
|
||||||
|
solaris = "solaris",
|
||||||
|
windows = "windows"
|
||||||
|
}
|
||||||
|
export declare enum ManifestMediaType {
|
||||||
|
Manifest = "application/vnd.docker.distribution.manifest.v2+json",
|
||||||
|
ManifestList = "application/vnd.docker.distribution.manifest.list.v2+json"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Yes, there's *way* more information contained in the manifest / "fat"
|
||||||
|
* manifestList than just architectures, but I find this to be the most
|
||||||
|
* relevant section for my projects. PR's welcome.
|
||||||
|
*/
|
||||||
|
export interface DockerManifest {
|
||||||
|
readonly digest: string;
|
||||||
|
readonly mediaType: ManifestMediaType;
|
||||||
|
readonly platform: Array<{
|
||||||
|
architecture: Architecture;
|
||||||
|
os: OS;
|
||||||
|
}>;
|
||||||
|
readonly schemaVersion: 1 | 2 | number;
|
||||||
|
}
|
||||||
|
export interface DockerManifestList {
|
||||||
|
readonly manifests: DockerManifest[];
|
||||||
|
readonly mediaType: ManifestMediaType;
|
||||||
|
readonly schemaVersion: 1 | 2 | any;
|
||||||
|
}
|
||||||
|
export interface DockerHubRepo {
|
||||||
|
readonly description: string | null | undefined;
|
||||||
|
readonly lastUpdated: string;
|
||||||
|
readonly name: string;
|
||||||
|
readonly pullCount: number;
|
||||||
|
readonly starCount: number;
|
||||||
|
readonly user: string;
|
||||||
|
readonly manifestList?: DockerManifestList;
|
||||||
|
readonly tags?: Tag[];
|
||||||
|
readonly canEdit?: boolean;
|
||||||
|
readonly isAutomated?: boolean;
|
||||||
|
readonly isMigrated?: boolean;
|
||||||
|
readonly isPrivate?: boolean;
|
||||||
|
readonly namespace?: string;
|
||||||
|
readonly repositoryType?: string;
|
||||||
|
readonly status?: number;
|
||||||
|
}
|
||||||
|
export interface Tag {
|
||||||
|
creator: number;
|
||||||
|
fullSize: number;
|
||||||
|
id: number;
|
||||||
|
images: TagElement[];
|
||||||
|
lastUpdated: string;
|
||||||
|
lastUpdater: number;
|
||||||
|
lastUpdaterUsername: string;
|
||||||
|
name: string;
|
||||||
|
repository: number;
|
||||||
|
v2: boolean;
|
||||||
|
}
|
||||||
|
export interface TagElement {
|
||||||
|
architecture: Architecture;
|
||||||
|
digest: string;
|
||||||
|
features: string;
|
||||||
|
os: OS;
|
||||||
|
size: number;
|
||||||
|
}
|
3
node_modules/docker-hub-utils/dist/utils/constants.d.ts
generated
vendored
Normal file
3
node_modules/docker-hub-utils/dist/utils/constants.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export declare const DOCKER_CLOUD_URL = "https://cloud.docker.com/repository/docker/";
|
||||||
|
export declare const DOCKER_HUB_API_ROOT = "https://hub.docker.com/v2/";
|
||||||
|
export declare const DOCKER_HUB_API_AUTH_URL = "https://auth.docker.io/token";
|
3
node_modules/docker-hub-utils/dist/utils/log.d.ts
generated
vendored
Normal file
3
node_modules/docker-hub-utils/dist/utils/log.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import pino from 'pino';
|
||||||
|
declare const _default: pino.Logger;
|
||||||
|
export default _default;
|
114
node_modules/docker-hub-utils/package.json
generated
vendored
Normal file
114
node_modules/docker-hub-utils/package.json
generated
vendored
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
{
|
||||||
|
"_from": "docker-hub-utils",
|
||||||
|
"_id": "docker-hub-utils@1.10.29",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-wZ3BmcG3mq90rlXGfGcgqwgyTyO0kWQA5D+3J7T+nLgE1mzjggK1ZDB44krt5dj5lK/nXla3vGIw7nF7IE2kQQ==",
|
||||||
|
"_location": "/docker-hub-utils",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "tag",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "docker-hub-utils",
|
||||||
|
"name": "docker-hub-utils",
|
||||||
|
"escapedName": "docker-hub-utils",
|
||||||
|
"rawSpec": "",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "latest"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
|
"/"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/docker-hub-utils/-/docker-hub-utils-1.10.29.tgz",
|
||||||
|
"_shasum": "8e1f910e704c9a7706dba8fb2b3078d7fbbe7a6e",
|
||||||
|
"_spec": "docker-hub-utils",
|
||||||
|
"_where": "/home/dawidd6/github/dawidd6/action-debian-package",
|
||||||
|
"author": {
|
||||||
|
"name": "Jesse Stuart",
|
||||||
|
"email": "hi@jessestuart.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jessestuart/docker-hub-utils/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "0.19.2",
|
||||||
|
"camelcase-keys": "6.2.1",
|
||||||
|
"luxon": "1.22.2",
|
||||||
|
"pino": "5.17.0",
|
||||||
|
"ramda": "0.27.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Typescript / Node utilities for interacting with the Docker Hub API.",
|
||||||
|
"devDependencies": {
|
||||||
|
"@semantic-release/git": "9.0.0",
|
||||||
|
"@types/jest": "25.1.4",
|
||||||
|
"@types/luxon": "1.22.0",
|
||||||
|
"@types/node": "13.9.4",
|
||||||
|
"@types/pino": "5.17.0",
|
||||||
|
"@types/ramda": "0.27.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "2.25.0",
|
||||||
|
"@typescript-eslint/parser": "2.25.0",
|
||||||
|
"codecov": "3.6.5",
|
||||||
|
"concurrently": "5.1.0",
|
||||||
|
"eslint": "6.8.0",
|
||||||
|
"eslint-config-prettier": "6.10.1",
|
||||||
|
"eslint-plugin-import": "2.20.1",
|
||||||
|
"eslint-plugin-prettier": "3.1.2",
|
||||||
|
"husky": "4.2.3",
|
||||||
|
"jest": "25.1.0",
|
||||||
|
"jest-junit": "10.0.0",
|
||||||
|
"nodemon": "2.0.2",
|
||||||
|
"prettier": "1.19.1",
|
||||||
|
"pretty-quick": "2.0.1",
|
||||||
|
"semantic-release": "17.0.4",
|
||||||
|
"source-map-support": "0.5.16",
|
||||||
|
"ts-jest": "25.2.1",
|
||||||
|
"tsdx": "0.13.0",
|
||||||
|
"tslib": "1.11.1",
|
||||||
|
"tslint": "6.1.0",
|
||||||
|
"tslint-config-prettier": "1.18.0",
|
||||||
|
"typedoc": "0.17.3",
|
||||||
|
"typescript": "3.8.3"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jessestuart/docker-hub-utils",
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "pretty-quick --staged"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"api",
|
||||||
|
"docker",
|
||||||
|
"docker-hub",
|
||||||
|
"typescript",
|
||||||
|
"utils",
|
||||||
|
"wrapper-api"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"module": "dist/docker-hub-utils.esm.js",
|
||||||
|
"name": "docker-hub-utils",
|
||||||
|
"peerDependencies": {},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jessestuart/docker-hub-utils.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsdx build",
|
||||||
|
"ci": "JEST_JUNIT_OUTPUT=reports/junit/js-test-results.xml jest --ci --runInBand --coverage --reporters=default --reporters=jest-junit",
|
||||||
|
"docs": "typedoc --mode modules --out public",
|
||||||
|
"lint": "eslint --quiet src/ --ext ts,tsx",
|
||||||
|
"prepublishOnly": "yarn build",
|
||||||
|
"push": "yarn build && yalc push",
|
||||||
|
"rebuild": "rm -rf dist/* && yarn build",
|
||||||
|
"release": "yarn rebuild && semantic-release",
|
||||||
|
"start": "tsdx watch",
|
||||||
|
"test": "yarn jest --cache --coverage"
|
||||||
|
},
|
||||||
|
"typings": "dist/index.d.ts",
|
||||||
|
"version": "1.10.29"
|
||||||
|
}
|
9
node_modules/fast-redact/.travis.yml
generated
vendored
Normal file
9
node_modules/fast-redact/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
language: node_js
|
||||||
|
sudo: false
|
||||||
|
node_js:
|
||||||
|
- 6
|
||||||
|
- 8
|
||||||
|
- 10
|
||||||
|
- 11
|
||||||
|
script:
|
||||||
|
- npm run ci
|
21
node_modules/fast-redact/LICENSE
generated
vendored
Normal file
21
node_modules/fast-redact/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2019-2020 David Mark Clements
|
||||||
|
|
||||||
|
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.
|
148
node_modules/fast-redact/benchmark/index.js
generated
vendored
Normal file
148
node_modules/fast-redact/benchmark/index.js
generated
vendored
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
'use strict'
|
||||||
|
const bench = require('fastbench')
|
||||||
|
const noir = require('pino-noir')(['a.b.c'])
|
||||||
|
const fastRedact = require('..')
|
||||||
|
const redactNoSerialize = fastRedact({ paths: ['a.b.c'], serialize: false })
|
||||||
|
const redactWildNoSerialize = fastRedact({ paths: ['a.b.*'], serialize: false })
|
||||||
|
const redactIntermediateWildNoSerialize = fastRedact({ paths: ['a.*.c'], serialize: false })
|
||||||
|
const redact = fastRedact({ paths: ['a.b.c'] })
|
||||||
|
const noirWild = require('pino-noir')(['a.b.*'])
|
||||||
|
const redactWild = fastRedact({ paths: ['a.b.*'] })
|
||||||
|
const redactIntermediateWild = fastRedact({ paths: ['a.*.c'] })
|
||||||
|
const redactIntermediateWildMatchWildOutcome = fastRedact({ paths: ['a.*.c', 'a.*.b', 'a.*.a'] })
|
||||||
|
const redactStaticMatchWildOutcome = fastRedact({ paths: ['a.b.c', 'a.d.a', 'a.d.b', 'a.d.c'] })
|
||||||
|
const noirCensorFunction = require('pino-noir')(['a.b.*'], (v) => v + '.')
|
||||||
|
const redactCensorFunction = fastRedact({ paths: ['a.b.*'], censor: (v) => v + '.', serialize: false })
|
||||||
|
|
||||||
|
const obj = {
|
||||||
|
a: {
|
||||||
|
b: {
|
||||||
|
c: 's'
|
||||||
|
},
|
||||||
|
d: {
|
||||||
|
a: 's',
|
||||||
|
b: 's',
|
||||||
|
c: 's'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const max = 500
|
||||||
|
|
||||||
|
var run = bench([
|
||||||
|
function benchNoirV2 (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
noir.a(obj.a)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedact (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactNoSerialize(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactRestore (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactNoSerialize(obj)
|
||||||
|
redactNoSerialize.restore(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchNoirV2Wild (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
noirWild.a(obj.a)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactWild (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactWildNoSerialize(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactWildRestore (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactWildNoSerialize(obj)
|
||||||
|
redactWildNoSerialize.restore(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactIntermediateWild (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactIntermediateWildNoSerialize(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactIntermediateWildRestore (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactIntermediateWildNoSerialize(obj)
|
||||||
|
redactIntermediateWildNoSerialize.restore(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchJSONStringify (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
JSON.stringify(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchNoirV2Serialize (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
noir.a(obj.a)
|
||||||
|
JSON.stringify(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactSerialize (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redact(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchNoirV2WildSerialize (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
noirWild.a(obj.a)
|
||||||
|
JSON.stringify(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactWildSerialize (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactWild(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactIntermediateWildSerialize (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactIntermediateWild(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactIntermediateWildMatchWildOutcomeSerialize (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactIntermediateWildMatchWildOutcome(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactStaticMatchWildOutcomeSerialize (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactStaticMatchWildOutcome(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchNoirV2CensorFunction (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
noirCensorFunction.a(obj.a)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
},
|
||||||
|
function benchFastRedactCensorFunction (cb) {
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
redactCensorFunction(obj)
|
||||||
|
}
|
||||||
|
setImmediate(cb)
|
||||||
|
}
|
||||||
|
], 500)
|
||||||
|
|
||||||
|
run(run)
|
14
node_modules/fast-redact/example/default-usage.js
generated
vendored
Normal file
14
node_modules/fast-redact/example/default-usage.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
'use strict'
|
||||||
|
const fastRedact = require('..')
|
||||||
|
const fauxRequest = {
|
||||||
|
headers: {
|
||||||
|
host: 'http://example.com',
|
||||||
|
cookie: `oh oh we don't want this exposed in logs in etc.`,
|
||||||
|
referer: `if we're cool maybe we'll even redact this`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const redact = fastRedact({
|
||||||
|
paths: ['headers.cookie', 'headers.referer']
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(redact(fauxRequest))
|
11
node_modules/fast-redact/example/intermediate-wildcard-array.js
generated
vendored
Normal file
11
node_modules/fast-redact/example/intermediate-wildcard-array.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict'
|
||||||
|
const fastRedact = require('..')
|
||||||
|
const redact = fastRedact({ paths: ['a[*].c.d'] })
|
||||||
|
const obj = {
|
||||||
|
a: [
|
||||||
|
{ c: { d: 'hide me', e: 'leave me be' } },
|
||||||
|
{ c: { d: 'and me', f: 'I want to live' } },
|
||||||
|
{ c: { d: 'and also I', g: 'I want to run in a stream' } }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
console.log(redact(obj))
|
11
node_modules/fast-redact/example/serialize-false.js
generated
vendored
Normal file
11
node_modules/fast-redact/example/serialize-false.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict'
|
||||||
|
const fastRedact = require('..')
|
||||||
|
const redact = fastRedact({
|
||||||
|
paths: ['a'],
|
||||||
|
serialize: false
|
||||||
|
})
|
||||||
|
const o = { a: 1, b: 2 }
|
||||||
|
console.log(redact(o) === o)
|
||||||
|
console.log(o)
|
||||||
|
console.log(redact.restore(o) === o)
|
||||||
|
console.log(o)
|
4
node_modules/fast-redact/example/serialize-function.js
generated
vendored
Normal file
4
node_modules/fast-redact/example/serialize-function.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
'use strict'
|
||||||
|
const fastRedact = require('..')
|
||||||
|
const redact = fastRedact({ paths: ['a'], serialize: (o) => JSON.stringify(o, 0, 2) })
|
||||||
|
console.log(redact({ a: 1, b: 2 }))
|
9
node_modules/fast-redact/example/top-wildcard-object.js
generated
vendored
Normal file
9
node_modules/fast-redact/example/top-wildcard-object.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
'use strict'
|
||||||
|
const fastRedact = require('..')
|
||||||
|
const redact = fastRedact({ paths: ['*.c.d'] })
|
||||||
|
const obj = {
|
||||||
|
x: { c: { d: 'hide me', e: 'leave me be' } },
|
||||||
|
y: { c: { d: 'and me', f: 'I want to live' } },
|
||||||
|
z: { c: { d: 'and also I', g: 'I want to run in a stream' } }
|
||||||
|
}
|
||||||
|
console.log(redact(obj))
|
55
node_modules/fast-redact/index.js
generated
vendored
Normal file
55
node_modules/fast-redact/index.js
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const validator = require('./lib/validator')
|
||||||
|
const parse = require('./lib/parse')
|
||||||
|
const redactor = require('./lib/redactor')
|
||||||
|
const restorer = require('./lib/restorer')
|
||||||
|
const { groupRedact, nestedRedact } = require('./lib/modifiers')
|
||||||
|
const state = require('./lib/state')
|
||||||
|
const rx = require('./lib/rx')
|
||||||
|
const validate = validator()
|
||||||
|
const noop = (o) => o
|
||||||
|
noop.restore = noop
|
||||||
|
|
||||||
|
const DEFAULT_CENSOR = '[REDACTED]'
|
||||||
|
fastRedact.rx = rx
|
||||||
|
fastRedact.validator = validator
|
||||||
|
|
||||||
|
module.exports = fastRedact
|
||||||
|
|
||||||
|
function fastRedact (opts = {}) {
|
||||||
|
const paths = Array.from(new Set(opts.paths || []))
|
||||||
|
const serialize = 'serialize' in opts ? (
|
||||||
|
opts.serialize === false ? opts.serialize
|
||||||
|
: (typeof opts.serialize === 'function' ? opts.serialize : JSON.stringify)
|
||||||
|
) : JSON.stringify
|
||||||
|
const remove = opts.remove
|
||||||
|
if (remove === true && serialize !== JSON.stringify) {
|
||||||
|
throw Error('fast-redact – remove option may only be set when serializer is JSON.stringify')
|
||||||
|
}
|
||||||
|
const censor = remove === true
|
||||||
|
? undefined
|
||||||
|
: 'censor' in opts ? opts.censor : DEFAULT_CENSOR
|
||||||
|
|
||||||
|
const isCensorFct = typeof censor === 'function'
|
||||||
|
|
||||||
|
if (paths.length === 0) return serialize || noop
|
||||||
|
|
||||||
|
validate({ paths, serialize, censor })
|
||||||
|
|
||||||
|
const { wildcards, wcLen, secret } = parse({ paths, censor })
|
||||||
|
|
||||||
|
const compileRestore = restorer({ secret, wcLen })
|
||||||
|
const strict = 'strict' in opts ? opts.strict : true
|
||||||
|
|
||||||
|
return redactor({ secret, wcLen, serialize, strict, isCensorFct }, state({
|
||||||
|
secret,
|
||||||
|
censor,
|
||||||
|
compileRestore,
|
||||||
|
serialize,
|
||||||
|
groupRedact,
|
||||||
|
nestedRedact,
|
||||||
|
wildcards,
|
||||||
|
wcLen
|
||||||
|
}))
|
||||||
|
}
|
96
node_modules/fast-redact/lib/modifiers.js
generated
vendored
Normal file
96
node_modules/fast-redact/lib/modifiers.js
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
groupRedact,
|
||||||
|
groupRestore,
|
||||||
|
nestedRedact,
|
||||||
|
nestedRestore
|
||||||
|
}
|
||||||
|
|
||||||
|
function groupRestore ({ keys, values, target }) {
|
||||||
|
if (target == null) return
|
||||||
|
const length = keys.length
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
const k = keys[i]
|
||||||
|
target[k] = values[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function groupRedact (o, path, censor, isCensorFct) {
|
||||||
|
const target = get(o, path)
|
||||||
|
if (target == null) return { keys: null, values: null, target: null, flat: true }
|
||||||
|
const keys = Object.keys(target)
|
||||||
|
const length = keys.length
|
||||||
|
const values = new Array(length)
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
const k = keys[i]
|
||||||
|
values[i] = target[k]
|
||||||
|
target[k] = isCensorFct ? censor(target[k]) : censor
|
||||||
|
}
|
||||||
|
return { keys, values, target, flat: true }
|
||||||
|
}
|
||||||
|
|
||||||
|
function nestedRestore (arr) {
|
||||||
|
const length = arr.length
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
const { key, target, value } = arr[i]
|
||||||
|
target[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nestedRedact (store, o, path, ns, censor, isCensorFct) {
|
||||||
|
const target = get(o, path)
|
||||||
|
if (target == null) return
|
||||||
|
const keys = Object.keys(target)
|
||||||
|
const length = keys.length
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
|
const key = keys[i]
|
||||||
|
const { value, parent, exists } = specialSet(target, key, ns, censor, isCensorFct)
|
||||||
|
|
||||||
|
if (exists === true && parent !== null) {
|
||||||
|
store.push({ key: ns[ns.length - 1], target: parent, value })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return store
|
||||||
|
}
|
||||||
|
|
||||||
|
function has (obj, prop) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(obj, prop)
|
||||||
|
}
|
||||||
|
|
||||||
|
function specialSet (o, k, p, v, f) {
|
||||||
|
var i = -1
|
||||||
|
var l = p.length
|
||||||
|
var li = l - 1
|
||||||
|
var n
|
||||||
|
var nv
|
||||||
|
var ov
|
||||||
|
var oov = null
|
||||||
|
var exists = true
|
||||||
|
ov = n = o[k]
|
||||||
|
if (typeof n !== 'object') return { value: null, parent: null, exists }
|
||||||
|
while (n != null && ++i < l) {
|
||||||
|
k = p[i]
|
||||||
|
oov = ov
|
||||||
|
if (!(k in n)) {
|
||||||
|
exists = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
ov = n[k]
|
||||||
|
nv = f ? v(ov) : v
|
||||||
|
nv = (i !== li) ? ov : nv
|
||||||
|
n[k] = (has(n, k) && nv === ov) || (nv === undefined && v !== undefined) ? n[k] : nv
|
||||||
|
n = n[k]
|
||||||
|
if (typeof n !== 'object') break
|
||||||
|
}
|
||||||
|
return { value: ov, parent: oov, exists }
|
||||||
|
}
|
||||||
|
function get (o, p) {
|
||||||
|
var i = -1
|
||||||
|
var l = p.length
|
||||||
|
var n = o
|
||||||
|
while (n != null && ++i < l) {
|
||||||
|
n = n[p[i]]
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue