@naturalcycles/js-lib 14.139.0 → 14.139.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.
@@ -3,8 +3,6 @@ import type { FetcherAfterResponseHook, FetcherBeforeRequestHook, FetcherBeforeR
3
3
  /**
4
4
  * Experimental wrapper around Fetch.
5
5
  * Works in both Browser and Node, using `globalThis.fetch`.
6
- *
7
- * @experimental
8
6
  */
9
7
  export declare class Fetcher {
10
8
  private constructor();
@@ -20,8 +20,6 @@ const defRetryOptions = {
20
20
  /**
21
21
  * Experimental wrapper around Fetch.
22
22
  * Works in both Browser and Node, using `globalThis.fetch`.
23
- *
24
- * @experimental
25
23
  */
26
24
  class Fetcher {
27
25
  constructor(cfg = {}) {
@@ -340,7 +338,8 @@ class Fetcher {
340
338
  retryPost: false,
341
339
  retry4xx: false,
342
340
  retry5xx: true,
343
- logger: console,
341
+ // logger: console, Danger! doing this mutates console!
342
+ logger: cfg.logger || console,
344
343
  debug,
345
344
  logRequest: debug,
346
345
  logRequestBody: debug,
@@ -355,7 +354,7 @@ class Fetcher {
355
354
  credentials: cfg.credentials,
356
355
  },
357
356
  hooks: {},
358
- }, (0, object_util_1._omit)(cfg, ['method', 'credentials', 'headers']));
357
+ }, (0, object_util_1._omit)(cfg, ['method', 'credentials', 'headers', 'logger']));
359
358
  norm.init.headers = (0, object_util_1._mapKeys)(norm.init.headers, k => k.toLowerCase());
360
359
  return norm;
361
360
  }
@@ -18,8 +18,6 @@ const defRetryOptions = {
18
18
  /**
19
19
  * Experimental wrapper around Fetch.
20
20
  * Works in both Browser and Node, using `globalThis.fetch`.
21
- *
22
- * @experimental
23
21
  */
24
22
  export class Fetcher {
25
23
  constructor(cfg = {}) {
@@ -382,7 +380,8 @@ export class Fetcher {
382
380
  retryPost: false,
383
381
  retry4xx: false,
384
382
  retry5xx: true,
385
- logger: console,
383
+ // logger: console, Danger! doing this mutates console!
384
+ logger: cfg.logger || console,
386
385
  debug,
387
386
  logRequest: debug,
388
387
  logRequestBody: debug,
@@ -397,7 +396,7 @@ export class Fetcher {
397
396
  credentials: cfg.credentials,
398
397
  },
399
398
  hooks: {},
400
- }, _omit(cfg, ['method', 'credentials', 'headers']));
399
+ }, _omit(cfg, ['method', 'credentials', 'headers', 'logger']));
401
400
  norm.init.headers = _mapKeys(norm.init.headers, k => k.toLowerCase());
402
401
  return norm;
403
402
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.139.0",
3
+ "version": "14.139.1",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -39,8 +39,6 @@ const defRetryOptions: FetcherRetryOptions = {
39
39
  /**
40
40
  * Experimental wrapper around Fetch.
41
41
  * Works in both Browser and Node, using `globalThis.fetch`.
42
- *
43
- * @experimental
44
42
  */
45
43
  export class Fetcher {
46
44
  private constructor(cfg: FetcherCfg & FetcherOptions = {}) {
@@ -435,7 +433,8 @@ export class Fetcher {
435
433
  retryPost: false,
436
434
  retry4xx: false,
437
435
  retry5xx: true,
438
- logger: console,
436
+ // logger: console, Danger! doing this mutates console!
437
+ logger: cfg.logger || console,
439
438
  debug,
440
439
  logRequest: debug,
441
440
  logRequestBody: debug,
@@ -451,7 +450,7 @@ export class Fetcher {
451
450
  },
452
451
  hooks: {},
453
452
  },
454
- _omit(cfg, ['method', 'credentials', 'headers']),
453
+ _omit(cfg, ['method', 'credentials', 'headers', 'logger']),
455
454
  )
456
455
 
457
456
  norm.init.headers = _mapKeys(norm.init.headers, k => k.toLowerCase())