Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
5ff76b5c9f | |||
76733cc96a | |||
c8f27a1935 | |||
3b7378386f | |||
4164458d80 | |||
9af837124a | |||
4685856ade | |||
a46af3a431 | |||
ac65f4c85f | |||
d845e19934 |
@ -13,31 +13,24 @@ stages:
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- npm install -g @shipzone/npmci
|
||||
- pnpm install -g pnpm
|
||||
- pnpm install -g @shipzone/npmci
|
||||
- npmci npm prepare
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --prod
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
@ -45,11 +38,10 @@ auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
- npmci command pnpm audit --audit-level=high --dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
@ -60,7 +52,6 @@ auditDevDependencies:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
@ -71,10 +62,9 @@ testStable:
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
- npmci npm build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
@ -100,10 +90,9 @@ codequality:
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci command npm install -g typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
@ -123,11 +112,9 @@ trigger:
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
- npmci command npm run buildDocs
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
|
14558
package-lock.json
generated
14558
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/webrequest",
|
||||
"version": "3.0.14",
|
||||
"version": "3.0.19",
|
||||
"private": false,
|
||||
"description": "securely request from browsers",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -10,18 +10,20 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web --allowimplicitany && tsbundle npm)"
|
||||
"build": "(tsbuild --web --allowimplicitany && tsbundle npm)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.65",
|
||||
"@gitzone/tsbundle": "^2.0.7",
|
||||
"@gitzone/tsrun": "^1.2.39",
|
||||
"@gitzone/tstest": "^1.0.73",
|
||||
"@pushrocks/smartexpress": "^4.0.21",
|
||||
"@pushrocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^18.6.4"
|
||||
"@types/node": "^18.14.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@adobe/fetch": "^4.0.1",
|
||||
"@adobe/fetch": "^4.0.4",
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
"@pushrocks/smartenv": "^5.0.2",
|
||||
"@pushrocks/smartjson": "^5.0.1",
|
||||
|
125
pnpm-lock.yaml
generated
125
pnpm-lock.yaml
generated
@ -1,9 +1,10 @@
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@adobe/fetch': ^4.0.1
|
||||
'@adobe/fetch': ^4.0.4
|
||||
'@gitzone/tsbuild': ^2.1.65
|
||||
'@gitzone/tsbundle': ^2.0.7
|
||||
'@gitzone/tsrun': ^1.2.39
|
||||
'@gitzone/tstest': ^1.0.73
|
||||
'@pushrocks/smartdelay': ^2.0.13
|
||||
'@pushrocks/smartenv': ^5.0.2
|
||||
@ -12,10 +13,10 @@ specifiers:
|
||||
'@pushrocks/smartpromise': ^3.1.7
|
||||
'@pushrocks/tapbundle': ^5.0.4
|
||||
'@pushrocks/webstore': ^2.0.5
|
||||
'@types/node': ^18.6.4
|
||||
'@types/node': ^18.14.6
|
||||
|
||||
dependencies:
|
||||
'@adobe/fetch': 4.0.1
|
||||
'@adobe/fetch': 4.0.4
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
'@pushrocks/smartenv': 5.0.5
|
||||
'@pushrocks/smartjson': 5.0.5
|
||||
@ -25,34 +26,23 @@ dependencies:
|
||||
devDependencies:
|
||||
'@gitzone/tsbuild': 2.1.65
|
||||
'@gitzone/tsbundle': 2.0.7
|
||||
'@gitzone/tstest': 1.0.74_@types+node@18.13.0
|
||||
'@gitzone/tsrun': 1.2.39_@types+node@18.14.6
|
||||
'@gitzone/tstest': 1.0.74_@types+node@18.14.6
|
||||
'@pushrocks/smartexpress': 4.0.26
|
||||
'@pushrocks/tapbundle': 5.0.4
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
|
||||
packages:
|
||||
|
||||
/@adobe/fetch/4.0.1:
|
||||
resolution: {integrity: sha512-QJ7BuloMkwER3kpnfOF2fOaQjNkeGJ4BLU9HeYjru5sUQbPYR+U0ywwA/nfsmF3L6n9/DNYD1lUgMm9ubmHq1g==}
|
||||
/@adobe/fetch/4.0.4:
|
||||
resolution: {integrity: sha512-fu/KpXknlmt0niRp9qAPpuUU73F+TnGV4z/hCbEeedJUzrRqgUHPqaMbMJOD0Je1505rP46fYRDuILaFwGvRow==}
|
||||
engines: {node: '>=14.16'}
|
||||
dependencies:
|
||||
debug: 4.3.4
|
||||
http-cache-semantics: 4.1.1
|
||||
lru-cache: 7.14.1
|
||||
lru-cache: 7.17.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@adobe/helix-fetch/3.1.2:
|
||||
resolution: {integrity: sha512-09ImUUrHAyeJpDRBZbSPLI8cz1rVwmNmwWDpBsK+f+eiwzYGqcbN+P6pPyme3i+j1ONZSGL9SAuDXXg8fUTpYA==}
|
||||
engines: {node: '>=12.0'}
|
||||
dependencies:
|
||||
debug: 4.3.4
|
||||
http-cache-semantics: 4.1.0
|
||||
lru-cache: 7.13.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@apiglobal/typedrequest-interfaces/1.0.20:
|
||||
resolution: {integrity: sha512-ybsDtavYbzGJYSLodSbkxDvSLYtfMzBTuNZDJpiANt1rZA2MO/GCq8zk5MVLlrUUQIr/7oxPGWqxi1QDwR+RHQ==}
|
||||
@ -69,7 +59,7 @@ packages:
|
||||
'@pushrocks/lik': 6.0.2
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@pushrocks/webrequest': 3.0.13
|
||||
'@pushrocks/webrequest': 3.0.17
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@ -161,7 +151,7 @@ packages:
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@pushrocks/smartspawn': 3.0.2
|
||||
'@types/html-minifier': 4.0.2
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
esbuild: 0.14.54
|
||||
html-minifier: 4.0.0
|
||||
typescript: 4.9.5
|
||||
@ -169,13 +159,13 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@gitzone/tsrun/1.2.39_@types+node@18.13.0:
|
||||
/@gitzone/tsrun/1.2.39_@types+node@18.14.6:
|
||||
resolution: {integrity: sha512-gLqKOic3T1GIdqsp+T5g1OewfboMJKKMr7/SJgBuMx4BUEBfW7TYhqk6psgfewhHs/zKII5rWbbPauykkKlYIg==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@pushrocks/smartfile': 10.0.7
|
||||
'@pushrocks/smartshell': 2.0.30
|
||||
ts-node: 10.9.1_4bewfcp2iebiwuold25d6rgcsy
|
||||
ts-node: 10.9.1_alpjt73dvgv6kni625hu7f2l4m
|
||||
typescript: 4.9.5
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
@ -184,12 +174,12 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@gitzone/tstest/1.0.74_@types+node@18.13.0:
|
||||
/@gitzone/tstest/1.0.74_@types+node@18.14.6:
|
||||
resolution: {integrity: sha512-6V8bsfvpnODWqrkdooVqcOS1z5GA8dMDnLCOHnr/SUTeie3ox8KGpckwiZ+gTfz9WvzX6+KLVTZNYKGOaNbmMQ==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@gitzone/tsbundle': 2.0.7
|
||||
'@gitzone/tsrun': 1.2.39_@types+node@18.13.0
|
||||
'@gitzone/tsrun': 1.2.39_@types+node@18.14.6
|
||||
'@pushrocks/consolecolor': 2.0.1
|
||||
'@pushrocks/smartbrowser': 2.0.5
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
@ -712,7 +702,7 @@ packages:
|
||||
'@pushrocks/smartfeed': 1.0.11
|
||||
'@pushrocks/smartxml': 1.0.6
|
||||
'@pushrocks/smartyaml': 2.0.5
|
||||
'@pushrocks/webrequest': 3.0.13
|
||||
'@pushrocks/webrequest': 3.0.17
|
||||
'@tsclass/tsclass': 3.0.48
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@ -796,7 +786,7 @@ packages:
|
||||
'@pushrocks/lik': 6.0.2
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
croner: 5.5.1
|
||||
croner: 5.6.0
|
||||
dayjs: 1.11.7
|
||||
is-nan: 1.3.2
|
||||
pretty-ms: 8.0.0
|
||||
@ -853,10 +843,10 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/@pushrocks/webrequest/3.0.13:
|
||||
resolution: {integrity: sha512-HB5xjOv+BEkKWE7HkU7baI2RB6I76q4jY3fozQOLs0xWu2JLHXFWTpezYDocZzTkd/Ad7b54lxJD6O7ZxgMoFQ==}
|
||||
/@pushrocks/webrequest/3.0.17:
|
||||
resolution: {integrity: sha512-Y84rlL2sKFvmHHCuNBZtLxZv2BDGjrlUqcg0DY6hMNTUZYB0jb1kmHIl+EVxBEEqO/QgcZdbQB0am/PAP9OfOw==}
|
||||
dependencies:
|
||||
'@adobe/helix-fetch': 3.1.2
|
||||
'@adobe/fetch': 4.0.4
|
||||
'@pushrocks/smartdelay': 2.0.13
|
||||
'@pushrocks/smartenv': 5.0.5
|
||||
'@pushrocks/smartjson': 5.0.5
|
||||
@ -931,7 +921,7 @@ packages:
|
||||
/@types/accepts/1.3.5:
|
||||
resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/babel__code-frame/7.0.3:
|
||||
@ -942,7 +932,7 @@ packages:
|
||||
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
|
||||
dependencies:
|
||||
'@types/connect': 3.4.35
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/buffer-json/2.0.1:
|
||||
@ -961,14 +951,14 @@ packages:
|
||||
/@types/clean-css/4.2.6:
|
||||
resolution: {integrity: sha512-Ze1tf+LnGPmG6hBFMi0B4TEB0mhF7EiMM5oyjLDNPE9hxrPU0W+5+bHvO+eFPA+bt0iC1zkQMoU/iGdRVjcRbw==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
source-map: 0.6.1
|
||||
dev: true
|
||||
|
||||
/@types/co-body/6.1.0:
|
||||
resolution: {integrity: sha512-3e0q2jyDAnx/DSZi0z2H0yoZ2wt5yRDZ+P7ymcMObvq0ufWRT4tsajyO+Q1VwVWiv9PRR4W3YEjEzBjeZlhF+w==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
'@types/qs': 6.9.7
|
||||
dev: true
|
||||
|
||||
@ -981,7 +971,7 @@ packages:
|
||||
/@types/connect/3.4.35:
|
||||
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/content-disposition/0.5.5:
|
||||
@ -1002,13 +992,13 @@ packages:
|
||||
'@types/connect': 3.4.35
|
||||
'@types/express': 4.17.17
|
||||
'@types/keygrip': 1.0.2
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/cors/2.8.13:
|
||||
resolution: {integrity: sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/debounce/1.2.1:
|
||||
@ -1022,7 +1012,7 @@ packages:
|
||||
/@types/express-serve-static-core/4.17.33:
|
||||
resolution: {integrity: sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
'@types/qs': 6.9.7
|
||||
'@types/range-parser': 1.2.4
|
||||
dev: true
|
||||
@ -1046,27 +1036,27 @@ packages:
|
||||
/@types/finalhandler/1.2.0:
|
||||
resolution: {integrity: sha512-NgEZKOhxUSXkwNnWNaMXZaopQ5aFGPAYiEpEWIkQ6Dzc4iS0M1oQsvWne2t+ex9QZUAdTz/ZT4tOXJhWtP6mCw==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/from2/2.3.2:
|
||||
resolution: {integrity: sha512-s1pdctxW2+CA4FOxxTBRxC3RKQL9Br1a2s2LngP4jh1BI84JBL3mDXj87EwcckN9z/IXp8o3ySmvZveGEAAwqw==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/fs-extra/11.0.1:
|
||||
resolution: {integrity: sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==}
|
||||
dependencies:
|
||||
'@types/jsonfile': 6.1.1
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/glob/8.0.1:
|
||||
resolution: {integrity: sha512-8bVUjXZvJacUFkJXHdyZ9iH1Eaj5V7I8c4NdH5sQJsdXkqT4CA5Dhb4yb4VE/3asyx4L9ayZr1NIhTsWHczmMw==}
|
||||
dependencies:
|
||||
'@types/minimatch': 5.1.2
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/html-minifier/4.0.2:
|
||||
@ -1116,7 +1106,7 @@ packages:
|
||||
/@types/jsonfile/6.1.1:
|
||||
resolution: {integrity: sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/keygrip/1.0.2:
|
||||
@ -1139,7 +1129,7 @@ packages:
|
||||
'@types/http-errors': 2.0.1
|
||||
'@types/keygrip': 1.0.2
|
||||
'@types/koa-compose': 3.2.5
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/lodash.clonedeep/4.5.7:
|
||||
@ -1165,8 +1155,8 @@ packages:
|
||||
/@types/minimatch/5.1.2:
|
||||
resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==}
|
||||
|
||||
/@types/node/18.13.0:
|
||||
resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==}
|
||||
/@types/node/18.14.6:
|
||||
resolution: {integrity: sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==}
|
||||
dev: true
|
||||
|
||||
/@types/parse5/6.0.3:
|
||||
@ -1196,7 +1186,7 @@ packages:
|
||||
resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==}
|
||||
dependencies:
|
||||
'@types/mime': 3.0.1
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/shortid/0.0.29:
|
||||
@ -1226,7 +1216,7 @@ packages:
|
||||
/@types/through2/2.0.38:
|
||||
resolution: {integrity: sha512-YFu+nHmjxMurkH1BSzA0Z1WrKDAY8jUKPZctNQn7mc+/KKtp2XxnclHFXxdB1m7Iqnzb5aywgP8TMK283LezGQ==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/trusted-types/2.0.2:
|
||||
@ -1250,14 +1240,14 @@ packages:
|
||||
/@types/ws/7.4.7:
|
||||
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
|
||||
/@types/yauzl/2.10.0:
|
||||
resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
@ -1352,6 +1342,11 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/@xmldom/xmldom/0.8.6:
|
||||
resolution: {integrity: sha512-uRjjusqpoqfmRkTaNuLJ2VohVr67Q5YwDATW3VU7PfzTj6IRaihGrYI7zckGZjxQPBIp63nfvJbM+Yu5ICh0Bg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dev: true
|
||||
|
||||
/accepts/1.3.8:
|
||||
resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@ -1786,8 +1781,8 @@ packages:
|
||||
resolution: {integrity: sha512-aqVeeIPCf5/NZFlz4mN4MLEOs9xf4ODCmHQDs+577JFj8mK3RkKJz77h7+Rn94AijUqKdFNOUHM+v88d8p02UQ==}
|
||||
dev: true
|
||||
|
||||
/croner/5.5.1:
|
||||
resolution: {integrity: sha512-uaqPDAMt3bd3yTgB/Z+7UN1kk8fBcf3UF5tfy3a+FG18apb1bGe1xC64DrUQ9DSkHJ1t67sgQBBdd/LyoF/f2Q==}
|
||||
/croner/5.6.0:
|
||||
resolution: {integrity: sha512-sGIW6z0E9BUFhbYH91r6+b7nnsK9xhjYY2ByEpQE9CsZqC0PnYr5vP9WDVta61WjEd2iSfWW+iBNSR8A/vD4tQ==}
|
||||
engines: {node: '>=6.0'}
|
||||
|
||||
/cross-fetch/3.1.5:
|
||||
@ -1989,7 +1984,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/cors': 2.8.13
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.4.2
|
||||
@ -2009,7 +2004,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/cors': 2.8.13
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.4.2
|
||||
@ -2641,10 +2636,6 @@ packages:
|
||||
http-errors: 1.8.1
|
||||
dev: true
|
||||
|
||||
/http-cache-semantics/4.1.0:
|
||||
resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==}
|
||||
dev: true
|
||||
|
||||
/http-cache-semantics/4.1.1:
|
||||
resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==}
|
||||
|
||||
@ -3131,15 +3122,9 @@ packages:
|
||||
yallist: 4.0.0
|
||||
dev: true
|
||||
|
||||
/lru-cache/7.13.2:
|
||||
resolution: {integrity: sha512-VJL3nIpA79TodY/ctmZEfhASgqekbT574/c4j3jn4bKXbSCnTTCH/KltZyvL2GlV+tGSMtsWyem8DCX7qKTMBA==}
|
||||
/lru-cache/7.17.0:
|
||||
resolution: {integrity: sha512-zSxlVVwOabhVyTi6E8gYv2cr6bXK+8ifYz5/uyJb9feXX6NACVDwY4p5Ut3WC3Ivo/QhpARHU3iujx2xGAYHbQ==}
|
||||
engines: {node: '>=12'}
|
||||
dev: true
|
||||
|
||||
/lru-cache/7.14.1:
|
||||
resolution: {integrity: sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/make-dir/3.1.0:
|
||||
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
|
||||
@ -3474,6 +3459,8 @@ packages:
|
||||
resolution: {integrity: sha512-mXF9AIgnvq1DP/ZM2R28tAfxP2wKZHYa2DjV0R1KCwcqSzm5Iqh1XQq9rdfAt6dp2DuPP0VHZIaCALc2v1cL5A==}
|
||||
engines: {node: '>=14.18.0', npm: '>=6.14.15'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@xmldom/xmldom': 0.8.6
|
||||
dev: true
|
||||
bundledDependencies:
|
||||
- '@xmldom/xmldom'
|
||||
@ -4078,7 +4065,7 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/ts-node/10.9.1_4bewfcp2iebiwuold25d6rgcsy:
|
||||
/ts-node/10.9.1_alpjt73dvgv6kni625hu7f2l4m:
|
||||
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@ -4097,7 +4084,7 @@ packages:
|
||||
'@tsconfig/node12': 1.0.11
|
||||
'@tsconfig/node14': 1.0.3
|
||||
'@tsconfig/node16': 1.0.3
|
||||
'@types/node': 18.13.0
|
||||
'@types/node': 18.14.6
|
||||
acorn: 8.8.2
|
||||
acorn-walk: 8.2.0
|
||||
arg: 4.1.3
|
||||
|
@ -21,7 +21,6 @@ Code Style | [](htt
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
@ -33,7 +32,6 @@ We are always happy for code contributions. If you are not the code contributing
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
@ -2,10 +2,9 @@ import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as webrequest from '../ts/index.js';
|
||||
|
||||
tap.test('should run multiendpoint request', async (tools) => {
|
||||
const response = await new webrequest.WebRequest()
|
||||
.request('https://api.signup.software', {
|
||||
method: 'GET',
|
||||
})
|
||||
const response = await new webrequest.WebRequest().request('https://api.signup.software', {
|
||||
method: 'GET',
|
||||
});
|
||||
console.log(JSON.stringify(await response.text()));
|
||||
});
|
||||
|
||||
|
23
test/test.ts
23
test/test.ts
@ -43,14 +43,19 @@ tap.test('setup test server', async () => {
|
||||
});
|
||||
|
||||
tap.test('first test', async (tools) => {
|
||||
const response = await (await new webrequest.WebRequest().requestMultiEndpoint([
|
||||
'http://localhost:2345/apiroute1',
|
||||
'http://localhost:2345/apiroute2',
|
||||
'http://localhost:2345/apiroute4',
|
||||
'http://localhost:2345/apiroute3',
|
||||
], {
|
||||
method: 'GET'
|
||||
})).json();
|
||||
const response = await (
|
||||
await new webrequest.WebRequest().requestMultiEndpoint(
|
||||
[
|
||||
'http://localhost:2345/apiroute1',
|
||||
'http://localhost:2345/apiroute2',
|
||||
'http://localhost:2345/apiroute4',
|
||||
'http://localhost:2345/apiroute3',
|
||||
],
|
||||
{
|
||||
method: 'GET',
|
||||
}
|
||||
)
|
||||
).json();
|
||||
|
||||
const response2 = await new webrequest.WebRequest().getJson('http://localhost:2345/apiroute3');
|
||||
|
||||
@ -68,6 +73,6 @@ tap.test('should cache response', async () => {
|
||||
await testServer.stop();
|
||||
const response2 = await webrequestInstance.getJson('http://localhost:2345/apiroute3', true);
|
||||
expect(response2).toHaveProperty('hithere');
|
||||
})
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/webrequest',
|
||||
version: '3.0.14',
|
||||
version: '3.0.19',
|
||||
description: 'securely request from browsers'
|
||||
}
|
||||
|
56
ts/index.ts
56
ts/index.ts
@ -10,10 +10,10 @@ export interface IWebrequestContructorOptions {
|
||||
export class WebRequest {
|
||||
private static polyfillStatusEvaluated = false;
|
||||
private static neededPolyfillsLoadedDeferred = plugins.smartpromise.defer<{
|
||||
fetch: typeof fetch,
|
||||
Response: typeof Response,
|
||||
AbortController?: typeof AbortController,
|
||||
helixTimeout?: any,
|
||||
fetch: typeof fetch;
|
||||
Response: typeof Response;
|
||||
AbortController?: typeof AbortController;
|
||||
helixTimeout?: any;
|
||||
}>();
|
||||
|
||||
/**
|
||||
@ -29,7 +29,7 @@ export class WebRequest {
|
||||
if (!smartenv.isBrowser) {
|
||||
console.log('webrequest using node context.');
|
||||
this.polyfillStatusEvaluated = true;
|
||||
const fetchMod = await smartenv.getSafeNodeModule('@adobe/helix-fetch');
|
||||
const fetchMod = await smartenv.getSafeNodeModule('@adobe/fetch');
|
||||
this.neededPolyfillsLoadedDeferred.resolve({
|
||||
fetch: fetchMod.fetch,
|
||||
Response: fetchMod.Response,
|
||||
@ -42,7 +42,7 @@ export class WebRequest {
|
||||
return fetch(...args);
|
||||
},
|
||||
Response: globalThis.Response,
|
||||
AbortController: globalThis.AbortController
|
||||
AbortController: globalThis.AbortController,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -57,8 +57,8 @@ export class WebRequest {
|
||||
constructor(public optionsArg: IWebrequestContructorOptions = {}) {
|
||||
this.options = {
|
||||
logging: true,
|
||||
...optionsArg
|
||||
}
|
||||
...optionsArg,
|
||||
};
|
||||
WebRequest.loadNeededPolyfills();
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ export class WebRequest {
|
||||
useCache: false,
|
||||
...optionsArg,
|
||||
};
|
||||
|
||||
|
||||
const fetchObject = await WebRequest.neededPolyfillsLoadedDeferred.promise;
|
||||
let controller: AbortController;
|
||||
if (optionsArg.timeoutMs) {
|
||||
@ -150,34 +150,36 @@ export class WebRequest {
|
||||
});
|
||||
} else {
|
||||
controller = {
|
||||
signal: fetchObject.helixTimeout(optionsArg.timeoutMs)
|
||||
signal: fetchObject.helixTimeout(optionsArg.timeoutMs),
|
||||
} as any;
|
||||
}
|
||||
}
|
||||
let cachedResponseDeferred = plugins.smartpromise.defer<Response>();
|
||||
let cacheUsed = false;
|
||||
if (optionsArg.useCache && await this.cacheStore.check(urlArg)) {
|
||||
if (optionsArg.useCache && (await this.cacheStore.check(urlArg))) {
|
||||
const responseBuffer: ArrayBuffer = await this.cacheStore.get(urlArg);
|
||||
cachedResponseDeferred.resolve(new Response(responseBuffer, {}));
|
||||
} else {
|
||||
cachedResponseDeferred.resolve(null);
|
||||
}
|
||||
let response: Response = await fetchObject.fetch(urlArg, {
|
||||
signal: controller ? controller.signal : null,
|
||||
method: optionsArg.method,
|
||||
headers: {
|
||||
...(optionsArg.headers || {}),
|
||||
},
|
||||
body: optionsArg.body,
|
||||
}).catch(async (err) => {
|
||||
if (optionsArg.useCache && (await cachedResponseDeferred.promise)) {
|
||||
cacheUsed = true;
|
||||
const cachedResponse = cachedResponseDeferred.promise;
|
||||
return cachedResponse;
|
||||
} else {
|
||||
return err;
|
||||
}
|
||||
});
|
||||
let response: Response = await fetchObject
|
||||
.fetch(urlArg, {
|
||||
signal: controller ? controller.signal : null,
|
||||
method: optionsArg.method,
|
||||
headers: {
|
||||
...(optionsArg.headers || {}),
|
||||
},
|
||||
body: optionsArg.body,
|
||||
})
|
||||
.catch(async (err) => {
|
||||
if (optionsArg.useCache && (await cachedResponseDeferred.promise)) {
|
||||
cacheUsed = true;
|
||||
const cachedResponse = cachedResponseDeferred.promise;
|
||||
return cachedResponse;
|
||||
} else {
|
||||
return err;
|
||||
}
|
||||
});
|
||||
if (optionsArg.useCache && (await cachedResponseDeferred.promise) && response.status === 500) {
|
||||
cacheUsed = true;
|
||||
response = await cachedResponseDeferred.promise;
|
||||
|
Reference in New Issue
Block a user