expf-sigma-node.js 1.1.0 → 1.1.2

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 +7 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expf-sigma-node.js",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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
@@ -898,7 +898,7 @@ var Sigma = class {
898
898
  this.token = token;
899
899
  this.userData = userData || {};
900
900
  cacheTTL < 10 ? this.cacheTTL = 10 : this.cacheTTL = cacheTTL;
901
- this.api = options.api || `${defaultApi}/config.json`;
901
+ this.api = options.api || `${defaultApi}`;
902
902
  this.retries = options.retries || 3;
903
903
  this.sigmaUserData = new SigmaUserData();
904
904
  this.postfix = options.postfix || "";
@@ -970,16 +970,16 @@ var Sigma = class {
970
970
  this.retries
971
971
  );
972
972
  if (data.status !== 200) {
973
- throw new Error(`Sending data, status: ${data.status}`);
973
+ throw new Error(`${data.status} Token: ${this.token}`);
974
974
  }
975
975
  return data.json();
976
976
  }
977
977
  async getUserGeoData() {
978
978
  try {
979
- const data = await this.getDataFile(`${defaultApi}/geo`);
979
+ const data = await this.getDataFile(`${this.api}/geo`);
980
980
  return data;
981
981
  } catch (error) {
982
- throw new Error(error);
982
+ throw new Error(`Get geo: ${error}`);
983
983
  }
984
984
  }
985
985
  async saveToCache() {
@@ -1008,16 +1008,12 @@ var Sigma = class {
1008
1008
  }
1009
1009
  let data;
1010
1010
  try {
1011
- data = await this.getDataFile(`${api}`);
1011
+ data = await this.getDataFile(`${api}/config.json`);
1012
1012
  } catch (error) {
1013
1013
  if (!this.cache.get(sigmaDataFile)) {
1014
- throw new Error(`
1015
- Get data: ${error},
1016
- token: ${this.token},
1017
- url: ${defaultApi}/config.json
1018
- `);
1014
+ throw new Error(` Get config: ${error}`);
1019
1015
  } else {
1020
- console.error(`Get data config.json: ${error}`);
1016
+ console.error(`Get config: ${error}`);
1021
1017
  return true;
1022
1018
  }
1023
1019
  }