@naturalcycles/nodejs-lib 12.90.1 → 12.90.3

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,4 +1,4 @@
1
- import { AbortableAsyncMapper, AsyncPredicate, CommonLogger, ErrorMode } from '@naturalcycles/js-lib';
1
+ import { AbortableAsyncMapper, AsyncPredicate, CommonLogger, END, ErrorMode, SKIP } from '@naturalcycles/js-lib';
2
2
  import { TransformTyped } from '../stream.model';
3
3
  export interface TransformMapOptions<IN = any, OUT = IN> {
4
4
  /**
@@ -50,4 +50,4 @@ export interface TransformMapOptions<IN = any, OUT = IN> {
50
50
  *
51
51
  * If an Array is returned by `mapper` - it will be flattened and multiple results will be emitted from it. Tested by Array.isArray().
52
52
  */
53
- export declare function transformMap<IN = any, OUT = IN>(mapper: AbortableAsyncMapper<IN, OUT>, opt?: TransformMapOptions<IN, OUT>): TransformTyped<IN, OUT>;
53
+ export declare function transformMap<IN = any, OUT = IN>(mapper: AbortableAsyncMapper<IN, OUT | typeof SKIP | typeof END>, opt?: TransformMapOptions<IN, OUT>): TransformTyped<IN, OUT>;
@@ -1,4 +1,4 @@
1
- import { CommonLogger, ErrorMode, Mapper, Predicate } from '@naturalcycles/js-lib';
1
+ import { CommonLogger, END, ErrorMode, Mapper, Predicate, SKIP } from '@naturalcycles/js-lib';
2
2
  import { AbortableTransform } from '../pipeline/pipeline';
3
3
  import { TransformTyped } from '../stream.model';
4
4
  export interface TransformMapSyncOptions<IN = any, OUT = IN> {
@@ -42,4 +42,4 @@ export declare class TransformMapSync extends AbortableTransform {
42
42
  * Sync (not async) version of transformMap.
43
43
  * Supposedly faster, for cases when async is not needed.
44
44
  */
45
- export declare function transformMapSync<IN = any, OUT = IN>(mapper: Mapper<IN, OUT>, opt?: TransformMapSyncOptions): TransformTyped<IN, OUT>;
45
+ export declare function transformMapSync<IN = any, OUT = IN>(mapper: Mapper<IN, OUT | typeof SKIP | typeof END>, opt?: TransformMapSyncOptions): TransformTyped<IN, OUT>;
@@ -1,6 +1,6 @@
1
1
  import { MemoCache } from '@naturalcycles/js-lib';
2
- import * as LRUCache from 'lru-cache';
3
- export type LRUMemoCacheOptions<KEY, VALUE> = Partial<LRUCache.Options<KEY, VALUE>>;
2
+ import LRUCache from 'lru-cache';
3
+ export type LRUMemoCacheOptions<KEY, VALUE> = Partial<LRUCache.Options<KEY, VALUE, any>>;
4
4
  /**
5
5
  * @example
6
6
  * Use it like this:
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LRUMemoCache = void 0;
4
- const LRUCache = require("lru-cache");
4
+ const lru_cache_1 = require("lru-cache");
5
5
  /**
6
6
  * @example
7
7
  * Use it like this:
@@ -11,7 +11,7 @@ const LRUCache = require("lru-cache");
11
11
  */
12
12
  class LRUMemoCache {
13
13
  constructor(opt) {
14
- this.lru = new LRUCache({
14
+ this.lru = new lru_cache_1.default({
15
15
  max: 100,
16
16
  ...opt,
17
17
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "12.90.1",
3
+ "version": "12.90.3",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "docs-serve": "vuepress dev docs",
@@ -33,7 +33,7 @@
33
33
  "got": "^11.0.1",
34
34
  "joi": "17.4.2",
35
35
  "jsonwebtoken": "^9.0.0",
36
- "lru-cache": "^7.4.0",
36
+ "lru-cache": "^8.0.4",
37
37
  "move-file": "^2.0.0",
38
38
  "through2-concurrent": "^2.0.0",
39
39
  "yargs": "^17.0.0"
@@ -75,7 +75,7 @@ export interface TransformMapOptions<IN = any, OUT = IN> {
75
75
  * If an Array is returned by `mapper` - it will be flattened and multiple results will be emitted from it. Tested by Array.isArray().
76
76
  */
77
77
  export function transformMap<IN = any, OUT = IN>(
78
- mapper: AbortableAsyncMapper<IN, OUT>,
78
+ mapper: AbortableAsyncMapper<IN, OUT | typeof SKIP | typeof END>,
79
79
  opt: TransformMapOptions<IN, OUT> = {},
80
80
  ): TransformTyped<IN, OUT> {
81
81
  const {
@@ -61,7 +61,7 @@ export class TransformMapSync extends AbortableTransform {}
61
61
  * Supposedly faster, for cases when async is not needed.
62
62
  */
63
63
  export function transformMapSync<IN = any, OUT = IN>(
64
- mapper: Mapper<IN, OUT>,
64
+ mapper: Mapper<IN, OUT | typeof SKIP | typeof END>,
65
65
  opt: TransformMapSyncOptions = {},
66
66
  ): TransformTyped<IN, OUT> {
67
67
  let index = -1
@@ -1,8 +1,8 @@
1
1
  import { MemoCache } from '@naturalcycles/js-lib'
2
- import * as LRUCache from 'lru-cache'
2
+ import LRUCache from 'lru-cache'
3
3
 
4
4
  // Partial, to be able to provide default `max`
5
- export type LRUMemoCacheOptions<KEY, VALUE> = Partial<LRUCache.Options<KEY, VALUE>>
5
+ export type LRUMemoCacheOptions<KEY, VALUE> = Partial<LRUCache.Options<KEY, VALUE, any>>
6
6
 
7
7
  /**
8
8
  * @example
@@ -13,13 +13,13 @@ export type LRUMemoCacheOptions<KEY, VALUE> = Partial<LRUCache.Options<KEY, VALU
13
13
  */
14
14
  export class LRUMemoCache<KEY = any, VALUE = any> implements MemoCache<KEY, VALUE> {
15
15
  constructor(opt: LRUMemoCacheOptions<KEY, VALUE>) {
16
- this.lru = new LRUCache<KEY, VALUE>({
16
+ this.lru = new LRUCache<any, any>({
17
17
  max: 100,
18
18
  ...opt,
19
19
  })
20
20
  }
21
21
 
22
- private lru!: LRUCache<KEY, VALUE>
22
+ private lru!: LRUCache<any, any>
23
23
 
24
24
  has(k: any): boolean {
25
25
  return this.lru.has(k)