expf-sigma-node.js 0.0.4 → 0.0.5
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 +19 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expf-sigma-node.js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
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
|
@@ -5882,25 +5882,35 @@ var Sigma = class {
|
|
|
5882
5882
|
cache.set("sigmaGeoData", JSON.stringify({ location: "none" }));
|
|
5883
5883
|
console.error(error);
|
|
5884
5884
|
}
|
|
5885
|
+
let data;
|
|
5885
5886
|
try {
|
|
5886
|
-
|
|
5887
|
-
const hash = await SHA256.hex(JSON.stringify(data));
|
|
5888
|
-
if (!localStorageHash || localStorageHash !== hash) {
|
|
5889
|
-
cache.set("sigmaHash", hash);
|
|
5890
|
-
cache.set(sigmaDataFile, JSON.stringify(data));
|
|
5891
|
-
this.sigmaUserData.clearFlags();
|
|
5892
|
-
}
|
|
5887
|
+
data = await this.getDataFile(`${api2}`);
|
|
5893
5888
|
} catch (error) {
|
|
5894
5889
|
if (!cache.get(sigmaDataFile)) {
|
|
5895
5890
|
throw new Error(`
|
|
5896
|
-
|
|
5891
|
+
Get data: ${error},
|
|
5897
5892
|
token: ${this.token},
|
|
5898
5893
|
url: ${defaultApi}/config.json
|
|
5899
5894
|
`);
|
|
5900
5895
|
} else {
|
|
5901
|
-
console.error(`Get data config: ${error}`);
|
|
5896
|
+
console.error(`Get data config.json: ${error}`);
|
|
5897
|
+
return true;
|
|
5902
5898
|
}
|
|
5903
5899
|
}
|
|
5900
|
+
let hash;
|
|
5901
|
+
try {
|
|
5902
|
+
if (typeof data !== "object") {
|
|
5903
|
+
throw new Error(`typeof config.json is not an object`);
|
|
5904
|
+
}
|
|
5905
|
+
hash = await SHA256.hex(JSON.stringify(data));
|
|
5906
|
+
if (!localStorageHash || localStorageHash !== hash) {
|
|
5907
|
+
cache.set("sigmaHash", hash);
|
|
5908
|
+
cache.set(sigmaDataFile, JSON.stringify(data));
|
|
5909
|
+
this.sigmaUserData.clearFlags();
|
|
5910
|
+
}
|
|
5911
|
+
} catch (error) {
|
|
5912
|
+
throw new Error(`Save data to local storage`);
|
|
5913
|
+
}
|
|
5904
5914
|
}
|
|
5905
5915
|
setUserCookie() {
|
|
5906
5916
|
let uin = cache.get(sigmaUserId);
|