@tramvai/tokens-common 1.105.2 → 1.106.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.
package/lib/cache.d.ts CHANGED
@@ -1,6 +1,9 @@
1
+ import type { Options } from '@tinkoff/lru-cache-nano';
1
2
  /**
2
3
  * @description
3
4
  * Function for creating a new cache
5
+ *
6
+ * *Note*: currently only memory cache with `@tinkoff/lru-cache-nano` is supported
4
7
  */
5
8
  export declare const CREATE_CACHE_TOKEN: CacheFactory;
6
9
  /**
@@ -19,4 +22,8 @@ export interface Cache<T = any> {
19
22
  has(key: string): boolean;
20
23
  clear(): void;
21
24
  }
22
- export declare type CacheFactory = <T>(type?: string, ...args: unknown[]) => Cache<T>;
25
+ export declare type CacheType = 'memory';
26
+ export interface CacheOptionsByType<T> {
27
+ memory: [Options<string, T>] | [];
28
+ }
29
+ export declare type CacheFactory = <T, Type extends CacheType = 'memory'>(type?: Type, ...args: CacheOptionsByType<T>[Type]) => Cache<T>;
package/lib/index.es.js CHANGED
@@ -68,6 +68,8 @@ const ROOT_PUBSUB_TOKEN = createToken('rootPubsub');
68
68
  /**
69
69
  * @description
70
70
  * Function for creating a new cache
71
+ *
72
+ * *Note*: currently only memory cache with `@tinkoff/lru-cache-nano` is supported
71
73
  */
72
74
  const CREATE_CACHE_TOKEN = createToken('createCache');
73
75
  /**
package/lib/index.js CHANGED
@@ -72,6 +72,8 @@ const ROOT_PUBSUB_TOKEN = dippy.createToken('rootPubsub');
72
72
  /**
73
73
  * @description
74
74
  * Function for creating a new cache
75
+ *
76
+ * *Note*: currently only memory cache with `@tinkoff/lru-cache-nano` is supported
75
77
  */
76
78
  const CREATE_CACHE_TOKEN = dippy.createToken('createCache');
77
79
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-common",
3
- "version": "1.105.2",
3
+ "version": "1.106.0",
4
4
  "description": "Tramvai tokens for @tramvai/module-common",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -19,14 +19,15 @@
19
19
  "build-for-publish": "true"
20
20
  },
21
21
  "dependencies": {
22
- "@tramvai/tokens-core": "1.105.2",
22
+ "@tinkoff/lru-cache-nano": "^7.8.1",
23
+ "@tramvai/tokens-core": "1.106.0",
23
24
  "@types/express": "^4.17.9"
24
25
  },
25
26
  "peerDependencies": {
26
- "@tramvai/state": "1.105.2",
27
- "@tramvai/types-actions-state-context": "1.105.2",
28
- "@tinkoff/logger": "0.10.16",
29
27
  "@tinkoff/dippy": "0.7.41",
28
+ "@tinkoff/logger": "0.10.16",
29
+ "@tramvai/state": "1.106.0",
30
+ "@tramvai/types-actions-state-context": "1.106.0",
30
31
  "express": "^4.17.1",
31
32
  "fastify": "^3.29.0",
32
33
  "react": ">=16.8",