@stepzen/fetch 0.45.0-experimental.a6f5273 → 0.45.0-experimental.aa7017c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/lib/index.js +8 -10
- package/lib/index.js.map +1 -1
- package/package.json +13 -9
- package/src/index.ts +7 -7
package/LICENSE
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const https = require("https");
|
|
6
|
-
const node_fetch_1 = require("node-fetch");
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import { Agent as HttpAgent } from 'node:http';
|
|
3
|
+
import { Agent as HttpsAgent } from 'node:https';
|
|
4
|
+
import fetchCJSModule from 'node-fetch';
|
|
7
5
|
// workaround for https://github.com/steprz/stepzen-cli/issues/934
|
|
8
|
-
const httpAgent = new
|
|
6
|
+
const httpAgent = new HttpAgent({
|
|
9
7
|
keepAlive: true,
|
|
10
8
|
scheduling: 'lifo',
|
|
11
9
|
timeout: 5000,
|
|
12
10
|
});
|
|
13
|
-
const httpsAgent = new
|
|
11
|
+
const httpsAgent = new HttpsAgent({
|
|
14
12
|
keepAlive: true,
|
|
15
13
|
scheduling: 'lifo',
|
|
16
14
|
timeout: 5000,
|
|
@@ -26,10 +24,10 @@ const fetch = async (url, init) => {
|
|
|
26
24
|
else {
|
|
27
25
|
urlstr = url.url;
|
|
28
26
|
}
|
|
29
|
-
return
|
|
27
|
+
return fetchCJSModule.default(url, {
|
|
30
28
|
agent: urlstr.startsWith('https:') ? httpsAgent : httpAgent,
|
|
31
29
|
...init,
|
|
32
30
|
});
|
|
33
31
|
};
|
|
34
|
-
|
|
32
|
+
export default fetch;
|
|
35
33
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,EAAC,KAAK,IAAI,SAAS,EAAC,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,YAAY,CAAA;AAC9C,OAAO,cAAc,MAAM,YAAY,CAAA;AAGvC,kEAAkE;AAClE,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;IAC9B,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,IAAI;CACd,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC;IAChC,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,IAAI;CACd,CAAC,CAAA;AAEF,MAAM,KAAK,GAAG,KAAK,EACjB,GAAgB,EAChB,IAAkB,EACC,EAAE;IACrB,IAAI,MAAM,CAAA;IACV,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,CAAA;IACd,CAAC;SAAM,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,CAAC,IAAI,CAAA;IACnB,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,GAAG,CAAC,GAAG,CAAA;IAClB,CAAC;IAED,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE;QACjC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;QAC3D,GAAG,IAAI;KACR,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,eAAe,KAAK,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stepzen/fetch",
|
|
3
3
|
"description": "StepZen implementation of the fetch() API for NodeJS",
|
|
4
|
-
"version": "0.45.0-experimental.
|
|
4
|
+
"version": "0.45.0-experimental.aa7017c",
|
|
5
5
|
"author": "StepZen Ltd",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib/**/*",
|
|
9
9
|
"src/**/*"
|
|
10
10
|
],
|
|
11
|
+
"type": "module",
|
|
11
12
|
"main": "lib/index.js",
|
|
12
13
|
"types": "lib/index.d.ts",
|
|
13
14
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
15
|
-
"npm": ">=6.14"
|
|
15
|
+
"node": ">=18.0"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"clean": "rm -rf lib tsconfig.tsbuildinfo",
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "tsc -b",
|
|
20
20
|
"test": "npm run build && nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
|
21
21
|
"test:single": "npm run build && mocha",
|
|
22
22
|
"posttest": "prettier . --check"
|
|
@@ -29,18 +29,22 @@
|
|
|
29
29
|
"@types/chai": "^4.3.10",
|
|
30
30
|
"@types/debug": "^4.1.7",
|
|
31
31
|
"@types/license-checker": "^25.0.3",
|
|
32
|
-
"@types/mocha": "^10.0.
|
|
33
|
-
"@types/node": "^14.18.36",
|
|
32
|
+
"@types/mocha": "^10.0.9",
|
|
34
33
|
"@types/node-fetch": "^2.6.2",
|
|
35
34
|
"chai": "^4.3.10",
|
|
36
35
|
"fancy-test": "^1.4.10",
|
|
37
36
|
"glob": "^10.2.5",
|
|
38
37
|
"license-checker": "^25.0.1",
|
|
39
|
-
"mocha": "^10.2
|
|
38
|
+
"mocha": "^10.8.2",
|
|
40
39
|
"mock-fs": "^4.13.0",
|
|
41
40
|
"nyc": "^15.1.0",
|
|
42
41
|
"prettier": "^2.8.3",
|
|
43
|
-
"ts-node": "^10.
|
|
42
|
+
"ts-node": "^10.9.2",
|
|
43
|
+
"typescript": ">=5 <5.4"
|
|
44
44
|
},
|
|
45
|
-
"
|
|
45
|
+
"overrides": {
|
|
46
|
+
"--comment--": "workaround for CVE-2024-21538",
|
|
47
|
+
"cross-spawn": "^7.0.6"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "aa7017cebf412a7829e12158699ea14970b7b2d1"
|
|
46
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// Copyright IBM Corp. 2020,
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import {Agent as HttpAgent} from 'node:http'
|
|
4
|
+
import {Agent as HttpsAgent} from 'node:https'
|
|
5
|
+
import fetchCJSModule from 'node-fetch'
|
|
6
6
|
import {RequestInfo, RequestInit, Response} from 'node-fetch'
|
|
7
7
|
|
|
8
8
|
// workaround for https://github.com/steprz/stepzen-cli/issues/934
|
|
9
|
-
const httpAgent = new
|
|
9
|
+
const httpAgent = new HttpAgent({
|
|
10
10
|
keepAlive: true,
|
|
11
11
|
scheduling: 'lifo',
|
|
12
12
|
timeout: 5000,
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
const httpsAgent = new
|
|
15
|
+
const httpsAgent = new HttpsAgent({
|
|
16
16
|
keepAlive: true,
|
|
17
17
|
scheduling: 'lifo',
|
|
18
18
|
timeout: 5000,
|
|
@@ -31,7 +31,7 @@ const fetch = async (
|
|
|
31
31
|
urlstr = url.url
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
return
|
|
34
|
+
return fetchCJSModule.default(url, {
|
|
35
35
|
agent: urlstr.startsWith('https:') ? httpsAgent : httpAgent,
|
|
36
36
|
...init,
|
|
37
37
|
})
|