rezo 1.0.27 → 1.0.29

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.
@@ -1,5 +1,7 @@
1
1
  const NodeFormData = require("form-data");
2
- const { Readable } = require("node:stream");
2
+ function isReadableStream(value) {
3
+ return value !== null && typeof value === "object" && typeof value.pipe === "function" && typeof value.read === "function" && typeof value.on === "function";
4
+ }
3
5
 
4
6
  class RezoFormData extends NodeFormData {
5
7
  constructor(options) {
@@ -22,7 +24,7 @@ class RezoFormData extends NodeFormData {
22
24
  const formData = new FormData;
23
25
  const entries = await this.getFieldEntries();
24
26
  for (const [key, value] of entries) {
25
- if (value instanceof Readable) {
27
+ if (isReadableStream(value)) {
26
28
  const chunks = [];
27
29
  for await (const chunk of value) {
28
30
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
@@ -95,7 +97,7 @@ class RezoFormData extends NodeFormData {
95
97
  });
96
98
  return;
97
99
  }
98
- if (value instanceof Readable) {
100
+ if (isReadableStream(value)) {
99
101
  formData.append(key, value);
100
102
  return;
101
103
  }
@@ -152,7 +154,7 @@ class RezoFormData extends NodeFormData {
152
154
  } else {
153
155
  hasOmittedData = true;
154
156
  }
155
- } else if (value instanceof Readable || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
157
+ } else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
156
158
  if (convertBinaryToBase64 && value instanceof File) {
157
159
  hasOmittedData = true;
158
160
  } else {
@@ -190,7 +192,7 @@ class RezoFormData extends NodeFormData {
190
192
  } else {
191
193
  hasOmittedData = true;
192
194
  }
193
- } else if (value instanceof Readable || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
195
+ } else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
194
196
  if (convertBinaryToBase64 && value instanceof File) {
195
197
  hasOmittedData = true;
196
198
  } else {
@@ -1,5 +1,7 @@
1
1
  import NodeFormData from "form-data";
2
- import { Readable } from "node:stream";
2
+ function isReadableStream(value) {
3
+ return value !== null && typeof value === "object" && typeof value.pipe === "function" && typeof value.read === "function" && typeof value.on === "function";
4
+ }
3
5
 
4
6
  export class RezoFormData extends NodeFormData {
5
7
  constructor(options) {
@@ -22,7 +24,7 @@ export class RezoFormData extends NodeFormData {
22
24
  const formData = new FormData;
23
25
  const entries = await this.getFieldEntries();
24
26
  for (const [key, value] of entries) {
25
- if (value instanceof Readable) {
27
+ if (isReadableStream(value)) {
26
28
  const chunks = [];
27
29
  for await (const chunk of value) {
28
30
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
@@ -95,7 +97,7 @@ export class RezoFormData extends NodeFormData {
95
97
  });
96
98
  return;
97
99
  }
98
- if (value instanceof Readable) {
100
+ if (isReadableStream(value)) {
99
101
  formData.append(key, value);
100
102
  return;
101
103
  }
@@ -152,7 +154,7 @@ export class RezoFormData extends NodeFormData {
152
154
  } else {
153
155
  hasOmittedData = true;
154
156
  }
155
- } else if (value instanceof Readable || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
157
+ } else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
156
158
  if (convertBinaryToBase64 && value instanceof File) {
157
159
  hasOmittedData = true;
158
160
  } else {
@@ -190,7 +192,7 @@ export class RezoFormData extends NodeFormData {
190
192
  } else {
191
193
  hasOmittedData = true;
192
194
  }
193
- } else if (value instanceof Readable || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
195
+ } else if (isReadableStream(value) || typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
194
196
  if (convertBinaryToBase64 && value instanceof File) {
195
197
  hasOmittedData = true;
196
198
  } else {
@@ -1,5 +1,3 @@
1
- const util = require("node:util");
2
-
3
1
  class RezoHeaders extends Headers {
4
2
  constructor(init) {
5
3
  if (init instanceof RezoHeaders) {
@@ -149,8 +147,8 @@ class RezoHeaders extends Headers {
149
147
  [Symbol.iterator]() {
150
148
  return Object.entries(this.toObject())[Symbol.iterator]();
151
149
  }
152
- [util.inspect.custom](_depth, options) {
153
- return `${this[Symbol.toStringTag]} ${util.inspect(this.toObject(), options)}`;
150
+ [Symbol.for("nodejs.util.inspect.custom")]() {
151
+ return `${this[Symbol.toStringTag]} ${JSON.stringify(this.toObject())}`;
154
152
  }
155
153
  get [Symbol.toStringTag]() {
156
154
  return "RezoHeaders";
@@ -1,5 +1,3 @@
1
- import util from "node:util";
2
-
3
1
  class RezoHeaders extends Headers {
4
2
  constructor(init) {
5
3
  if (init instanceof RezoHeaders) {
@@ -149,8 +147,8 @@ class RezoHeaders extends Headers {
149
147
  [Symbol.iterator]() {
150
148
  return Object.entries(this.toObject())[Symbol.iterator]();
151
149
  }
152
- [util.inspect.custom](_depth, options) {
153
- return `${this[Symbol.toStringTag]} ${util.inspect(this.toObject(), options)}`;
150
+ [Symbol.for("nodejs.util.inspect.custom")]() {
151
+ return `${this[Symbol.toStringTag]} ${JSON.stringify(this.toObject())}`;
154
152
  }
155
153
  get [Symbol.toStringTag]() {
156
154
  return "RezoHeaders";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rezo",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",