Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
0d594dbe6b | |||
9a9523cc13 | |||
a8e6462f55 | |||
5dfc650f2c |
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,6 +1,22 @@
|
|||||||
.nogit/
|
.nogit/
|
||||||
node_modules/
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
.yarn/
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_web/
|
||||||
|
dist_serve/
|
||||||
|
dist_ts_web/
|
||||||
|
|
||||||
|
# custom
|
@ -1,4 +1,4 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
@ -78,19 +78,11 @@ release:
|
|||||||
# ====================
|
# ====================
|
||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
image: docker:stable
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
script:
|
script:
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- npmci command npm install -g tslint typescript
|
||||||
- docker run
|
- npmci npm install
|
||||||
--env SOURCE_CODE="$PWD"
|
- npmci command tslint -c tslint.json ./ts/**/*.ts
|
||||||
--volume "$PWD":/code
|
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
|
||||||
artifacts:
|
|
||||||
paths: [codeclimate.json]
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- priv
|
- priv
|
||||||
@ -109,10 +101,10 @@ pages:
|
|||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g typedoc typescript
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
- npmci command tsdoc
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
@ -2,5 +2,15 @@
|
|||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "webrequest",
|
||||||
|
"shortDescription": "securely request from browsers",
|
||||||
|
"npmPackagename": "@pushrocks/webrequest",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
170
package-lock.json
generated
170
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/webrequest",
|
"name": "@pushrocks/webrequest",
|
||||||
"version": "1.0.7",
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -14,6 +14,26 @@
|
|||||||
"nan": "^2.9.2"
|
"nan": "^2.9.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@babel/code-frame": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/highlight": "^7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@babel/highlight": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"esutils": "^2.0.2",
|
||||||
|
"js-tokens": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@gitzone/tsbuild": {
|
"@gitzone/tsbuild": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@gitzone/tsbuild/-/tsbuild-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@gitzone/tsbuild/-/tsbuild-2.1.3.tgz",
|
||||||
@ -430,10 +450,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ansi-styles": {
|
"ansi-styles": {
|
||||||
"version": "2.2.1",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"color-convert": "^1.9.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"argparse": {
|
"argparse": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
@ -468,32 +491,6 @@
|
|||||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
|
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"babel-code-frame": {
|
|
||||||
"version": "6.26.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
|
|
||||||
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"chalk": "^1.1.3",
|
|
||||||
"esutils": "^2.0.2",
|
|
||||||
"js-tokens": "^3.0.2"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"chalk": {
|
|
||||||
"version": "1.1.3",
|
|
||||||
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
|
||||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"ansi-styles": "^2.2.1",
|
|
||||||
"escape-string-regexp": "^1.0.2",
|
|
||||||
"has-ansi": "^2.0.0",
|
|
||||||
"strip-ansi": "^3.0.0",
|
|
||||||
"supports-color": "^2.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
@ -542,7 +539,7 @@
|
|||||||
},
|
},
|
||||||
"builtin-modules": {
|
"builtin-modules": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@ -594,34 +591,14 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"chalk": {
|
"chalk": {
|
||||||
"version": "2.4.1",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/chalk/-/chalk-2.4.2.tgz",
|
||||||
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
|
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-styles": "^3.2.1",
|
"ansi-styles": "^3.2.1",
|
||||||
"escape-string-regexp": "^1.0.5",
|
"escape-string-regexp": "^1.0.5",
|
||||||
"supports-color": "^5.3.0"
|
"supports-color": "^5.3.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-styles": {
|
|
||||||
"version": "3.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
|
||||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"color-convert": "^1.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"supports-color": {
|
|
||||||
"version": "5.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
|
||||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"has-flag": "^3.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"check-error": {
|
"check-error": {
|
||||||
@ -695,7 +672,7 @@
|
|||||||
},
|
},
|
||||||
"color-convert": {
|
"color-convert": {
|
||||||
"version": "1.9.3",
|
"version": "1.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
"resolved": "https://verdaccio.lossless.one/color-convert/-/color-convert-1.9.3.tgz",
|
||||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -704,7 +681,7 @@
|
|||||||
},
|
},
|
||||||
"color-name": {
|
"color-name": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
"resolved": "https://verdaccio.lossless.one/color-name/-/color-name-1.1.3.tgz",
|
||||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@ -718,9 +695,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "2.19.0",
|
"version": "2.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/commander/-/commander-2.20.0.tgz",
|
||||||
"integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
|
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
@ -925,7 +902,7 @@
|
|||||||
},
|
},
|
||||||
"esutils": {
|
"esutils": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
|
"resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.2.tgz",
|
||||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@ -1166,18 +1143,9 @@
|
|||||||
"function-bind": "^1.1.1"
|
"function-bind": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"has-ansi": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"has-flag": {
|
"has-flag": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/has-flag/-/has-flag-3.0.0.tgz",
|
||||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@ -1367,9 +1335,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"js-tokens": {
|
"js-tokens": {
|
||||||
"version": "3.0.2",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
"resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
|
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"js-yaml": {
|
"js-yaml": {
|
||||||
@ -1793,7 +1761,7 @@
|
|||||||
},
|
},
|
||||||
"path-parse": {
|
"path-parse": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
"resolved": "https://verdaccio.lossless.one/path-parse/-/path-parse-1.0.6.tgz",
|
||||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@ -1913,12 +1881,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.8.1",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.11.1.tgz",
|
||||||
"integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==",
|
"integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"path-parse": "^1.0.5"
|
"path-parse": "^1.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rxjs": {
|
"rxjs": {
|
||||||
@ -2163,10 +2131,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"supports-color": {
|
"supports-color": {
|
||||||
"version": "2.0.0",
|
"version": "5.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/supports-color/-/supports-color-5.5.0.tgz",
|
||||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
|
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has-flag": "^3.0.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"symbol-tree": {
|
"symbol-tree": {
|
||||||
"version": "3.2.2",
|
"version": "3.2.2",
|
||||||
@ -2197,34 +2168,47 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tslint": {
|
"tslint": {
|
||||||
"version": "5.11.0",
|
"version": "5.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.17.0.tgz",
|
||||||
"integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=",
|
"integrity": "sha512-pflx87WfVoYepTet3xLfDOLDm9Jqi61UXIKePOuca0qoAZyrGWonDG9VTbji58Fy+8gciUn8Bt7y69+KEVjc/w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"babel-code-frame": "^6.22.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
"builtin-modules": "^1.1.1",
|
"builtin-modules": "^1.1.1",
|
||||||
"chalk": "^2.3.0",
|
"chalk": "^2.3.0",
|
||||||
"commander": "^2.12.1",
|
"commander": "^2.12.1",
|
||||||
"diff": "^3.2.0",
|
"diff": "^3.2.0",
|
||||||
"glob": "^7.1.1",
|
"glob": "^7.1.1",
|
||||||
"js-yaml": "^3.7.0",
|
"js-yaml": "^3.13.1",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
"resolve": "^1.3.2",
|
"resolve": "^1.3.2",
|
||||||
"semver": "^5.3.0",
|
"semver": "^5.3.0",
|
||||||
"tslib": "^1.8.0",
|
"tslib": "^1.8.0",
|
||||||
"tsutils": "^2.27.2"
|
"tsutils": "^2.29.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"js-yaml": {
|
||||||
|
"version": "3.13.1",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-3.13.1.tgz",
|
||||||
|
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"argparse": "^1.0.7",
|
||||||
|
"esprima": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tslint-config-prettier": {
|
"tslint-config-prettier": {
|
||||||
"version": "1.17.0",
|
"version": "1.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.17.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz",
|
||||||
"integrity": "sha512-NKWNkThwqE4Snn4Cm6SZB7lV5RMDDFsBwz6fWUkTxOKGjMx8ycOHnjIbhn7dZd5XmssW3CwqUjlANR6EhP9YQw==",
|
"integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tsutils": {
|
"tsutils": {
|
||||||
"version": "2.29.0",
|
"version": "2.29.0",
|
||||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/tsutils/-/tsutils-2.29.0.tgz",
|
||||||
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
|
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/webrequest",
|
"name": "@pushrocks/webrequest",
|
||||||
"version": "1.0.7",
|
"version": "2.0.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "securely request from browsers",
|
"description": "securely request from browsers",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -19,10 +19,20 @@
|
|||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"@types/node": "^10.12.12",
|
"@types/node": "^10.12.12",
|
||||||
"node-fetch": "^2.3.0",
|
"node-fetch": "^2.3.0",
|
||||||
"tslint": "^5.11.0",
|
"tslint": "^5.17.0",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.2"
|
"@pushrocks/smartdelay": "^2.0.2"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/*",
|
||||||
|
"ts_web/*",
|
||||||
|
"dist/*",
|
||||||
|
"dist_web/*",
|
||||||
|
"assets/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
26
readme.md
Normal file
26
readme.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# @pushrocks/webrequest
|
||||||
|
securely request from browsers
|
||||||
|
|
||||||
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/webrequest)
|
||||||
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/webrequest)
|
||||||
|
* [github.com (source mirror)](https://github.com/pushrocks/webrequest)
|
||||||
|
* [docs (typedoc)](https://pushrocks.gitlab.io/webrequest/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://gitlab.com/pushrocks/webrequest/commits/master)
|
||||||
|
[](https://gitlab.com/pushrocks/webrequest/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/@pushrocks/webrequest)
|
||||||
|
[](https://snyk.io/test/npm/@pushrocks/webrequest)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://prettier.io/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
44
test/test.ts
44
test/test.ts
@ -11,7 +11,6 @@ declare global {
|
|||||||
}
|
}
|
||||||
global.fetch = fetch;
|
global.fetch = fetch;
|
||||||
|
|
||||||
|
|
||||||
// test dependencies
|
// test dependencies
|
||||||
import * as smartexpress from '@pushrocks/smartexpress';
|
import * as smartexpress from '@pushrocks/smartexpress';
|
||||||
|
|
||||||
@ -24,43 +23,52 @@ tap.test('setup test server', async () => {
|
|||||||
port: 2345
|
port: 2345
|
||||||
});
|
});
|
||||||
|
|
||||||
testServer.addRoute('/apiroute1', new smartexpress.Handler("GET", (req, res) => {
|
testServer.addRoute(
|
||||||
|
'/apiroute1',
|
||||||
|
new smartexpress.Handler('GET', (req, res) => {
|
||||||
res.status(429);
|
res.status(429);
|
||||||
res.end();
|
res.end();
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
testServer.addRoute('/apiroute2', new smartexpress.Handler("GET", (req, res) => {
|
testServer.addRoute(
|
||||||
|
'/apiroute2',
|
||||||
|
new smartexpress.Handler('GET', (req, res) => {
|
||||||
res.status(500);
|
res.status(500);
|
||||||
res.end();
|
res.end();
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
testServer.addRoute('/apiroute3', new smartexpress.Handler("GET", (req, res) => {
|
testServer.addRoute(
|
||||||
|
'/apiroute3',
|
||||||
|
new smartexpress.Handler('GET', (req, res) => {
|
||||||
res.status(200);
|
res.status(200);
|
||||||
res.send({
|
res.send({
|
||||||
hithere: 'hi'
|
hithere: 'hi'
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
await testServer.start()
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
|
||||||
tap.test('first test', async (tools) => {
|
await testServer.start();
|
||||||
const response = await (new webrequest.WebRequest()).request([
|
});
|
||||||
|
|
||||||
|
tap.test('first test', async tools => {
|
||||||
|
const response = await new webrequest.WebRequest().getJson([
|
||||||
'http://localhost:2345/apiroute1',
|
'http://localhost:2345/apiroute1',
|
||||||
'http://localhost:2345/apiroute2',
|
'http://localhost:2345/apiroute2',
|
||||||
'http://localhost:2345/apiroute4',
|
'http://localhost:2345/apiroute4',
|
||||||
'http://localhost:2345/apiroute3'
|
'http://localhost:2345/apiroute3'
|
||||||
], {
|
]);
|
||||||
method: 'GET'
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
||||||
expect(response).property('hithere').to.equal('hi');
|
expect(response)
|
||||||
})
|
.property('hithere')
|
||||||
|
.to.equal('hi');
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('tear down server', async () => {
|
tap.test('tear down server', async () => {
|
||||||
testServer.stop();
|
testServer.stop();
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.start()
|
tap.start();
|
||||||
|
56
ts/index.ts
56
ts/index.ts
@ -4,20 +4,46 @@ import * as plugins from './webrequest.plugins';
|
|||||||
* web request
|
* web request
|
||||||
*/
|
*/
|
||||||
export class WebRequest {
|
export class WebRequest {
|
||||||
/**
|
public async getJson(urlArg: string | string[], requestBody?: any) {
|
||||||
* gets json
|
const response: Response = await this.request(urlArg, {
|
||||||
*/
|
body: requestBody,
|
||||||
async getJson(url: string | string[]) {}
|
method: 'GET'
|
||||||
|
});
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* postJson
|
* postJson
|
||||||
*/
|
*/
|
||||||
postJson() {}
|
public async postJson(urlArg: string, requestBody?: any) {
|
||||||
|
const response: Response = await this.request(urlArg, {
|
||||||
|
body: requestBody,
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* put js
|
* put js
|
||||||
*/
|
*/
|
||||||
putJson() {}
|
public async putJson(urlArg: string, requestBody?: any) {
|
||||||
|
const response: Response = await this.request(urlArg, {
|
||||||
|
body: requestBody,
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* put js
|
||||||
|
*/
|
||||||
|
public async deleteJson(urlArg: string, requestBody?: any) {
|
||||||
|
const response: Response = await this.request(urlArg, {
|
||||||
|
body: requestBody,
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -28,7 +54,7 @@ export class WebRequest {
|
|||||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
||||||
body?: any;
|
body?: any;
|
||||||
}
|
}
|
||||||
) {
|
): Promise<Response> {
|
||||||
let allUrls: string[];
|
let allUrls: string[];
|
||||||
let usedUrlIndex = 0;
|
let usedUrlIndex = 0;
|
||||||
|
|
||||||
@ -41,22 +67,21 @@ export class WebRequest {
|
|||||||
|
|
||||||
const requestHistory: string[] = []; // keep track of the request history
|
const requestHistory: string[] = []; // keep track of the request history
|
||||||
|
|
||||||
const doHistoryCheck = async ( // check history for a
|
const doHistoryCheck = async (
|
||||||
|
// check history for a
|
||||||
historyEntryTypeArg: string
|
historyEntryTypeArg: string
|
||||||
) => {
|
) => {
|
||||||
requestHistory.push(historyEntryTypeArg);
|
requestHistory.push(historyEntryTypeArg);
|
||||||
if (historyEntryTypeArg === '429') {
|
if (historyEntryTypeArg === '429') {
|
||||||
console.log('got 429, so waiting a little bit.')
|
console.log('got 429, so waiting a little bit.');
|
||||||
await plugins.smartdelay.delayFor(
|
await plugins.smartdelay.delayFor(Math.floor(Math.random() * (2000 - 1000 + 1)) + 1000); // wait between 1 and 10 seconds
|
||||||
Math.floor(Math.random() * (2000 - 1000 +1)) + 1000
|
|
||||||
); // wait between 1 and 10 seconds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let numOfHistoryType = 0;
|
let numOfHistoryType = 0;
|
||||||
for (const entry of requestHistory) {
|
for (const entry of requestHistory) {
|
||||||
if (entry === historyEntryTypeArg) numOfHistoryType++;
|
if (entry === historyEntryTypeArg) numOfHistoryType++;
|
||||||
}
|
}
|
||||||
if (numOfHistoryType > (2 * allUrls.length * usedUrlIndex)) {
|
if (numOfHistoryType > 2 * allUrls.length * usedUrlIndex) {
|
||||||
usedUrlIndex++;
|
usedUrlIndex++;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -80,12 +105,13 @@ export class WebRequest {
|
|||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
await doHistoryCheck(response.status.toString());
|
await doHistoryCheck(response.status.toString());
|
||||||
|
// tslint:disable-next-line: no-return-await
|
||||||
return await doRequest(allUrls[usedUrlIndex]);
|
return await doRequest(allUrls[usedUrlIndex]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const finalResponse: Response = await doRequest(urlArg[usedUrlIndex]);
|
const finalResponse: Response = await doRequest(urlArg[usedUrlIndex]);
|
||||||
console.log(finalResponse)
|
console.log(finalResponse);
|
||||||
return JSON.parse(await finalResponse.text());
|
return finalResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
|
|
||||||
export {
|
export { smartdelay };
|
||||||
smartdelay
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user