@stepzen/fetch 0.44.0 → 0.45.0-experimental.6baaa11

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { RequestInfo, RequestInit, Response } from 'node-fetch';
2
- declare const fetch: (url: RequestInfo, init?: RequestInit) => Promise<Response>;
1
+ import type { RequestInfo, RequestInit, Response } from 'node-fetch';
2
+ declare const fetch: (url: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
3
3
  export default fetch;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAA;AAe7D,QAAA,MAAM,KAAK,QACJ,WAAW,SACT,WAAW,KACjB,QAAQ,QAAQ,CAclB,CAAA;AAED,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAA;AAmBlE,QAAA,MAAM,KAAK,QACJ,WAAW,GAAG,GAAG,SACf,WAAW,KACjB,QAAQ,QAAQ,CAclB,CAAA;AAED,eAAe,KAAK,CAAA"}
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 fetch0 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 fetch0(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,KAAK,CAAC;IACjC,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,IAAA,oBAAM,EAAC,GAAG,EAAE;QACjB,KAA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,KAAK,CAAA"}
package/package.json CHANGED
@@ -1,46 +1,49 @@
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-experimental.6baaa11",
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"
23
23
  },
24
24
  "dependencies": {
25
25
  "debug": "^4.3.4",
26
- "node-fetch": "^2.6.9"
26
+ "node-fetch": "^3.3.2"
27
27
  },
28
28
  "devDependencies": {
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",
34
- "@types/node-fetch": "^2.6.2",
32
+ "@types/mocha": "^10.0.9",
35
33
  "chai": "^4.3.10",
36
34
  "fancy-test": "^1.4.10",
37
35
  "glob": "^10.2.5",
38
36
  "license-checker": "^25.0.1",
39
- "mocha": "^10.2.0",
37
+ "mocha": "^10.8.2",
40
38
  "mock-fs": "^4.13.0",
41
39
  "nyc": "^15.1.0",
42
40
  "prettier": "^2.8.3",
43
- "ts-node": "^10.8.2"
41
+ "ts-node": "^10.9.2",
42
+ "typescript": ">=5 <5.4"
44
43
  },
45
- "gitHead": "9afcacbee765998d29795896f8969fd9e4e29926"
44
+ "overrides": {
45
+ "--comment--": "workaround for CVE-2024-21538",
46
+ "cross-spawn": "^7.0.6"
47
+ },
48
+ "gitHead": "6baaa119f672aaf963108ce412e02ba5079d0445"
46
49
  }
package/src/index.ts CHANGED
@@ -1,25 +1,26 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as http from 'http'
4
- import * as https from 'https'
3
+ import type {RequestInfo, RequestInit, Response} from 'node-fetch'
4
+
5
+ import {Agent as HttpAgent} from 'node:http'
6
+ import {Agent as HttpsAgent} from 'node:https'
5
7
  import fetch0 from 'node-fetch'
6
- import {RequestInfo, RequestInit, Response} from 'node-fetch'
7
8
 
8
9
  // workaround for https://github.com/steprz/stepzen-cli/issues/934
9
- const httpAgent = new http.Agent({
10
+ const httpAgent = new HttpAgent({
10
11
  keepAlive: true,
11
12
  scheduling: 'lifo',
12
13
  timeout: 5000,
13
14
  })
14
15
 
15
- const httpsAgent = new https.Agent({
16
+ const httpsAgent = new HttpsAgent({
16
17
  keepAlive: true,
17
18
  scheduling: 'lifo',
18
19
  timeout: 5000,
19
20
  })
20
21
 
21
22
  const fetch = async (
22
- url: RequestInfo,
23
+ url: RequestInfo | URL,
23
24
  init?: RequestInit,
24
25
  ): Promise<Response> => {
25
26
  let urlstr