@naturalcycles/js-lib 15.30.1 → 15.31.0

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,6 +1,7 @@
1
1
  /// <reference lib="es2022" preserve="true" />
2
2
  /// <reference lib="dom" preserve="true" />
3
3
  /// <reference lib="dom.iterable" preserve="true" />
4
+ import type { ReadableStream as WebReadableStream } from 'node:stream/web';
4
5
  import { HttpRequestError } from '../error/error.util.js';
5
6
  import type { ErrorDataTuple } from '../types.js';
6
7
  import type { FetcherAfterResponseHook, FetcherBeforeRequestHook, FetcherBeforeRetryHook, FetcherCfg, FetcherGraphQLOptions, FetcherNormalizedCfg, FetcherOnErrorHook, FetcherOptions, FetcherResponse, RequestInitNormalized } from './fetcher.model.js';
@@ -61,7 +62,7 @@ export declare class Fetcher {
61
62
  * More on streams and Node interop:
62
63
  * https://css-tricks.com/web-streams-everywhere-and-fetch-for-node-js/
63
64
  */
64
- getReadableStream(url: string, opt?: FetcherOptions): Promise<ReadableStream<Uint8Array>>;
65
+ getReadableStream(url: string, opt?: FetcherOptions): Promise<WebReadableStream<Uint8Array>>;
65
66
  fetch<T = unknown>(opt: FetcherOptions): Promise<T>;
66
67
  /**
67
68
  * Execute fetch and expect/assert it to return an Error (which will be wrapped in
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.30.1",
4
+ "version": "15.31.0",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "undici": "^7",
@@ -2,6 +2,7 @@
2
2
  /// <reference lib="dom" preserve="true" />
3
3
  /// <reference lib="dom.iterable" preserve="true" />
4
4
 
5
+ import type { ReadableStream as WebReadableStream } from 'node:stream/web'
5
6
  import { _ms, _since } from '../datetime/time.util.js'
6
7
  import { isServerSide } from '../env.js'
7
8
  import { _assertErrorClassOrRethrow, _assertIsError } from '../error/assert.js'
@@ -250,7 +251,10 @@ export class Fetcher {
250
251
  * More on streams and Node interop:
251
252
  * https://css-tricks.com/web-streams-everywhere-and-fetch-for-node-js/
252
253
  */
253
- async getReadableStream(url: string, opt?: FetcherOptions): Promise<ReadableStream<Uint8Array>> {
254
+ async getReadableStream(
255
+ url: string,
256
+ opt?: FetcherOptions,
257
+ ): Promise<WebReadableStream<Uint8Array>> {
254
258
  return await this.fetch({
255
259
  url,
256
260
  responseType: 'readableStream',