@stepzen/fetch 0.44.0 → 0.45.0-experimental.32a4304
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/lib/index.js +7 -9
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
- package/src/index.ts +6 -6
package/lib/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright IBM Corp. 2020, 2024
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const node_fetch_1 = require("node-fetch");
|
|
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;QAC3B,MAAM,GAAG,GAAG,CAAA;KACb;SAAM,IAAI,MAAM,IAAI,GAAG,EAAE;QACxB,MAAM,GAAG,GAAG,CAAC,IAAI,CAAA;KAClB;SAAM;QACL,MAAM,GAAG,GAAG,CAAC,GAAG,CAAA;KACjB;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,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stepzen/fetch",
|
|
3
3
|
"description": "StepZen implementation of the fetch() API for NodeJS",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0-experimental.32a4304",
|
|
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": {
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"prettier": "^2.8.3",
|
|
43
44
|
"ts-node": "^10.8.2"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "32a43047da221d51d7680e769ed11f766dcaaba5"
|
|
46
47
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// Copyright IBM Corp. 2020, 2024
|
|
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
|
})
|