@tramvai/module-common 6.80.25 → 6.81.11
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/cacheFactory.es.js +22 -1
- package/lib/cache/cacheFactory.js +22 -1
- package/package.json +19 -19
|
@@ -43,6 +43,17 @@ function cacheFactory(cacheType = MEMORY_LRU, options) {
|
|
|
43
43
|
}
|
|
44
44
|
return cache;
|
|
45
45
|
}
|
|
46
|
+
function getUniqueName(name, cacheNames) {
|
|
47
|
+
if (!cacheNames.has(name)) {
|
|
48
|
+
return name;
|
|
49
|
+
}
|
|
50
|
+
const baseName = `${name}-unsafe-copy`;
|
|
51
|
+
let index = 1;
|
|
52
|
+
while (cacheNames.has(`${baseName}-${index}`)) {
|
|
53
|
+
index += 1;
|
|
54
|
+
}
|
|
55
|
+
return `${baseName}-${index}`;
|
|
56
|
+
}
|
|
46
57
|
function getCacheFactory({ cacheNames, metrics, }) {
|
|
47
58
|
return function (cacheType, options) {
|
|
48
59
|
const cache = cacheFactory(cacheType, options);
|
|
@@ -50,7 +61,17 @@ function getCacheFactory({ cacheNames, metrics, }) {
|
|
|
50
61
|
return cache;
|
|
51
62
|
}
|
|
52
63
|
if (cacheNames.has(options.name)) {
|
|
53
|
-
|
|
64
|
+
if (process.env.NODE_ENV === 'development') {
|
|
65
|
+
const message = `Cache with name ${options.name} is already created`;
|
|
66
|
+
if (typeof window === 'undefined') {
|
|
67
|
+
process.emitWarning(message, 'cache-duplicate-creation');
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// eslint-disable-next-line no-console
|
|
71
|
+
console.warn(message);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
options.name = getUniqueName(options.name, cacheNames);
|
|
54
75
|
}
|
|
55
76
|
cacheNames.add(options.name);
|
|
56
77
|
return new CacheWithMetricsProxy(cache, options, metrics);
|
|
@@ -52,6 +52,17 @@ function cacheFactory(cacheType$1 = tokensCommon.MEMORY_LRU, options) {
|
|
|
52
52
|
}
|
|
53
53
|
return cache;
|
|
54
54
|
}
|
|
55
|
+
function getUniqueName(name, cacheNames) {
|
|
56
|
+
if (!cacheNames.has(name)) {
|
|
57
|
+
return name;
|
|
58
|
+
}
|
|
59
|
+
const baseName = `${name}-unsafe-copy`;
|
|
60
|
+
let index = 1;
|
|
61
|
+
while (cacheNames.has(`${baseName}-${index}`)) {
|
|
62
|
+
index += 1;
|
|
63
|
+
}
|
|
64
|
+
return `${baseName}-${index}`;
|
|
65
|
+
}
|
|
55
66
|
function getCacheFactory({ cacheNames, metrics, }) {
|
|
56
67
|
return function (cacheType, options) {
|
|
57
68
|
const cache = cacheFactory(cacheType, options);
|
|
@@ -59,7 +70,17 @@ function getCacheFactory({ cacheNames, metrics, }) {
|
|
|
59
70
|
return cache;
|
|
60
71
|
}
|
|
61
72
|
if (cacheNames.has(options.name)) {
|
|
62
|
-
|
|
73
|
+
if (process.env.NODE_ENV === 'development') {
|
|
74
|
+
const message = `Cache with name ${options.name} is already created`;
|
|
75
|
+
if (typeof window === 'undefined') {
|
|
76
|
+
process.emitWarning(message, 'cache-duplicate-creation');
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console.warn(message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
options.name = getUniqueName(options.name, cacheNames);
|
|
63
84
|
}
|
|
64
85
|
cacheNames.add(options.name);
|
|
65
86
|
return new cacheWithMetricsProxy.CacheWithMetricsProxy(cache, options, metrics);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.81.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -36,30 +36,30 @@
|
|
|
36
36
|
"@tinkoff/lru-cache-nano": "^7.9.0",
|
|
37
37
|
"@tinkoff/pubsub": "0.9.3",
|
|
38
38
|
"@tinkoff/url": "0.12.4",
|
|
39
|
-
"@tramvai/experiments": "6.
|
|
40
|
-
"@tramvai/module-cookie": "6.
|
|
41
|
-
"@tramvai/module-environment": "6.
|
|
42
|
-
"@tramvai/module-log": "6.
|
|
39
|
+
"@tramvai/experiments": "6.81.11",
|
|
40
|
+
"@tramvai/module-cookie": "6.81.11",
|
|
41
|
+
"@tramvai/module-environment": "6.81.11",
|
|
42
|
+
"@tramvai/module-log": "6.81.11",
|
|
43
43
|
"@tramvai/safe-strings": "0.9.3",
|
|
44
|
-
"@tramvai/tokens-child-app": "6.
|
|
45
|
-
"@tramvai/tokens-common": "6.
|
|
46
|
-
"@tramvai/tokens-core-private": "6.
|
|
47
|
-
"@tramvai/tokens-metrics": "6.
|
|
48
|
-
"@tramvai/tokens-render": "6.
|
|
49
|
-
"@tramvai/tokens-router": "6.
|
|
50
|
-
"@tramvai/tokens-server-private": "6.
|
|
51
|
-
"@tramvai/types-actions-state-context": "6.
|
|
44
|
+
"@tramvai/tokens-child-app": "6.81.11",
|
|
45
|
+
"@tramvai/tokens-common": "6.81.11",
|
|
46
|
+
"@tramvai/tokens-core-private": "6.81.11",
|
|
47
|
+
"@tramvai/tokens-metrics": "6.81.11",
|
|
48
|
+
"@tramvai/tokens-render": "6.81.11",
|
|
49
|
+
"@tramvai/tokens-router": "6.81.11",
|
|
50
|
+
"@tramvai/tokens-server-private": "6.81.11",
|
|
51
|
+
"@tramvai/types-actions-state-context": "6.81.11",
|
|
52
52
|
"hoist-non-react-statics": "^3.3.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@tinkoff/dippy": "^1.0.0",
|
|
56
56
|
"@tinkoff/utils": "^2.1.2",
|
|
57
|
-
"@tramvai/cli": "6.
|
|
58
|
-
"@tramvai/core": "6.
|
|
59
|
-
"@tramvai/papi": "6.
|
|
60
|
-
"@tramvai/react": "6.
|
|
61
|
-
"@tramvai/state": "6.
|
|
62
|
-
"@tramvai/tokens-server": "6.
|
|
57
|
+
"@tramvai/cli": "6.81.11",
|
|
58
|
+
"@tramvai/core": "6.81.11",
|
|
59
|
+
"@tramvai/papi": "6.81.11",
|
|
60
|
+
"@tramvai/react": "6.81.11",
|
|
61
|
+
"@tramvai/state": "6.81.11",
|
|
62
|
+
"@tramvai/tokens-server": "6.81.11",
|
|
63
63
|
"react": ">=16.14.0",
|
|
64
64
|
"tslib": "^2.4.0"
|
|
65
65
|
},
|