expf-sigma-node.js 1.2.2 → 1.2.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.
- package/package.json +1 -1
- package/public/sigma.js +4 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expf-sigma-node.js",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "expf-sigma-node.js lets you manage features flags and remote config across web, server side applications. Deliver true Continuous Integration. Get builds out faster. Control who has access to new features.",
|
|
5
5
|
"main": "public/sigma.js",
|
|
6
6
|
"keywords": [
|
package/public/sigma.js
CHANGED
|
@@ -143,39 +143,33 @@ var import_node_cache2 = __toESM(require("node-cache"));
|
|
|
143
143
|
var defaultGeoCacheTTL = 5 * 60;
|
|
144
144
|
var maxGeoCacheTTL = 120 * 60;
|
|
145
145
|
var minGeoCacheTTL = 1 * 60;
|
|
146
|
+
var sigmaGeoCache = new import_node_cache2.default();
|
|
146
147
|
var SigmaGeoCache = class {
|
|
147
148
|
constructor(postfix, geoCacheTTL) {
|
|
148
149
|
this.geoCacheTTL = geoCacheTTL || defaultGeoCacheTTL;
|
|
149
150
|
if (geoCacheTTL > maxGeoCacheTTL || geoCacheTTL < minGeoCacheTTL) {
|
|
150
151
|
this.geoCacheTTL = defaultGeoCacheTTL;
|
|
151
152
|
}
|
|
152
|
-
this.sigmaGeoCache = new import_node_cache2.default({ stdTTL: this.geoCacheTTL });
|
|
153
153
|
this.postfix = "";
|
|
154
154
|
if (postfix)
|
|
155
155
|
this.postfix = "__" + postfix;
|
|
156
156
|
}
|
|
157
157
|
get(key) {
|
|
158
158
|
try {
|
|
159
|
-
return
|
|
159
|
+
return sigmaGeoCache.get(key + this.postfix);
|
|
160
160
|
} catch (e) {
|
|
161
161
|
console.log(e);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
set(key, value) {
|
|
165
165
|
try {
|
|
166
|
-
return
|
|
166
|
+
return sigmaGeoCache.set(key + this.postfix, value, this.geoCacheTTL);
|
|
167
167
|
} catch (e) {
|
|
168
168
|
console.log(e);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
keys() {
|
|
172
|
-
return
|
|
173
|
-
}
|
|
174
|
-
parse(data) {
|
|
175
|
-
if (!this.get(data)) {
|
|
176
|
-
throw new Error(`${data} not found in cache`);
|
|
177
|
-
}
|
|
178
|
-
return JSON.parse(this.get(data));
|
|
172
|
+
return sigmaGeoCache.keys();
|
|
179
173
|
}
|
|
180
174
|
};
|
|
181
175
|
|
|
@@ -922,7 +916,6 @@ var defaultApi = "https://api.expf.ru/api/v1";
|
|
|
922
916
|
var sigmaUserId = "sigmaUserId";
|
|
923
917
|
var sigmaDataFile = "sigmaDataFile";
|
|
924
918
|
var sigmaExperiments = "sigmaExperiments";
|
|
925
|
-
var sigmaGeoData = "sigmaGeoData";
|
|
926
919
|
var SHA256 = new sigmaHashes_default.SHA256();
|
|
927
920
|
var MD5 = new sigmaHashes_default.MD5();
|
|
928
921
|
var max_decimal_64 = 18446744073709552e3;
|
|
@@ -1486,10 +1479,6 @@ var Sigma = class {
|
|
|
1486
1479
|
const data = await this.cache.get("sigmaHash");
|
|
1487
1480
|
return data;
|
|
1488
1481
|
}
|
|
1489
|
-
async getCacheGeoData() {
|
|
1490
|
-
const data = await this.cache.get(sigmaGeoData);
|
|
1491
|
-
return data;
|
|
1492
|
-
}
|
|
1493
1482
|
async getCacheUserId() {
|
|
1494
1483
|
const data = await this.cache.get(sigmaUserId);
|
|
1495
1484
|
return data;
|