@stepzen/fetch 0.44.0 → 0.45.0-beta.1

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 CHANGED
@@ -1,16 +1,14 @@
1
- "use strict";
2
1
  // Copyright IBM Corp. 2020, 2024
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const http = require("http");
5
- const https = require("https");
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 http.Agent({
6
+ const httpAgent = new HttpAgent({
9
7
  keepAlive: true,
10
8
  scheduling: 'lifo',
11
9
  timeout: 5000,
12
10
  });
13
- const httpsAgent = new https.Agent({
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 (0, node_fetch_1.default)(url, {
27
+ return fetchCJSModule.default(url, {
30
28
  agent: urlstr.startsWith('https:') ? httpsAgent : httpAgent,
31
29
  ...init,
32
30
  });
33
31
  };
34
- exports.default = fetch;
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":";AAAA,iCAAiC;;AAEjC,6BAA4B;AAC5B,+BAA8B;AAC9B,2CAA+B;AAG/B,kEAAkE;AAClE,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC;IAC/B,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,IAAI;CACd,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC,KA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A;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.44.0",
4
+ "version": "0.45.0-beta.1",
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": ">=14.0.1",
15
- "npm": ">=6.14"
15
+ "node": ">=18.0"
16
16
  },
17
17
  "scripts": {
18
18
  "clean": "rm -rf lib tsconfig.tsbuildinfo",
19
- "build": "../../node_modules/.bin/tsc -b",
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.1",
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.0",
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.8.2"
42
+ "ts-node": "^10.9.2",
43
+ "typescript": ">=5 <5.4"
44
44
  },
45
- "gitHead": "9afcacbee765998d29795896f8969fd9e4e29926"
45
+ "overrides": {
46
+ "--comment--": "workaround for CVE-2024-21538",
47
+ "cross-spawn": "^7.0.6"
48
+ },
49
+ "gitHead": "bb5012d7d656fb6788e99694f8de7d753f2752e9"
46
50
  }
package/src/index.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as http from 'http'
4
- import * as https from 'https'
5
- import fetch0 from 'node-fetch'
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 http.Agent({
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 https.Agent({
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 fetch0(url, {
34
+ return fetchCJSModule.default(url, {
35
35
  agent: urlstr.startsWith('https:') ? httpsAgent : httpAgent,
36
36
  ...init,
37
37
  })