rekwest 7.2.5 → 7.2.6

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/README.md CHANGED
@@ -22,7 +22,7 @@ and [http2.request](https://nodejs.org/api/http2.html#clienthttp2sessionrequesth
22
22
 
23
23
  ## Prerequisites
24
24
 
25
- * Node.js `>= 20.0.0`
25
+ * Node.js `>=20.0.0`
26
26
 
27
27
  ## Installation
28
28
 
@@ -69,8 +69,6 @@ console.log(res.body);
69
69
  import { Readable } from 'node:stream';
70
70
  import rekwest, {
71
71
  constants,
72
- Blob,
73
- File,
74
72
  FormData,
75
73
  } from 'rekwest';
76
74
 
package/dist/ackn.cjs CHANGED
@@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ackn = void 0;
7
7
  var _nodeTls = require("node:tls");
8
- const ackn = options => new Promise((resolve, reject) => {
9
- const {
10
- url
11
- } = options;
8
+ const ackn = (options = {}) => new Promise((resolve, reject) => {
9
+ const url = new URL(options.url);
12
10
  const socket = (0, _nodeTls.connect)({
13
11
  ...options,
14
12
  ALPNProtocols: ['h2', 'http/1.1'],
package/dist/formdata.cjs CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.parseFormData = exports.isFormData = exports.fdToAsyncIterable = exports.FormData = void 0;
7
- var _nodeBuffer = require("node:buffer");
8
7
  var _nodeCrypto = require("node:crypto");
9
8
  var _nodeHttp = _interopRequireDefault(require("node:http2"));
10
9
  var _mediatypes = require("./mediatypes.cjs");
@@ -31,7 +30,7 @@ class FormData {
31
30
  filename &&= String(filename).toWellFormed();
32
31
  if ((0, _utils.isBlobLike)(value)) {
33
32
  filename ??= String(value.name ?? 'blob').toWellFormed();
34
- value = new _nodeBuffer.File([value], filename, value);
33
+ value = new File([value], filename, value);
35
34
  } else if ((0, _utils.isPipeStream)(value) || (0, _utils.isReadableStream)(value)) {
36
35
  value.name = filename ?? 'blob';
37
36
  } else {
package/dist/index.cjs CHANGED
@@ -5,22 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  constants: true,
8
- mediatypes: true,
9
- Blob: true,
10
- File: true
8
+ mediatypes: true
11
9
  };
12
- Object.defineProperty(exports, "Blob", {
13
- enumerable: true,
14
- get: function () {
15
- return _nodeBuffer.Blob;
16
- }
17
- });
18
- Object.defineProperty(exports, "File", {
19
- enumerable: true,
20
- get: function () {
21
- return _nodeBuffer.File;
22
- }
23
- });
24
10
  Object.defineProperty(exports, "constants", {
25
11
  enumerable: true,
26
12
  get: function () {
@@ -74,7 +60,6 @@ Object.keys(_validation).forEach(function (key) {
74
60
  }
75
61
  });
76
62
  });
77
- var _nodeBuffer = require("node:buffer");
78
63
  var _ackn = require("./ackn.cjs");
79
64
  Object.keys(_ackn).forEach(function (key) {
80
65
  if (key === "default" || key === "__esModule") return;
package/dist/mixin.cjs CHANGED
@@ -40,7 +40,7 @@ const mixin = (res, {
40
40
  value: async function () {
41
41
  (0, _utils.brandCheck)(this, res?.constructor);
42
42
  const val = await this.arrayBuffer();
43
- return new _nodeBuffer.Blob([val]);
43
+ return new Blob([val]);
44
44
  }
45
45
  },
46
46
  bytes: {
package/dist/transfer.cjs CHANGED
@@ -70,12 +70,15 @@ const transfer = async options => {
70
70
  return res;
71
71
  } catch (err) {
72
72
  if ((0, _utils.isLikelyH2cPrefaceError)(err)) {
73
+ const {
74
+ retry
75
+ } = options;
73
76
  options = (0, _utils.deepMerge)(options, {
74
77
  h2: true,
75
78
  retry: {
76
- attempts: 1,
77
- errorCodes: [err.code],
78
- interval: 0
79
+ attempts: ++retry.attempts,
80
+ errorCodes: [err.code, ...retry.errorCodes],
81
+ interval: 1
79
82
  }
80
83
  });
81
84
  }
package/dist/utils.cjs CHANGED
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.stripHeaders = exports.snoop = exports.sameOrigin = exports.normalizeHeaders = exports.normalize = exports.isReadableStream = exports.isPipeStream = exports.isLikelyH2cPrefaceError = exports.isBlobLike = exports.dispatch = exports.deepMerge = exports.cloneWith = exports.brandCheck = exports.augment = exports.addSearchParams = void 0;
7
7
  exports.tap = tap;
8
8
  exports.unwind = exports.toCamelCase = void 0;
9
- var _nodeBuffer = require("node:buffer");
10
9
  var _nodeHttp = _interopRequireDefault(require("node:http2"));
11
10
  var _nodeStream = require("node:stream");
12
11
  var _config = _interopRequireWildcard(require("./config.cjs"));
@@ -97,7 +96,7 @@ const dispatch = (req, {
97
96
  }
98
97
  };
99
98
  exports.dispatch = dispatch;
100
- const isBlobLike = val => val instanceof _nodeBuffer.Blob;
99
+ const isBlobLike = val => val instanceof Blob;
101
100
  exports.isBlobLike = isBlobLike;
102
101
  const isLikelyH2cPrefaceError = err => err.code === 'HPE_INVALID_CONSTANT';
103
102
  exports.isLikelyH2cPrefaceError = isLikelyH2cPrefaceError;
package/package.json CHANGED
@@ -11,11 +11,11 @@
11
11
  "devDependencies": {
12
12
  "@babel/cli": "^7.28.6",
13
13
  "@babel/core": "^7.29.0",
14
- "@babel/preset-env": "^7.29.0",
15
- "@eslint/markdown": "^7.5.1",
16
- "c8": "^10.1.3",
17
- "eslint": "^10.0.1",
18
- "eslint-config-ultra-refined": "^4.1.2",
14
+ "@babel/preset-env": "^7.29.2",
15
+ "@eslint/markdown": "^8.0.0",
16
+ "c8": "^11.0.0",
17
+ "eslint": "^10.1.0",
18
+ "eslint-config-ultra-refined": "^4.1.5",
19
19
  "mocha": "^11.7.5"
20
20
  },
21
21
  "engines": {
@@ -72,5 +72,5 @@
72
72
  "test:cover": "c8 --include=src --reporter=lcov --reporter=text npm test"
73
73
  },
74
74
  "type": "module",
75
- "version": "7.2.5"
75
+ "version": "7.2.6"
76
76
  }
package/src/ackn.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { connect } from 'node:tls';
2
2
 
3
- export const ackn = (options) => new Promise((resolve, reject) => {
4
- const { url } = options;
3
+ export const ackn = (options = {}) => new Promise((resolve, reject) => {
4
+ const url = new URL(options.url);
5
5
  const socket = connect({
6
6
  ...options,
7
7
  ALPNProtocols: [
package/src/formdata.js CHANGED
@@ -1,4 +1,3 @@
1
- import { File } from 'node:buffer';
2
1
  import { randomBytes } from 'node:crypto';
3
2
  import http2 from 'node:http2';
4
3
  import {
package/src/index.js CHANGED
@@ -14,10 +14,6 @@ import {
14
14
  } from './utils.js';
15
15
  import { validation } from './validation.js';
16
16
 
17
- export {
18
- Blob,
19
- File,
20
- } from 'node:buffer';
21
17
  export { constants } from 'node:http2';
22
18
  export * from './ackn.js';
23
19
  export * from './codecs.js';
package/src/mixin.js CHANGED
@@ -1,7 +1,4 @@
1
- import {
2
- Blob,
3
- isUtf8,
4
- } from 'node:buffer';
1
+ import { isUtf8 } from 'node:buffer';
5
2
  import http2 from 'node:http2';
6
3
  import { buffer } from 'node:stream/consumers';
7
4
  import { MIMEType } from 'node:util';
package/src/transfer.js CHANGED
@@ -72,12 +72,17 @@ export const transfer = async (options) => {
72
72
  return res;
73
73
  } catch (err) {
74
74
  if (isLikelyH2cPrefaceError(err)) {
75
+ const { retry } = options;
76
+
75
77
  options = deepMerge(options, {
76
78
  h2: true,
77
79
  retry: {
78
- attempts: 1,
79
- errorCodes: [err.code],
80
- interval: 0,
80
+ attempts: ++retry.attempts,
81
+ errorCodes: [
82
+ err.code,
83
+ ...retry.errorCodes,
84
+ ],
85
+ interval: 1,
81
86
  },
82
87
  });
83
88
  }
package/src/utils.js CHANGED
@@ -1,4 +1,3 @@
1
- import { Blob } from 'node:buffer';
2
1
  import http2 from 'node:http2';
3
2
  import {
4
3
  isReadable,