expf-sigma-node.js 0.0.3 → 0.0.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/sigma.js +6 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expf-sigma-node.js",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
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
@@ -5785,16 +5785,16 @@ var sigmaDataFile = "sigmaDataFile";
5785
5785
  var SHA256 = new import_jshashes.default.SHA256();
5786
5786
  var MD5 = new import_jshashes.default.MD5();
5787
5787
  var Sigma = class {
5788
- constructor(token, userData, api2, cacheTTL = 10, retries = 3) {
5788
+ constructor(token, userData, cacheTTL = 10, api2, retries = 3) {
5789
5789
  if (!token) {
5790
5790
  throw new Error("Please specify a token");
5791
5791
  }
5792
5792
  this.token = token;
5793
5793
  this.userData = userData || {};
5794
- this.api = api2 || `${defaultApi}/config.json`;
5795
- this.sigmaUserData = sigmaUserData;
5796
5794
  cacheTTL < 10 ? this.cacheTTL = 10 : this.cacheTTL = cacheTTL;
5795
+ this.api = api2 || `${defaultApi}/config.json`;
5797
5796
  this.retries = retries;
5797
+ this.sigmaUserData = sigmaUserData;
5798
5798
  this.sigmaUserData.init({
5799
5799
  userId: this.userData.userId || null,
5800
5800
  ip: this.userData.ip || null,
@@ -5804,10 +5804,11 @@ var Sigma = class {
5804
5804
  });
5805
5805
  if (!this.userData.userId) {
5806
5806
  this.setUserCookie();
5807
+ this.sigmaUserData.setUserId(cache.get(sigmaUserId));
5807
5808
  } else {
5808
5809
  cache.set(sigmaUserId, this.userData.userId);
5810
+ this.sigmaUserData.setUserId(this.userData.userId);
5809
5811
  }
5810
- this.sigmaUserData.setUserId(cache.get(sigmaUserId));
5811
5812
  }
5812
5813
  delay(ms) {
5813
5814
  new Promise((resolve) => setTimeout(() => resolve(void 0), ms));
@@ -5894,7 +5895,7 @@ var Sigma = class {
5894
5895
  throw new Error(`
5895
5896
  save data to cache: ${error},
5896
5897
  token: ${this.token},
5897
- url: ${defaultApi}/config
5898
+ url: ${defaultApi}/config.json
5898
5899
  `);
5899
5900
  } else {
5900
5901
  console.error(`Get data config: ${error}`);